input and save input

tumbleweed

Active Member
The following devices are currently supported.
*SIGH*

I'm obviously posting into a big black hole. The device list on the website is a list of what's included in the installer, which is quite old.
If you follow the link in post #47 you'll find links to the tool that creates device files, and even a zip with a prebuilt set of files.

I just ran the tool using the latest version of mpasmx and this is what I got:
Code:
18F1220, 18F1230, 18F1320, 18F1330, 18F13K22, 18F13K50, 18F14K22,
18F14K22LIN, 18F14K50, 18F2220, 18F2221, 18F2320, 18F2321,
18F2331, 18F23K20, 18F23K22, 18F2410, 18F242, 18F2420,
18F2423, 18F2431, 18F2439, 18F2450, 18F2455, 18F2458,
18F248, 18F2480, 18F24J10, 18F24J11, 18F24J50, 18F24K20,
18F24K22, 18F24K40, 18F24K42, 18F24K50, 18F24Q10, 18F2510,
18F2515, 18F252, 18F2520, 18F2523, 18F2525, 18F2539,
18F2550, 18F2553, 18F258, 18F2580, 18F2585, 18F25J10,
18F25J11, 18F25J50, 18F25K20, 18F25K22, 18F25K40, 18F25K42,
18F25K50, 18F25K80, 18F25K83, 18F25Q10, 18F2610, 18F2620,
18F2680, 18F2682, 18F2685, 18F26J11, 18F26J13, 18F26J50,
18F26J53, 18F26K20, 18F26K22, 18F26K40, 18F26K42, 18F26K80,
18F26K83, 18F27J13, 18F27J53, 18F27K40, 18F27K42, 18F4220,
18F4221, 18F4320, 18F4321, 18F4331, 18F43K20, 18F43K22,
18F4410, 18F442, 18F4420, 18F4423, 18F4431, 18F4439,
18F4450, 18F4455, 18F4458, 18F448, 18F4480, 18F44J10,
18F44J11, 18F44J50, 18F44K20, 18F44K22, 18F4510, 18F4515,
18F452, 18F4520, 18F4523, 18F4525, 18F4539, 18F4550,
18F4553, 18F458, 18F4580, 18F4585, 18F45J10, 18F45J11,
18F45J50, 18F45K20, 18F45K22, 18F45K40, 18F45K42, 18F45K50,
18F45K80, 18F4610, 18F4620, 18F4680, 18F4682, 18F4685,
18F46J11, 18F46J13, 18F46J50, 18F46J53, 18F46K20, 18F46K22,
18F46K40, 18F46K42, 18F46K80, 18F47J13, 18F47J53, 18F47K40,
18F47K42, 18F55K42, 18F56K42, 18F57K42, 18F6310, 18F6390,
18F6393, 18F63J11, 18F63J90, 18F6410, 18F6490, 18F6493,
18F64J11, 18F64J90, 18F6520, 18F6525, 18F6527, 18F6585,
18F65J10, 18F65J11, 18F65J15, 18F65J50, 18F65J90, 18F65J94,
18F65K22, 18F65K40, 18F65K80, 18F65K90, 18F6620, 18F6621,
18F6622, 18F6627, 18F6628, 18F6680, 18F66J10, 18F66J11,
18F66J15, 18F66J16, 18F66J50, 18F66J55, 18F66J60, 18F66J65,
18F66J90, 18F66J93, 18F66J94, 18F66J99, 18F66K22, 18F66K40,
18F66K80, 18F66K90, 18F6720, 18F6722, 18F6723, 18F67J10,
18F67J11, 18F67J50, 18F67J60, 18F67J90, 18F67J93, 18F67J94,
18F67K22, 18F67K40, 18F67K90, 18F8310, 18F8390, 18F8393,
18F83J11, 18F83J90, 18F8410, 18F8490, 18F8493, 18F84J11,
18F84J90, 18F8520, 18F8525, 18F8527, 18F8585, 18F85J10,
18F85J11, 18F85J15, 18F85J50, 18F85J90, 18F85J94, 18F85K22,
18F85K90, 18F8620, 18F8621, 18F8622, 18F8627, 18F8628,
18F8680, 18F86J10, 18F86J11, 18F86J15, 18F86J16, 18F86J50,
18F86J55, 18F86J60, 18F86J65, 18F86J72, 18F86J90, 18F86J93,
18F86J94, 18F86J99, 18F86K22, 18F86K90, 18F8720, 18F8722,
18F8723, 18F87J10, 18F87J11, 18F87J50, 18F87J60, 18F87J72,
18F87J90, 18F87J93, 18F87J94, 18F87K22, 18F87K90, 18F95J94,
18F96J60, 18F96J65, 18F96J94, 18F96J99, 18F97J60, 18F97J94,
18LF1220, 18LF1230, 18LF1320, 18LF1330, 18LF13K22, 18LF13K50,
18LF14K22, 18LF14K50, 18LF2220, 18LF2221, 18LF2320, 18LF2321,
18LF2331, 18LF23K22, 18LF2410, 18LF242, 18LF2420, 18LF2423,
18LF2431, 18LF2439, 18LF2450, 18LF2455, 18LF2458, 18LF248,
18LF2480, 18LF24J10, 18LF24J11, 18LF24J50, 18LF24K22, 18LF24K40,
18LF24K42, 18LF24K50, 18LF2510, 18LF2515, 18LF252, 18LF2520,
18LF2523, 18LF2525, 18LF2539, 18LF2550, 18LF2553, 18LF258,
18LF2580, 18LF2585, 18LF25J10, 18LF25J11, 18LF25J50, 18LF25K22,
18LF25K40, 18LF25K42, 18LF25K50, 18LF25K80, 18LF25K83, 18LF2610,
18LF2620, 18LF2680, 18LF2682, 18LF2685, 18LF26J11, 18LF26J13,
18LF26J50, 18LF26J53, 18LF26K22, 18LF26K40, 18LF26K42, 18LF26K80,
18LF26K83, 18LF27J13, 18LF27J53, 18LF27K40, 18LF27K42, 18LF4220,
18LF4221, 18LF4320, 18LF4321, 18LF4331, 18LF43K22, 18LF4410,
18LF442, 18LF4420, 18LF4423, 18LF4431, 18LF4439, 18LF4450,
18LF4455, 18LF4458, 18LF448, 18LF4480, 18LF44J10, 18LF44J11,
18LF44J50, 18LF44K22, 18LF4510, 18LF4515, 18LF452, 18LF4520,
18LF4523, 18LF4525, 18LF4539, 18LF4550, 18LF4553, 18LF458,
18LF4580, 18LF4585, 18LF45J10, 18LF45J11, 18LF45J50, 18LF45K22,
18LF45K40, 18LF45K42, 18LF45K50, 18LF45K80, 18LF4610, 18LF4620,
18LF4680, 18LF4682, 18LF4685, 18LF46J11, 18LF46J13, 18LF46J50,
18LF46J53, 18LF46K22, 18LF46K40, 18LF46K42, 18LF46K80, 18LF47J13,
18LF47J53, 18LF47K40, 18LF47K42, 18LF55K42, 18LF56K42, 18LF57K42,
18LF6310, 18LF6390, 18LF6393, 18LF6410, 18LF6490, 18LF6493,
18LF6520, 18LF6525, 18LF6527, 18LF6585, 18LF65K40, 18LF65K80,
18LF6620, 18LF6621, 18LF6622, 18LF6627, 18LF6628, 18LF6680,
18LF66K40, 18LF66K80, 18LF6720, 18LF6722, 18LF6723, 18LF67K40,
18LF8310, 18LF8390, 18LF8393, 18LF8410, 18LF8490, 18LF8493,
18LF8520, 18LF8525, 18LF8527, 18LF8585, 18LF8620, 18LF8621,
18LF8622, 18LF8627, 18LF8628, 18LF8680, 18LF8720, 18LF8722,
18LF8723
You should discount the xxK42 and xxK83 devices. The tool generates files for those but they're not really usable since they are the new 18XV core devices with a different memory layout.

