Ok so I'm embarking on my first "real" PIC project and have some major questions before i get started, so any help would be appreciated.
The project will consist of 25 momentary spst switches wired in a 5x5 matrix so as to only use 10 I/O lines, 25 LED's (next to the buttons) each wired to a separate pin on the PIC, a small speaker for audio, and maybe a 2x20 LCD for displaying the score. The gist of the project is a small game system a child could play.
So onto the questions
#1. Can A single PIC drive 25 LED's off it's pins, or would i need to implement a different design (what if they were small surface mount LED's instead of the larger through-hole type)?
#2. I know (by my current design) I'll need 2 PICs to control everything (I have 16F627A and 16F877A PICs on-hand), My current design uses 10 I/O lines on the 627A for the button matrix, and 5 I/O lines to output which button was pressed (in binary) to the 877A. Can I reduce the number of I/O lines between PICs while also allowing for bidirectional communication (so the 627A can output a 2 digit value [hex or decimal] to the 877A and drive the speaker, as the main program will reside on the 877A)?
#3. Do you think this project will work?
again, any help or opinions are welcome.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It can be done with one 16F887A. You set up the LED's in matrix and scan the LED's at the same time you read the switches. It's the same as reading a matrix keyboard and running a 4 digit LED numeric display. There is an appnote on www.Microchip.com for a volt meter. Go to the web site and search for "volt meter". Scan the matrix with the D and B ports. Connect the LCD display to the D and E ports using E for control.
You can use GCBASIC for the project or "www.oshonsoft.com" Pic_Sim_Ide, Basic. Whatever you do, a bootloader would get the project done faster. Oshonsoft has a bootloader on their site that will also work with GCBASIC. You will, however, need to purchase the Pic_Sim_Ide for 29 euro but it is worth it.
Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't use the LED's in a matrix as i need to be able to flip any number of them on at the same time, thus my first question bout a PIC being able to handle that kind of current.
The first 2 games planned are memory style games, one like the old flip card game (only using tones instead of pictures/numbers) and the 2nd being a SIMON clone. Id like to be able to expand the number of games, so i'm trying to make the platform as flexible as possible, So if I can use serial communication between PICs and drop the number of pins needed to connect them (from 5 to 2) I can implement the speaker on the 627A and free up a couple I/O pins on the 877A for a couple more buttons.
I have another question to add
Can 1 PIC communicate to 2 different PICs serially (IE if i had a 3rd PIC driving the LCD)?
I've almost got my board design finalized so I can really start programming (i like to figure out how things will fit and work together before trying to make them work together), but I need to know if I have to re-design it due to the 877A not being able to drive 25 LED's simultaneously (knowing answers to the other questions would certainly help though as it would allow me to simplify some aspects of the design and it's overall efficiency)
Will post a picture of my basic design when i finish drawing all the lines so you all can get a better grasp of my design and it's potential flaws.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hope you can make sense of this drawing (tried to include a legend that would be sufficient enough)
I haven't re-designed it for serial communication (which seems most likely to happen) or the LCD interface (found a guy selling pre-programmed PIC's w/ LCD displays that only requires 2 pins for serial communication, but for now the LCD is an afterthought)
Try this. Set up the matrix of 25 LED's and use 5 2N3904 to sink the current from 5 LED's. Use 5 bits of the D port in output mode to drive the 2N3904 and the B port in output mode to drive the other side of the LED matrix. Since a bit on the B port will only drive one LED at a time it will not be overloaded. You can use the D port to scan the keyboard. Also use the lower four bits to output data to the LCD with the E port driving the LCD control pins. Use the HLMP-1301 (Jameco 253278) LED to get high light output with low current.
Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
For the software to display the LED's use a loop to turn on a column of LED's with the B port selecting the LED's then on to the next column. Like a movie, if the scan rate is fast enough, the eye sees them as full on.
Within the loop scan the keyboard matrix. When you process a keypress, update the LCD.
Richard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Have changed my design drastically now. Now i'm using a kind of dual matrix for the keypad and LED's., so no serial com needed (well maybe, but i'll cross that bridge when i get to it)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok so I'm embarking on my first "real" PIC project and have some major questions before i get started, so any help would be appreciated.
The project will consist of 25 momentary spst switches wired in a 5x5 matrix so as to only use 10 I/O lines, 25 LED's (next to the buttons) each wired to a separate pin on the PIC, a small speaker for audio, and maybe a 2x20 LCD for displaying the score. The gist of the project is a small game system a child could play.
So onto the questions
#1. Can A single PIC drive 25 LED's off it's pins, or would i need to implement a different design (what if they were small surface mount LED's instead of the larger through-hole type)?
#2. I know (by my current design) I'll need 2 PICs to control everything (I have 16F627A and 16F877A PICs on-hand), My current design uses 10 I/O lines on the 627A for the button matrix, and 5 I/O lines to output which button was pressed (in binary) to the 877A. Can I reduce the number of I/O lines between PICs while also allowing for bidirectional communication (so the 627A can output a 2 digit value [hex or decimal] to the 877A and drive the speaker, as the main program will reside on the 877A)?
#3. Do you think this project will work?
again, any help or opinions are welcome.
It can be done with one 16F887A. You set up the LED's in matrix and scan the LED's at the same time you read the switches. It's the same as reading a matrix keyboard and running a 4 digit LED numeric display. There is an appnote on www.Microchip.com for a volt meter. Go to the web site and search for "volt meter". Scan the matrix with the D and B ports. Connect the LCD display to the D and E ports using E for control.
You can use GCBASIC for the project or "www.oshonsoft.com" Pic_Sim_Ide, Basic. Whatever you do, a bootloader would get the project done faster. Oshonsoft has a bootloader on their site that will also work with GCBASIC. You will, however, need to purchase the Pic_Sim_Ide for 29 euro but it is worth it.
Richard
I can't use the LED's in a matrix as i need to be able to flip any number of them on at the same time, thus my first question bout a PIC being able to handle that kind of current.
The first 2 games planned are memory style games, one like the old flip card game (only using tones instead of pictures/numbers) and the 2nd being a SIMON clone. Id like to be able to expand the number of games, so i'm trying to make the platform as flexible as possible, So if I can use serial communication between PICs and drop the number of pins needed to connect them (from 5 to 2) I can implement the speaker on the 627A and free up a couple I/O pins on the 877A for a couple more buttons.
I have another question to add
Can 1 PIC communicate to 2 different PICs serially (IE if i had a 3rd PIC driving the LCD)?
I've almost got my board design finalized so I can really start programming (i like to figure out how things will fit and work together before trying to make them work together), but I need to know if I have to re-design it due to the 877A not being able to drive 25 LED's simultaneously (knowing answers to the other questions would certainly help though as it would allow me to simplify some aspects of the design and it's overall efficiency)
Will post a picture of my basic design when i finish drawing all the lines so you all can get a better grasp of my design and it's potential flaws.
Hope you can make sense of this drawing (tried to include a legend that would be sufficient enough)
I haven't re-designed it for serial communication (which seems most likely to happen) or the LCD interface (found a guy selling pre-programmed PIC's w/ LCD displays that only requires 2 pins for serial communication, but for now the LCD is an afterthought)
anyways, without further ado, here is my simplified circuit layout
http://img168.imageshack.us/img168/6268/gameb1rn8.jpg
Try this. Set up the matrix of 25 LED's and use 5 2N3904 to sink the current from 5 LED's. Use 5 bits of the D port in output mode to drive the 2N3904 and the B port in output mode to drive the other side of the LED matrix. Since a bit on the B port will only drive one LED at a time it will not be overloaded. You can use the D port to scan the keyboard. Also use the lower four bits to output data to the LCD with the E port driving the LCD control pins. Use the HLMP-1301 (Jameco 253278) LED to get high light output with low current.
Richard
For the software to display the LED's use a loop to turn on a column of LED's with the B port selecting the LED's then on to the next column. Like a movie, if the scan rate is fast enough, the eye sees them as full on.
Within the loop scan the keyboard matrix. When you process a keypress, update the LCD.
Richard
Have changed my design drastically now. Now i'm using a kind of dual matrix for the keypad and LED's., so no serial com needed (well maybe, but i'll cross that bridge when i get to it)