One Wire Bus Data Transmission

For general Flowcode discussion that does not belong in the other sections.
ChrisT66
Posts: 37
http://meble-kuchenne.info.pl
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: One Wire Bus Data Transmission

Post by ChrisT66 »

Wonderful, i will try it

Thanks for the quick help!

ChrisT66
Posts: 37
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: One Wire Bus Data Transmission

Post by ChrisT66 »

So the transmission via UART over one line works great.
Unfortunately, I have only one problem and can not find the error. The attached program is the receiving part. Before the main program I wait for packet 1 and store the next transmission as "normal value" in the variable normal1, so far it works. In the main program I permanently read the transmitted changing data and store it in the variable Pulselengths1 (and show it on the display, works too).

If I then compare the current value with the standard value (normal1), the red LED flashes but the transmission stops??? If I deactivate the query, the values are continuously updated. Where is the error here?
Many thanks if someone can help here!

Best regards Chris
Attachments
Onewiredata.fcfx
(22.29 KiB) Downloaded 45 times

chipfryer27
Valued Contributor
Posts: 1148
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: One Wire Bus Data Transmission

Post by chipfryer27 »

Hi

Not sure if I am seeing the bigger picture in what you are trying to achieve. From the chart it looks like you will constantly loop checking the Rx port to see if the Rx value equals "1" and if so you will then attempt to read a 16-bit value and assign it to the variable "Normal1".

You then display this number and wait 300ms before entering an endless loop.

In this loop you read the Rx and assign it to the variable "Paket".

If Paket = 1 you branch and attempt to receive a 16-bit value and assign it to PulseLength and display it.

You then make a decision. If PulseLength is greater than Normal1 you will branch and flash an LED for 1-sec On/Off before repeating your endless loop.

You have many delays in the chart. What happens if you start receiving data on the Rx port whilst you are "waiting" elsewhere or are busy updating the display?

I think you may be better using the Rx Interrupt feature. In the event of data arriving at the Rx port, your chart will immediately branch to process.

Hope this helps.

Regards

ChrisT66
Posts: 37
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: One Wire Bus Data Transmission

Post by ChrisT66 »

Yes that's right, by waiting in the blink loop I miss incoming data. It's just strange that not even a new data packet comes through. The communication is completely frozen...
But good idea! I'll leave the red LED off and see if it works. I'll get back to you :)

chipfryer27
Valued Contributor
Posts: 1148
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 285 times
Been thanked: 412 times

Re: One Wire Bus Data Transmission

Post by chipfryer27 »

Hi

It's probably not that it is not coming through, just you are busy elsewhere when it does.

If you use the Rx Interrupt, as data comes in you will immediately branch to receive. Perhaps consider storing the Rx data in a circular buffer, and then process in your Main?

Regards

ChrisT66
Posts: 37
Joined: Mon Dec 07, 2020 12:47 pm
Been thanked: 1 time

Re: One Wire Bus Data Transmission

Post by ChrisT66 »

The RX Interupt worked out great. Many thanks for the support!
Best regards Chris

Post Reply