UART and MODBUS 232 material

For general Flowcode discussion that does not belong in the other sections.
Post Reply
flowcode-developer
Posts: 37
http://meble-kuchenne.info.pl
Joined: Thu Feb 02, 2023 9:32 pm
Has thanked: 19 times
Been thanked: 3 times

UART and MODBUS 232 material

Post 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

BenR
Matrix Staff
Posts: 1952
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 510 times
Been thanked: 698 times

Re: UART and MODBUS 232 material

Post 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.

medelec35
Matrix Staff
Posts: 2088
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 645 times
Been thanked: 703 times

Re: UART and MODBUS 232 material

Post 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.
Martin

flowcode-developer
Posts: 37
Joined: Thu Feb 02, 2023 9:32 pm
Has thanked: 19 times
Been thanked: 3 times

Re: UART and MODBUS 232 material

Post 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.

flowcode-developer
Posts: 37
Joined: Thu Feb 02, 2023 9:32 pm
Has thanked: 19 times
Been thanked: 3 times

Re: UART and MODBUS 232 material

Post 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.
Attachments
COM_send.fcfx
(13.93 KiB) Downloaded 235 times

mnfisher
Valued Contributor
Posts: 1635
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 142 times
Been thanked: 761 times

Re: UART and MODBUS 232 material

Post 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

Post Reply