A couple of years ago I kluged together a module similar to what you are describing. I used a 16C84 at the time. RB0-RB7 were used to provide the row anode drive, each via a 33ohm resistor. The column cathodes were driven by the output of a 74138. The 74138 received its 3 bit address from the pic and generated a low on one of its outputs. I hard-wired the chip select stuff, so only the address was required. All communication of commands and data was done using the remaining two lines. The infamous RB4 open-drain was connected to the DATA line. This line connected to the PC parallel port. The other line was the COMCLOCK line, which was controlled by the master. In my case, the master was the parallel port of my PC. Several of the pic modules were made, each handling an 8x8 matrix of LEDs. Each module was programmed to respond to its own unique ID, which in my case was a single byte from 0-255. My test unit was comprised of 4 modules arranged to form a 16x16 array of LEDs. ID codes of 1 2 3 and 4 were assigned via programming Each module stored its 8x8 bit pattern in 8 file registers. At power on these were initialized to zero. Upon receipt of a valid ID the unit would get a code-type and possibly data. In my case I always sent data in 8 bit format, since that reduced the time it took me to get a whole matrix of data loaded. Code-types allowed for single-byte and 8 byte transfers of data. ALL units would also respond to the ID 0. This allowed universal commands like CLEAR ALL, or COMPLEMENT CURRENT MATRIX DATA, or FLASH AT DATA LINE RATE and COMPLEMENT AT DATA LINE RATE. Each pic was slaved to a single 4 Mhz oscillator. Communication was done using the DATA line and the COMCLOCK line. Both of these were under total control of the master PC. ID codes, code-types, and actual matrix data were communicated using a simple synchronous clocking scheme. The COMCLOCK was normally held low. When it went high, the DATA line contained the true bit value. Everything was always transferred as 8 bit bytes. The timing between bits was kept slow enough that even the slowest of the pics could keep up with the data transfer without any glitches. Data was kept valid for the full duration of the COMCLOCK high. The pic program included an interrupt routine that occured once every millisecond. The exact timing did not have to be exact. If no COMCLOCK had occured for 16 ms, then the pic would set a flag to indicate that it was waiting for an ID, and it would also reset various flags and registers associated with the communication process. Once the COMCLOCK went high, each pic would read in the 8 bit ID. If the ID was 0 or the pic's ID, then it would reset the ID flag and set the CODE_TYPE flag. This in turn would cause the pic to recover the CODE_TYPE, and then (if needed) any data. All this would be done during the interrupt, but only a bit at a time, so the interrupt processing never took much time. When done, the ID flag would be set again. If a pic found that the ID received was not its own, then it initiated a counter that would get pre-set every time the interrupt was entered following the non-matching ID and there was a COMCLOCK high detected. Eventually the COMCLOCK would have been low for some extended time, and the pic would set the ID flag so it is looking for IDs again. This means that the master must have a certain minimum wait time before the sending of a new ID. The minimum wait time and the time required to send the data to ALL the pics for ALL the matrices gives you your minimum 100% re-write time. In my case it was about a second for a complete re-write. Note that the time to update a single LED is the same as the time to update an entire column. Note that all pics are refreshing their display matrices asynchronously and continuously, regardless of whether or not they are receiving new data. A flag called MILLISEC is set at the beginning of the interrupt routine, after the context has been saved. External routines can check for this flag being set. When it goes high, 1 ms has passed since it was last reset. As soon as it is seen to go high, I reset this flag and continue. This ensures that a given program segment begins about 1 ms after the previous one. I use this to govern the time each column is lit. In my case, 8 ms for a full matrix scan at 1/8th duty cycle per column. This is a refresh rate of 125 times per second, which is twice as fast as needed. Note that pics have a limited drive capability, and my units were not the brightest things around. But the concept proved workable. Something like a 16f877 can handle a (16x8). In that case you would use a port to handle each set of row data, and a SINGLE 1 of 8 decoder driving NPN transistors to control ALL the column cathodes in sequence. Fr. Tom McGahee ----- Original Message ----- From: rad0 To: Sent: Sunday, August 19, 2001 9:42 AM Subject: [ot]: LED Matrix : there's got to be a cheaper way? > Hello picsters! > > I want to tinker with an 8 x 5 led matrix... > > and I want to use a master to serially send out two bytes, the first being a > reference number for each matrix, followed by a second number > to turn on or off each dot in the matrix... > > > and my solution so far has been to use a 16F876 to set up one pin > to listen for a reference number, then use the next number to turn on the > dots... > > > > well, there's got to be a cheaper way to do this... with the cost of the pic > and > the dot matrix together....the entire thing gets to be quite pricey....even > the cost > of just the dot matrices sort of makes me shudder.... > > anybody have a more elegant, less costly, probably obvious except to me-- > solution? > > thanks. > > also, I was planning on making or having a little piggyback circuit board > produced > for each matrix, so that they would in effect become modules, so, well > nothing I > guess, that's just what I was thinking.... > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads