Hi!
I am starting a project, wireless with the HC12 transceiver for a remotecontrol. I want to transmit (examble) string "help" and when the receiver receive this in the receiver I want to "do something" turn an output on.
I remember have seen somewhere that it is possible to compare a string via rs232, but where? I don´t remember where I have seen this a good examble.
I have seach in WIKI and in forum. Any help, please, I will be happy
Thank´s in advance
Jorgen
RS232 Wireless help!
-
- Posts: 681
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 569 times
- Been thanked: 146 times
-
- Valued Contributor
- Posts: 1281
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 312 times
- Been thanked: 452 times
Re: RS232 Wireless help!
Hi Jorgen
Need to check up on HC12, but assuming you have it working you could setup an interrupt (RxINT) to capture the received information and store in a Circular Buffer.
Once in the buffer it's very easy to either search for the required info (parse) or "LookFor / WaitFor" the required info.
I've posted a couple of examples in the past. I'll look them out in the hope it helps.
Regards
Need to check up on HC12, but assuming you have it working you could setup an interrupt (RxINT) to capture the received information and store in a Circular Buffer.
Once in the buffer it's very easy to either search for the required info (parse) or "LookFor / WaitFor" the required info.
I've posted a couple of examples in the past. I'll look them out in the hope it helps.
Regards
-
- Valued Contributor
- Posts: 1281
- Joined: Thu Dec 03, 2020 10:57 am
- Has thanked: 312 times
- Been thanked: 452 times
Re: RS232 Wireless help!
Hi
In this post I used BT modules but as they use the UART too, the principals are the same. If the CB receives the required string then a LED toggles.
https://www.matrixtsl.com/mmforums/view ... 17#p107317
Hope this helps.
Regards
In this post I used BT modules but as they use the UART too, the principals are the same. If the CB receives the required string then a LED toggles.
https://www.matrixtsl.com/mmforums/view ... 17#p107317
Hope this helps.
Regards
Re: RS232 Wireless help!
Hello Jorgen
Note: it is important to change the settings of the remote transceiver first and then change the settings of the local transceiver to match, as any initial changes to the local transceiver will interrupt communication between the two.
Note: it is important to change the settings of the remote transceiver first and then change the settings of the local transceiver to match, as any initial changes to the local transceiver will interrupt communication between the two.
- Attachments
-
- HC-12_english_datasheets.pdf
- (528.39 KiB) Downloaded 139 times
Last edited by viktor_au on Sun Apr 21, 2024 11:40 pm, edited 1 time in total.
-
- Matrix Staff
- Posts: 1560
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 555 times
- Been thanked: 514 times
Re: RS232 Wireless help!
In Flowcode, if you select Component Libraries > Storage
Then right click on Circular Buffer (8-bit) [2D] &n select help.
It will take you to a wiki page with the examples will help you in two ways.
1. use the circular buffer for reliable communications as already been mentioned.
2. Show you how to compare the incoming data with a sting value and act on it accordingly .
To do all that, I would recommend looking at UART to USB Serial Data Bridge example for using CB for incoming UART data and Keypad Door Entry for comparing the incoming UART data to a string value.
After seeing how both examples work, and creating your own Flowcode project, if you get stuck we can help you further.
Martin
-
- Posts: 681
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 569 times
- Been thanked: 146 times
Re: RS232 Wireless help!
Hi all!
Thank´s to all. Now I have lot of example to look at.
And thank you Victor, I am familiar with the HC12, very good device, I can recommend.
Gratefull!
Jorgen
Thank´s to all. Now I have lot of example to look at.
And thank you Victor, I am familiar with the HC12, very good device, I can recommend.
Gratefull!
Jorgen
-
- Matrix Staff
- Posts: 1560
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 555 times
- Been thanked: 514 times
Re: RS232 Wireless help!
Hi Jorgen.
Just in case you want to compare two string values: Which is:
You can either use literal string values within quotes e.g. "1234ABC" or string variables or a combination of both.
See this Wiki page.
Just in case you want to compare two string values: Which is:
Code: Select all
Compare$("String1","String2",0) = 0
See this Wiki page.
Martin
-
- Posts: 681
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 569 times
- Been thanked: 146 times
Re: RS232 Wireless help!
Hi Martin
Thank`s
Exactly what I was looking for, and have seen
So I can transmit a string and receive this string, then compare the string, if the received string is equal with the string in the compare, Then do something, set an output, I suppose
But please what does String2",0) = 0 mean, the ,0)=0 if correct string? Edit. Just seen it on wiki
Jorgen
Thank`s
Exactly what I was looking for, and have seen
So I can transmit a string and receive this string, then compare the string, if the received string is equal with the string in the compare, Then do something, set an output, I suppose
But please what does String2",0) = 0 mean, the ,0)=0 if correct string? Edit. Just seen it on wiki
Jorgen
-
- Posts: 681
- Joined: Thu Dec 03, 2020 8:25 pm
- Location: Denmark
- Has thanked: 569 times
- Been thanked: 146 times
Re: RS232 Wireless help!
Hi all again!
I have now made my receiver. Hope any will please check my program and see if this will working, please
Everytime the receiver recieve the string "open" I want to set the B0 on, after 500mS off again.
Any correction is very welcome
jorgen
I have now made my receiver. Hope any will please check my program and see if this will working, please
Everytime the receiver recieve the string "open" I want to set the B0 on, after 500mS off again.
Any correction is very welcome
jorgen
- Attachments
-
- RX_Port.fcfx
- (11.19 KiB) Downloaded 164 times