Page 1 of 1

UART and MODBUS 232 material

Posted: Thu Feb 09, 2023 10:48 pm
by flowcode-developer
Hello,
I am new here. I recently got Flowcode V10, professional license, and AVR chip pack. I was wondering where I can get info for UART and MODBUS 232. For now, I want to do something simple like sending a message from ATMEGA2560 to Docklight. I want them to communicate with each other. Wondering if you all have some resources that I can check out to get started? Thank you

Re: UART and MODBUS 232 material

Posted: Thu Feb 09, 2023 10:58 pm
by BenR
Hello and welcome

Some examples can be found on our help wiki
https://www.flowcode.co.uk/wiki/index.p ... s:_System)

If you need something specific to get you started then let us know and we can maybe put something together for you.

Re: UART and MODBUS 232 material

Posted: Thu Feb 09, 2023 11:03 pm
by medelec35
Hello.
Have you tried the wiki?
For example here for the modbus and here for the uart?

Edit Ben has beat me to it so apologies for any duplicated information.

Re: UART and MODBUS 232 material

Posted: Thu Feb 09, 2023 11:11 pm
by flowcode-developer
BenR wrote:
Thu Feb 09, 2023 10:58 pm
Hello and welcome

Some examples can be found on our help wiki
https://www.flowcode.co.uk/wiki/index.p ... s:_System)

If you need something specific to get you started then let us know and we can maybe put something together for you.
I did see it. I like it but for me it is a bit overwhelming. I was looking for resources that breakdown as to how and why you would use the flow pieces in the case.

Re: UART and MODBUS 232 material

Posted: Mon Feb 13, 2023 8:10 pm
by flowcode-developer
Hi so I tried out this code but something is not right. When I go to debug it shows that the UART is receiving but the COM is not sending. For the COM simulation I am using Docklight program. I have the settings correct BAUD 9600, no parity, 8 data bits, 1 stop bit. I think I am doing something wrong with my code? I would appreciate your help. I attached my code.

Re: UART and MODBUS 232 material

Posted: Mon Feb 13, 2023 8:34 pm
by mnfisher
Hi,

There are several problems with your code: It is very difficult to 'catch' RS23s UART comms using ReceiveString (set timeout to 255) - it is much better to use an receive interrupt. Also the requested number of characters is undefined (in) - and 'in' is not altered by the call to ReceiveString. You'll need to save the returned string somewhere too.

A simple example - sorry for a different MCU, but it should need much changing apart from the target. I also just 'echo' the string back to the sender (PuTTY on my PC). One 'quirk' with FC is that Channel1 UART uses the Rx0 interrupt :roll: :-
rs232.fcfx
(14.08 KiB) Downloaded 336 times

Martin