Page 1 of 2

RS232 Wireless help!

Posted: Wed Apr 17, 2024 8:01 pm
by jgu1
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 :D

Thank´s in advance

Jorgen

Re: RS232 Wireless help!

Posted: Wed Apr 17, 2024 8:05 pm
by chipfryer27
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

Re: RS232 Wireless help!

Posted: Wed Apr 17, 2024 8:11 pm
by chipfryer27
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

Re: RS232 Wireless help!

Posted: Wed Apr 17, 2024 8:21 pm
by jgu1
Thank you Chipfreyer, I will look ;)

jorgen

Re: RS232 Wireless help!

Posted: Thu Apr 18, 2024 12:49 am
by viktor_au
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.

Re: RS232 Wireless help!

Posted: Thu Apr 18, 2024 10:28 am
by medelec35
jgu1 wrote:
Wed Apr 17, 2024 8:01 pm
Hi!
I remember have seen somewhere that it is possible to compare a string via rs232, but where? I
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.

Re: RS232 Wireless help!

Posted: Thu Apr 18, 2024 1:00 pm
by jgu1
Hi all!

Thank´s to all. Now I have lot of example to look at. :lol:

And thank you Victor, I am familiar with the HC12, very good device, I can recommend. ;)

Gratefull!

Jorgen

Re: RS232 Wireless help!

Posted: Thu Apr 18, 2024 2:00 pm
by medelec35
Hi Jorgen.
Just in case you want to compare two string values:
Compare Strings1.png
Compare Strings1.png (22.61 KiB) Viewed 963 times
Which is:

Code: Select all

Compare$("String1","String2",0) = 0
You can either use literal string values within quotes e.g. "1234ABC" or string variables or a combination of both.
See this Wiki page.

Re: RS232 Wireless help!

Posted: Fri Apr 19, 2024 2:32 pm
by jgu1
Hi Martin

Thank`s

Exactly what I was looking for, and have seen :D

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 :lol:


Jorgen

Re: RS232 Wireless help!

Posted: Fri Apr 19, 2024 5:41 pm
by jgu1
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