RS232 application

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

Moderators: Benj, Mods

Post Reply
jadiflow
Flowcode v5 User
Posts: 273
Joined: Thu Apr 17, 2008 9:59 am
Has thanked: 19 times
Been thanked: 16 times

RS232 application

Post by jadiflow »

Hi,

Not entirely Flowcode, but there's so much intellect gathered here so here goes:

I have an application to interface a PIC through its UART to a component that has a bi-directional data i/o line. So, if I want to send data to the device I need to set a pin to make its data line an input; if I want to read from the device I need to clear that pin to make the data line an output. The device does implement RS232 protocol complete with internal baud rate generator.

So, I was planning to use a small ic switch to switch either the PIC TX or RX line to the bi-directional data line and toggle the switch with the same signal that toggles the data line between input and output. In flowcode I then have to bit-bang that switch control line before each serial send or serial receive macro call.

Would this work you think? Or would that interfere with the asynchronous send/receive which is not under program control?

Thanks,

Jan Didden

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Re: RS232 application

Post by Steve »

I think it would work, but you will need to ensure that there is a layer of flow control on the communication protocol so you can guarantee that the bi-directional line is configured in the correct direction at the right time. Although this may not be absolutely necessary cecause the protocol may impose certain limitations such as the PIC must always initiate communication and the device will send a specific amount of data only when asked.

I think I've seen implementations of SPI where the input and output pins are connected together (using a suitable resistor) and then the single line can be used in a bidirectional way. Perhaps you could do the same with the UART pins, meaning you would not need a separate IC switch.

Post Reply