Receive RS232 string
Moderator: Benj
Receive RS232 string
Good morning !!
I'd like to receive a string from RS232, but I don't understand what kind of parameters I've to put in the RS232 routine
Example,
If I receive the string "COMPTEUR" from RS232, i send the value of a variable by RS232
Thanks you for your help
I'd like to receive a string from RS232, but I don't understand what kind of parameters I've to put in the RS232 routine
Example,
If I receive the string "COMPTEUR" from RS232, i send the value of a variable by RS232
Thanks you for your help
Regards,
Adrien DG
Adrien DG
- Steve
- Matrix Staff
- Posts: 3434
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
Re: Receive RS232 string
You should use the "ReceiveRS232String" macro of the RS232 component. There should be some examples of this in the collection of Flowcode examples on the Flowcode CD.
Re: Receive RS232 string
Hello,
I come back to you for my problem of RS232 receive string
I receive a string for example : " TEST "
If the string I receive is "TEST", I send a value, for example 10000
else I send an ERROR message.
I've used the compare() fonction in string manipulation block, but that don't runs...
Could you explain me how can I do it ?
Thant you !!!
Bye
I come back to you for my problem of RS232 receive string
I receive a string for example : " TEST "
If the string I receive is "TEST", I send a value, for example 10000
else I send an ERROR message.
I've used the compare() fonction in string manipulation block, but that don't runs...
Could you explain me how can I do it ?
Thant you !!!
Bye
Regards,
Adrien DG
Adrien DG
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Receive RS232 string
Hello Adrien,
The string manipulation compare function returns a 0 when the strings match. Could this be the problem. I assure you it does work
The string manipulation compare function returns a 0 when the strings match. Could this be the problem. I assure you it does work
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Receive RS232 string
Hello BenJ,
Yes I've seen a French Manual about flowcode, and I saw in it the use of this function
Look at my example,
If I send a "A", and I compare with a "A", I always receive a False
For sure I don't have understood one thing.
Yes I've seen a French Manual about flowcode, and I saw in it the use of this function
Look at my example,
If I send a "A", and I compare with a "A", I always receive a False
For sure I don't have understood one thing.
- Attachments
-
- TEST RS232 - TEST RECEPTION.fcf
- (7.5 KiB) Downloaded 317 times
Regards,
Adrien DG
Adrien DG
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Receive RS232 string
Hello,
It might be worth collecting the length of the string and the contents of the string and echoing these values back also with the RS232 on a Error. This will show you what the microcontroller is seeing as received.
Other then this you can also check single characters from the string one by one using decision icons.
EG
RECEPTION[0] = 'A'
It might be worth collecting the length of the string and the contents of the string and echoing these values back also with the RS232 on a Error. This will show you what the microcontroller is seeing as received.
Other then this you can also check single characters from the string one by one using decision icons.
EG
RECEPTION[0] = 'A'
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: Receive RS232 string
Hello BenJ,
thank you, that runs very well,
but now, I've another question ...
How can I program an Interrupt on the Rx pin ? Using the RXINT ??
Thank you in advance
thank you, that runs very well,
but now, I've another question ...
How can I program an Interrupt on the Rx pin ? Using the RXINT ??
Thank you in advance
Regards,
Adrien DG
Adrien DG
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Receive RS232 string
Hello,
Attached is an interrupt example of your earlier program.
You just need to ensure you use the dummy read component macro to enable the UART receive functionality before the interrupt will start working.
Attached is an interrupt example of your earlier program.
You just need to ensure you use the dummy read component macro to enable the UART receive functionality before the interrupt will start working.
- Attachments
-
- TEST RS232 - TEST RECEPTION.fcf
- (8 KiB) Downloaded 439 times
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
jgu1
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: Receive RS232 string
Hi!
I have follow this line. I have a question, What is the "11,11" in the Component Macro under variable?
Thank´s
Regard Jørgen
I have follow this line. I have a question, What is the "11,11" in the Component Macro under variable?
Thank´s
Regard Jørgen
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Receive RS232 string
Hello Jorgen.
The 11, 11 are values that are passed to the component macro call as parameters.
Looking at the help file for the component will explain the parameters meaning and role in the function.
The first is the number of iterations to wait before returning a no data received value. This is not needed as we are using the interrupt so you could change this to 1 if you like.
The second is the number of bytes to try and receive into the string variable before a timeout occurs.
The 11, 11 are values that are passed to the component macro call as parameters.
Looking at the help file for the component will explain the parameters meaning and role in the function.
The first is the number of iterations to wait before returning a no data received value. This is not needed as we are using the interrupt so you could change this to 1 if you like.
The second is the number of bytes to try and receive into the string variable before a timeout occurs.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel