Page 2 of 2

Re: RS232 Wireless help!

Posted: Fri Apr 19, 2024 9:37 pm
by chipfryer27
Hi Jorgen

Sorry to brief I will try and respond more later.

You loop checking for incoming data on the Rx, but this approach is prone to missing activity if the data arrives whilst you are busy elsewhere.

My suggestion would be to include a Circular Buffer and an interrupt set for RxInt to capture any incoming transmission and in the ISR simply put the incoming values in the Circular Buffer

ISR would contain (for example):-
ISR.JPG
ISR.JPG (17.43 KiB) Viewed 955 times

This way you will never miss any incoming data and in your Main loop you can search for your keyword within the buffer.

Not sure using Compare$ is the best option. Depending on your transmission medium there may be "control characters" such as CR / LF being sent and if so they may be captured in your string. If they are then your string won't just contain "Open". This may or may not be a concern though.

Regards

Re: RS232 Wireless help!

Posted: Fri Apr 19, 2024 10:44 pm
by daddytims_tims
Hi Jorgen

Here's an Example, that's works. Related to what chipfryer is saying above.

I recently created it with an Esp32.


Regards
Ryan

Re: RS232 Wireless help!

Posted: Sat Apr 20, 2024 9:45 am
by jgu1
Hi Ryan and Chipfreyer!

Thank you for your help and examble. I certenly will perform a test.

I have just made a test with my own program, and yes, working first time :D connected directly tx out to rx in. Next step via HC12 wireless.

I have add the programs, if anybody can use them, hereby :lol:

I have no expeience with Cirkular buffer, maybe a good idea to play with this. ;)

Again thankĀ“s to all.

Jorgen