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.

Best way to send data from PIC to PIC using wires

Status
Not open for further replies.

Futterama

Member
Hello,

I'm working on a project where I need to send 1Mbit of data from one PIC to another from one PCB to another PCB with a wire connection between them. I need the transfer to be fairly quickly (10sec). The data is read from a SPI Bus Serial EEPROM (24AA1024) and sent to the other PIC for transferring the data through USB to a PC.

The environment is noisy I guess (sending PIC is a few inches from a gasoline engine).

The wire between the PICs is one feet long, but I guess it could be shorter if needed.

So which type of transfer would you recommend? SPI, I2C, RS-232 with/without the drivers, microwire ect?

The receiving PIC is a PIC18F2550 so I would like if I could use some of its built-in communication hardware and then just select the transmitting PIC from my communications choice.

Thanks.

Regards,
Futterama
 
Last edited:
Futterama said:
I'm working on a project where I need to send 1Mbit of data from one PIC to another from one PCB to another PCB with a wire connection between them. I need the transfer to be fairly quickly (10sec). The data is read from a SPI Bus Serial EEPROM (24AA1024) and sent to the other PIC for transferring the data through USB to a PC.
This implies a data rate of approx. 100Kbps, which is easy to do.
The environment is noisy I guess (sending PIC is a few inches from a gasoline engine). The wire between the PICs is one feet long, but I guess it could be shorter if needed.
For noisy environments it's hard to beat differential transmission, so I'd suggest RS-422 drivers on the async serial port as the best option. Differential transmission cancels out interference provided it is run over twisted pair cable (such as cheap CAT5/6 network cable) and is good for 100's of metres.
The receiving PIC is a PIC18F2550 so I would like if I could use some of its built-in communication hardware and then just select the transmitting PIC from my communications choice.
I'd use the hardware async. port with interrupt-driven communications. What type of PIC is doing the transmitting? What else is it doing aside from comms?

Regards,
Paul
 
Other obvious question, where are you getting one Mbit of data? - but serial is all you need, SPI and I2C etc. have added overhead, for purposes you don't require.
 
The transmitting PIC is reading the data from the EEPROM when sending. While sending, it does not do anything else. When not sending, its logging data to the EEPROM. The sending PIC has not been chosen yet, but it will be one with an UART - like PIC16F688.

I suppose RS-422 is like RS-232 in the PIC itself, but with different electrical characteristics.
 
I think the MAX3085E will do as a RS-422 driver for my project:

**broken link removed**

Oh, and the PIC16F688 does not work at a sending device since I need hardware SPI to read from the EEPROM, I guess PIC16F88 will be a better choice.
 
Last edited:
Futterama said:
I suppose RS-422 is like RS-232 in the PIC itself, but with different electrical characteristics.
Yep!
I think the MAX3085E will do as a RS-422 driver for my project
Yes it will... though you may find it easier to just use the full-duplex MAX3084E depending on how you want each PIC to negotiate the switch in transmission direction. For 2 extra wires, which would be in a piece of CAT5 cable anyway, I'd go with more full duplex but that's just me :)
Oh, and the PIC16F688 does not work at a sending device since I need hardware SPI to read from the EEPROM, I guess PIC16F88 will be a better choice.
SPI can be done in software trivially easily.

I'd also suggest using the same 18F2550 on either end of the link too. I use the 2550 in my designs because it's very reasonably priced, I can download new firmware quickly from the PC via USB using the bootloader, and I can also the USB interface to send debugging messages while my code is running!

I've found the design, code, compile, test cycle to be much shorter when I can easily get debug information out of the embedded system. The 2550's USB interface is fantastic for this.

YMMV,
P.
 
I chose the half-duplex simply because of the low wire count. I guess I can use simple soft wire, twisted around each other (unshielded) when the distance is short (1 feet) or do I have to use some CAT5? I don't have enough room for a RJ45 connector...

SPI is faster and easier in hardware, so choosing another PIC for the job is not a problem ;-)
But I still want to keep the pincount (and physical size) down.


I would like to thank you both for helping me out, thanks :)

Regards,
Futterama
 
aussiepoof said:
I've found the design, code, compile, test cycle to be much shorter when I can easily get debug information out of the embedded system. The 2550's USB interface is fantastic for this.

YMMV,
P.

Or you could use a ICD.

PS what bootloader do you use? Free or commercial?
 
Hi again,

I got my hands on 2 MAX3085-DIP devices and tested them.

I'm not sure I have connected everything right.

The GND levels for both devices are the same, is this a problem?

I can't find any specific information on the Rt termination resistor - what resistor value should I use?

Will short not-twisted wires cause transmission problems? I tried it out, but everything except the first 4 characters fail (not correct received data) at 9600bps.

EDIT: I got it working fine now, I forgot to disable the unused input/output. I used 100ohm termination resistors as the only value I could find in the datasheet was 54ohm (taken from the Switching Characteristics).

I guess I'll need 54ohm resistors for best performance - can anyone confirm this?
 
Last edited:
If you're getting 4 good characters then the wiring is working and your code is the likely suspect, especially if you're using interrupts.

P.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top