Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC to PIC communication

Status
Not open for further replies.

bonxer

New Member
I am about to start an LED grid project that will use sixteen 8x8 LED matrices (1024 LEDs total), and wish to control them with 40 pin PICs. I am basically going to have one master pic to do all of the pattern manipulations in memory, and then send that 1024 bit snapshot out to slave PICs to handle the display strobing. Speed isn't really a consideration, just as long as the patterns can be fully updated to all PICs at least once per second. A fast update on the order or micro- or milliseconds would be usable too for getting the patterns and storing them until they'r ready to display. But I don't require it to be that fast, as it wouldn't make sense for me to have an LED matrix changing patterns before you can see them. 8)

I was just wondering what would be the best method of inter-PIC communication? I was thinking of just setting up an 8-bit port on the master as an output bus, and then setting up the same 8-bit port on all of the salve PICs as input busses, and read the bits directly. With this method, I would have 4 PICs inputting the data stream on 8 pins, each controlling 4 latches through 8 other pins, and then the row-by-row LED patterns on another 8 pins. I'd still have some pins to spare.

Would it make more sense to try an I2C or serial peripheral interface method? I haven't done either, so I don't know what the benefits/tradeoffs would be. Less wires / soldering would make a 2 or 3 wire channel more attractive, while a very simple 8-bit direct read/write would make simpler coding more attractive.
 
Using a simple serial interface is by far the easiest way to do it, and it wastes very few pins. It's also probably shorter and simpler code than using a parallel connection, particularly if you use a PIC with a hardware USART.

Check my PIC tutorials for serial programming details!, both software and hardware serial are covered.
 
You might want to consider using decoders, for example 4-16, so with only 4 pins from PIC you will control 16 LEDs. this will reduce number of PICs that you will have to use and simplifies your project.

Joe,
 
joe_1 said:
You might want to consider using decoders, for example 4-16, so with only 4 pins from PIC you will control 16 LEDs. this will reduce number of PICs that you will have to use and simplifies your project.
Joe,

That wouldn't work. Being that I have 1024 LEDs to control, a certain number have to be on at the same time. The 1024 grid is comprised of sixteen 8x8 matrices. https://www.futurlec.com/LED/LEDM88RG.shtml This link goes to common cathode ones. The 16 I have are common anode, but you get the idea.

There are 8 wires to control the anodes, and 8 wires to control the red cathodes (I'm not using the green ones). To get a design displayed, you strobe them. An LED will look like it is constantly on as long as it is getting at least a 1/10 duty cycle (voltage applied for 10% of time, can be off 90% of time, and still look like it is on, since it's too fast for your eyes to register as being off). So in order to achieve that, I turn on row 1, and load a bitpattern on the 8 columns simultaneously. Then I turn off row 1, clear the bits, turn on row 2, load the new pattern, repeat. That way, cycling through all 8 rows gives all LEDs in each row a 1/8 duty cycle.

If I stuck two 8x8 grids together and tried to control them with a 4 to 16 decoder, it would take up to 16 cycles to control the LEDs in a single row. That already violates the 1/10th duty cycle limit. And there are still 7 more rows to go! :)

What I am going to do is have four of those side by side. Port E, a 3-to-8 decoder, and transistors will give voltage to the rows. One transistor will power one row. There will be 32 LEDs per row. (8 LEDs * 4 matrices). So I need to have the 32 cathodes turning on and off at the same time, while the rows are being cycled by Port E. My solution is to use a single 8 bit data bus, and control the grids through latches. Have four latches loading the data individually, then turn on all four latch enables. Then load 0's in the latches, enable them, change row with Port E, repeat. This only controls four of the matrices. I have three more rows of four. ^^ So I'm going to have perhaps three more PICs running in parallel doing this same thing. I had an idea yesterday to possibly be able to control 8 grids with one PIC. Hopefully I can work that out, so that one PIC does 8 grids, another PIC does the other 8 grids, and then a master PIC will compute all the patterns and pass the data on to the two displaying PICs. 3 PICs total instead of 5 would be nicer cost-wise, and cut down on soldering too. :)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top