PIC to PIC bit bang communication

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

PIC to PIC bit bang communication

Post by Ondra »

Good day all. I have a project where on my board I have to PIC 18F2680 running at 20Mhz and 12F683 running a 8Mhz.
Using the example posted on the learning center I am trying to bit bang RS232 between the 2 devices. I have done this before using 18F2680 running at 20Mhz and 16F690 running at 19.6Mhz with great success. I tried to communicate at 2400bps then 300 bps. The values I am sending are 0x01 to 03. I'm only communicating in one direction, 18F2680 to 12F683. Based on some test I have done using an LED, and an If block with "if dataRX is less then 255" I know that data is being receive. But response to "if dataRX is 0x01" produces no results. Is there something in particular that I might be missing when trying to link these 2 devices together. Note I am using the same bit time for both.

Ondra

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC to PIC bit bang communication

Post by Benj »

Hello Ondra

If you are using the internal oscillator on the 12F683 then this may be slightly off which is causing the communication to receive eg a 3 or a 0 instead of the sent 1.

I would play around with the bit delays on one of the devices (probably the 12F683) until you reach a value that receives the data correctly.

You must also ensure that the software receive is allowed to run as often as possible to make sure that the start bit is not missed. Eg if your baud rate is 4800bps then you will need to check the bus at least every 208us (1 / 4800).

Lowering the baud rate eg increasing the bit delays should help to make the comms more reliable between the two devices.

Ondra
Posts: 325
Joined: Wed Aug 29, 2007 7:33 pm
Been thanked: 2 times
Contact:

Re: PIC to PIC bit bang communication

Post by Ondra »

I'll give it a try.
Thanks

Post Reply