RS232 - RX - Processing incoming string

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
IAB48
Posts: 13
Joined: Wed Feb 18, 2009 3:24 am

RS232 - RX - Processing incoming string

Post by IAB48 »

Hi
I want to perform a component macro in Ver 4 when a certain string in this case "Stopped" is received on the RX receive pin of an 18F458 PIC.

EG
I am sending commands to a vmusic2 module. When the MP3 file(s) in a directory finish playing the vmusic2 responds with "stopped". When this string is received I then want to transmit some specific strings to replay the files in a directory.
so the sequence would go like this (in summary)
start mp3 file(s) playing
wait for stopped response
start mp3 file(s) playing
wait for stopped reponse
move on to another step in the programme - in this case change directory on Vmusic2 storage device and start playing other mp3 files.
I've had a look through the forums but either have missed a reponse with a similar requirement or otherwise not understood that it met my query.
General direction sort of thing would do and I'd experiment further myself
Cheers
Ian :?:

User avatar
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: RS232 - RX - Processing incoming string

Post by Benj »

Hello Ian,

I would poll the RS232 receive character function until you receive a character 's'. Once you have received the S you can then test to ensure you have the other letters. If you have received all of the letters in order then you know that the stopping command has been received. Doing things this way you would have to ensure that the timeout is longer then the maximum delay between received characters. A timeout of say 100 should be plenty to ensure this.

Eg.

in = RS232 Receive Char

if in = 's'

yes:

in = RS232 Receive Char

if in = 't'

yes:

in = RS232 Receive Char

etc......

Post Reply