RS485 communication test

For general Flowcode discussion that does not belong in the other sections.
Post Reply
walbeek
Posts: 28
http://meble-kuchenne.info.pl
Joined: Thu Dec 17, 2020 3:25 pm
Location: Netherlands
Been thanked: 2 times

RS485 communication test

Post by walbeek »

Hi there,

I have made two FC10 programs.
The first one has 32 inputs and when a input is high, data is send to UART.

The second one has 32 outputs and checks the UART continiously.
When data is received the outputs should change.

When I run both programs one One PC, I would like to test the communication.
The transmitter seems to send data and I have included a VNET injector.

The receiver doesn't react at all.
I have tested all kind of settings in the injectors parameters, however no result.
Can anyone show me how the settings have to be changed?

Both FC10 programs are included.
Attachments
RS485 TX.fcfx
(34.65 KiB) Downloaded 11 times
RS485 RX.fcfx
(24.15 KiB) Downloaded 12 times
Best regards,

Rinie

walbeek
Posts: 28
Joined: Thu Dec 17, 2020 3:25 pm
Location: Netherlands
Been thanked: 2 times

Re: RS485 communication test

Post by walbeek »

Update!

I found a Modbus Master and Slave example on the Matrix site.
After copying the settings of the VNET injectors, there seems to be communication.
However, the tests doesn't run as expected for now, the data seems corrupted.

When the TX has data to send, I first send 0xAA (170 or 10101010) as start address
Than the four data-bytes and at the end 0X55 (85 or 01010101) as stop address.
When I check re variable RECEIVE[0] for 0xAA, the leds stay off.
When I move "writing the data" above the decision for this, lots of the leds turn on.
So I need to do some more checking on this incoming data.

Does anybody have suggestions on how to improve the reliability on this?
For now it looks like random leds turn on.

Thanks for your help already.

Rinie
Attachments
RS485 TX V02.fcfx
(35.08 KiB) Downloaded 12 times
RS485 RX V02 without check for AA.fcfx
(24.86 KiB) Downloaded 12 times
RS485 RX V02 with test.fcfx
(24.91 KiB) Downloaded 7 times
Best regards,

Rinie

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

Re: RS485 communication test

Post by medelec35 »

Hello.
It looks like you are send an eight bit address and receiving a seven bit address.
You can try RECEIVE[0] = RECEIVE[0] <<1 to shift back to an 8 bit address.
If this is not the issue, then I will look into this further.
Martin

walbeek
Posts: 28
Joined: Thu Dec 17, 2020 3:25 pm
Location: Netherlands
Been thanked: 2 times

Re: RS485 communication test

Post by walbeek »

Hello Martin,

Thanks for your reply.
I have tried the bit-shift on several places in the code but I can't find any changes so far.
I have also tried to change the RX and TX lines, and the direction HI or LOW on C5.
Also no changes as far as I can see, but in simulation, I didn't expect them to have use anyway.
I'm stuck for now...

Rinie
Best regards,

Rinie

Post Reply