MrDEB

Well-Known Member
Jon is correct that I didn't get the full jest of the device part numbers. I would like to use a K series but am shall we call it K series shy.
Delt with them before. I might order a 18F44K22 chip. Got to get my feet wet seeing how Washington gets rain most every day.
But before I do anything I want to breadboard a matrix of switches and see what the code does.
as for what I have going on
1-Start indicator Led w/ mon. push-button
1 Time set mon. push-button switch
10 - mon. tactile switches
2 HLVD indicator LEDs
10-Player LEDs
6-Time countdown LEDs
1-game option spdt slide switch
2 - Vdd, 2 grd
5 - ICSP

Have already written code for the countdown timer and it works. Just need to write code for the LED matrix to play nice with the Player positions etc.
I couldn't have got this far without a-lot of help from the Electrotech community.

JonSea

Well-Known Member
*SIGH*

I'm obviously posting into a big black hole....
This is pretty typical for a MrDEB project. Four pages of forum posts to read a few switches and flash a few LEDs, and nobody really has a clue about what he's trying to do.

Pommie

Well-Known Member
OK, assuming 20 LEDs and 15 switches/push buttons requires a 5x7 array, why do you need a 40 pin chip?

Mike.

MrDEB

Well-Known Member
If I use a Matrix for the switches I run the chance of two button presses at the same time. I want to avoid this.
Yes this thread is getting long but different aspects of project design have been discussed.
The switches in a matrix is not off the table yet but the all LEDs in a matrix are on the table. Was searching for the keypad.bas module and all I could find was modified version that I need to test out.

