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):-
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
RS232 Wireless help!
-
- Valued Contributor
- Posts: 1320
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 321 times
- Been thanked: 462 times
-
- Posts: 59
- Joined: Thu Jun 16, 2022 6:16 pm
- Has thanked: 58 times
- Been thanked: 7 times
Re: RS232 Wireless help!
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
Here's an Example, that's works. Related to what chipfryer is saying above.
I recently created it with an Esp32.
Regards
Ryan
- Attachments
-
- Esp32_hc05.fcfx
- (15.12 KiB) Downloaded 173 times
-
- Posts: 708
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 593 times
- Been thanked: 157 times
Re: RS232 Wireless help!
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 connected directly tx out to rx in. Next step via HC12 wireless.
I have add the programs, if anybody can use them, hereby
I have no expeience with Cirkular buffer, maybe a good idea to play with this.
Again thank´s to all.
Jorgen
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 connected directly tx out to rx in. Next step via HC12 wireless.
I have add the programs, if anybody can use them, hereby
I have no expeience with Cirkular buffer, maybe a good idea to play with this.
Again thank´s to all.
Jorgen
- Attachments
-
- RX_PortOscon.fcfx
- (12.13 KiB) Downloaded 199 times
-
- Tx_PortOscon.fcfx
- (12.49 KiB) Downloaded 136 times