Page 1 of 1
Change RS232 ports with C
Posted: Wed Nov 16, 2011 3:49 pm
by Jan Lichtenbelt
The RS232 Tx/Rx ports can be selected in Flowcode.
My question is , can the ports changed with a C-code ?
Kind regards
Jan Lichtenbelt
Re: Change RS232 ports with C
Posted: Wed Nov 16, 2011 5:34 pm
by Spanish_dude
I think Flowcode has a hardware RS232 and then a Software RS232.
INCORRECT -> If you select the software RS232 you might be able to change the pins with C code.
But if you want to change the hardware pins (if the PIC has at least two RS232 outputs) it might be difficult as you'll need to set the registers so the second RS232 of the PIC is enabled and used.
EDIT :
I just checked how Flowcode assigned a software Rx and Tx and they use defines (RS232_SW_RX or something like that) so I don't think the compiler will let you undefine and define it again in your main.
Re: Change RS232 ports with C
Posted: Fri Nov 18, 2011 6:05 pm
by Benj
Hello,
In v4 of Flowcode the RS232 component has no component connections when in hardware mode. However if you switch the coponent properties to software mode then the RX and TX component connections become available in the connections window.
Some PIC devices have RP remappable functionality which allows you to change the pins used for the hardware UART. Not many 8-bit devices have this feature built in but quite a lot of the 16-bit PICs have this.
Re: Change RS232 ports with C
Posted: Wed Jun 27, 2012 11:26 am
by bonjovi_ly
hi
I used port c for RS232 eblock but I want change it to Port D or E it possible to do it? and how?
I used PIC16F877A with Flowcode v4
Thank you
Re: Change RS232 ports with C
Posted: Wed Jun 27, 2012 12:09 pm
by Benj
Hello,
The 16F877A only has one hardware UART and this is fixed to PortC pins 6 and 7.
You may get away with using a software UART which can be connected to any pins but receiving data is much more reliable with a hardware UART. Transmitting data should work equally well using a hardware or software UART.