MrDEB

Well-Known Member
Well after contemplating ideas and researching switch matrix I think I have a solution o prevent ghosting and lower the pin count. Just need a bigger matrix

be80be

Well-Known Member
Those led's must be the latest They light with no ground. Oh you just want see when the key is pressed

JonSea

Well-Known Member
Those led's must be the latest They light with no ground. Oh you just want see when the key is pressed

Hmmm. No series resistors either.

MrDEB

Well-Known Member
that schematic is my bad but an idea. After posting and sitting in the car to go to church I realized my mistake.
The leds have no resistors and the inputs would be floating. Besides I need to have the LEDs separate from the switches because the LEDs come on when the input port goes LOW (pull-up resistors needed as well unless I enable the device pull-ups)and the LEDs stay on until the switch pulls the input LOW again. The bright side of this schematic got me thinking how to improve on the matrix idea. I just might be able to go back to a 28 pin device thanks to Pommies suggestion.
Will work on this tonight or in the morning. Got some cookies to bake with wife and move some railroad ties for carport being put up on Wednesday.

MrDEB

Well-Known Member
After several power outages due to trees I am able to get back to this project.
Was dealing with best layout to allow scanning the ports with limited issues.
The switches are mon. tactile switches and when a player depresses his/ her switch their led is enabled until a second button press.
I need to breadboard a portion of this matrix to see if scanning the ports will work. it should. and keep the desired LED enabled.
researching how to "dimension" or denote that player(1) switch is located at PortB.1 and led at Portc.2. Looking at the tetris games over at DDIY for ideas.

Attachments

• 204.2 KB Views: 51

tumbleweed

Active Member
Can you explain how that matrix works? How do you read a switch?

I know people have suggested that you multiplex things, but realistically you would have a much better chance just using a single pin for each switch and led.
That's going to be enough of a stretch to get working. I can't image how many pages the scanning routine code we'd be subjected to would take.
.

JonSea

