View previous topic :: View next topic |
Author |
Message |
JohnLeung
Joined: 18 May 2004 Posts: 15
|
How to use MAX7219 at 100 ft from the 16F877? |
Posted: Tue May 18, 2004 11:21 am |
|
|
I am using a MAX7219 LED driver for 3 7-segment LED display.
A distance is required from the controller 16F877 to the LED display. It is a 4" 7-segment.
Since MAX7219 uses SPI, its distance to the CPU should be on the same PCB. In my case, how should I extend the SPI distance? Is it a "proper way" of handling the problem?
Any suggestion would be helpful.
John Leung
|
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Tue May 18, 2004 12:12 pm |
|
|
I assume because you posted that you are having noise problems. Try placing a pull up or pull down resistor on each pin used. With this resistance in the circuit static noise will be disapated. |
|
|
AK
Joined: 20 Apr 2004 Posts: 33
|
|
Posted: Tue May 18, 2004 2:22 pm |
|
|
Have you twisted the wires together? |
|
|
pat
Joined: 07 Sep 2003 Posts: 40 Location: Adelaide, Australia
|
|
Posted: Tue May 18, 2004 4:08 pm |
|
|
Even though its synchronous serial, you could still use a RS232 or RS422 line driver at each end. |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
|
Posted: Tue May 18, 2004 5:40 pm |
|
|
It's best not to connect long lines directly to the pic, particularly in noisy environments.
As suggested already, I would use RS422 for each line (a twisted pair for each signal). Also a 100 ohm terminating resistor at the display end for each twisted pair. DS26C31 and DS26C32 are quad drivers and receivers used widely for this purpose. I use them to extend the distance from shaft encoders and also for other applications.
Another thing that could be done is slow down the spi clock speed - the display doesn't need the high data rate.
It can be slowed right down using timer 2 overflows (it's half the overflow rate).
setup_spi(SPI_MASTER|SPI_L_TO_H|SPI_CLK_T2);
I did this recently for a chip that had a very low spi clock speed.
HTH |
|
|
JohnLeung
Joined: 18 May 2004 Posts: 15
|
MAX7219 at 100ft from the MCU |
Posted: Wed May 19, 2004 11:00 am |
|
|
Hi all
I posted the question because I dare not connect the signal of SPI, e.g. CLK, MOSI, CS, of the MAX7219 to a 16F877 at 100ft away, as I believe the signal will be highly distorted.
To control the MAX7219, one of the method I can think of is to use another mcu, like 16F84 (or 16F628), to bit-bang the SPI, and connect the 16F84 with the 16F877 being the control console via USART. But this will complicate the code.
Most examples on MAX7219 assume you are using it on the same PCB of the mcu. However, to display in some sort of 4"-10" LED 7-segment, we do need a distance from the controlling keypad. Otherwise, we wouldn't need 10" 7-segment!
So, I would like to further my question, to use DS26C31, do we simply convert the CLK, MOSI, and CS to a balanced lines in twisted pair? Any schematics would be nice.
Thanks in advance. |
|
|
Cyril Guest
|
|
Posted: Wed May 19, 2004 11:22 am |
|
|
I would go with the additional microcontroller using RS232 level signals. This COULD be a simpler total system when cabling is considered. Would also be simple to debug. |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Wed May 19, 2004 12:31 pm |
|
|
I would expect to have no problems at all if the signal lines are terminated and the speed is down at around 10Kbps. For example RS485 uses 5 volts and can go for as far as a mile if the baud is low enough and it's all wired right. In comparison 100ft is not far at all. |
|
|
Kenny
Joined: 07 Sep 2003 Posts: 173 Location: Australia
|
Re: MAX7219 at 100ft from the MCU |
Posted: Wed May 19, 2004 5:24 pm |
|
|
JohnLeung wrote: |
So, I would like to further my question, to use DS26C31, do we simply convert the CLK, MOSI, and CS to a balanced lines in twisted pair? Any schematics would be nice.
. |
Yes, it's that straightforward. Have a look at the Typical Application in
http://www.national.com/ds/DS/DS26C31M.pdf
Balanced differential methods like RS422 and RS485 are really effective.
I have used RS422 at around 1000ft (300m) at about 10kbps on a construction site without any problems. |
|
|
jay331 Guest
|
|
Posted: Mon Jun 18, 2007 9:05 pm |
|
|
I want to run a max7219 7 feet away from the PIC, and I was looking at the 26LS31, but since I dont know very much, how would I connect it the driver and receiver? and I assume its transparent so I wouldnt need to change any code? |
|
|
|