Well-Known Member
If I recall correctly, we have discussed at great length that you can not assign an array of Player(1) to Player(n) to port pins B0 - B7. This can't be done in Swordfish. No matter how much you wish it to be true, it's not going to work.

With a 40 pin 18F-series chip, you have all of ports B, C and D available making 24 I/O pins available in a nice arrangement plus 8 additional port pins on port A and E. Even if you want to have 12 players, there's no need to resort to a matrix.

But so far, what you've described is best accomplished with toggle switches and LEDs - forget the micro. Player 1 flips his switch. The LED is on. He flips the switch the other way, the LED is off.

I know a flow chart is a mystery to you but perhaps you can explain from the moment you have 12 people cornered to play this game. Starting with what happens when they pull the device out of the box and find dead batteries, describe step by step what happens until the players shout hallelujah and scatter before another game can start. Explain step by excruciating step so that we can understand the great brilliance you are attempting to accomplish.

MrDEB

Well-Known Member
the only reason I wanted to try a matrix is a suggestion from Pommie. I realize I can't dimension a variable.
Was / am going to experiment using a snippet from the tetris code
Px = orginx
Py = orginy
Q = 0
But pretty sure it won't work.
My thoughts are portB.bits(0) and portC.bits (0)= player(1)
portB.bits(1) and portC.bits(0) = player(2)
not sure if I have this syntax correct but it is just a suggestion that I might experiment with on a breadboard.

be80be

Well-Known Member
Jon just go ahead and wright the code for this and Mike can post how to hook leds and switches to the same pins we be done today.

But I no this a waste of time you can't have 3dimension array
I no that hurts cause of typing is harder then copy and paste but
I looked at some code for lcd Select Case would make it easy to over come the 3D array problem.

to read the switch you read as input you stick a big resistor so the switch cant turn on the led but when you read for switches you'll see that it was low or high I think high is better but both could work.

Last edited:

tumbleweed

Active Member
Let's look at the top leftmost switch S5 and diode D11.
What makes the PORTB pin it's connected to ever read a valid high or low?

JonSea

Well-Known Member
....I know a flow chart is a mystery to you but perhaps you can explain from the moment you have 12 people cornered to play this game. Starting with what happens when they pull the device out of the box and find dead batteries, describe step by step what happens until the players shout hallelujah and scatter before another game can start. Explain step by excruciating step so that we can understand the great brilliance you are attempting to accomplish.....
Unless MrDEB can explain what he's trying to accomplish in detail instead of random spurts of gibberish, any and all efforts to help him are futile.

Maybe MrDEB can put some thought into his project for a change and explain what he's trying to do.

Pommie

Well-Known Member
Let's look at the top leftmost switch S5 and diode D11.
What makes the PORTB pin it's connected to ever read a valid high or low?
He needs to turn on portc WPUs, (if they exist) then drive portb low 1 bit at a time in order to read the switches.

This is not going to happen.

Mike.

JonSea

Well-Known Member
He needs to turn on portc WPUs, (if they exist) then drive portb low 1 bit at a time in order to read the switches.

This is not going to happen.

Mike.

So sorry. For the chip we have been ealking about only Port B has weak internal pullups. Bummer.

MrDEB

Well-Known Member
what Pommie has posted, one bit at a time.
PortB wpu's are enabled and portC are cycled LOW (portC.bits(x)= 0) All portC ports are HIGH then scanned LOW.
I realize a multi dimensioned arrays are no doable in Swordfish.
Will look at Burts suggestion.
When a player depresses his / her switch, his / her led comes ON
When player depresses his / her switch again the led is turned OFF
This routine has been written and works perfect. Now trying to include a matrix switch / led array as this was suggested to use.
I am using my Mexican Train basic idea and code and adding a second option of play where each player must complete his / her turn before the time runs out. If their time runs out, they lose their turn. Pretty simple if I use a 40+ pic which may be what I end up doing if I can't configure a method to use the matrix.