Rs232 and automata

i’m using “tlv” (type/length/value) messages for serial communication, e.g. 03 04 17 11, where 03 is the type, ie the property i want to adjust, let’s say no. of points in a grid, 04 the length of the whole message (including type + length), 17 and 11 are my values, in the example no. of points in x and in y direction.
i’ve used the automata node to implement something like a state machine to make sure that only correct tlv’s hit my patch - to do this i use a start and a stop value (0 and 1) - as long as no 0 is received nothing happens, on 0 it starts “listening” but only when the message is ended with a 1 (after the correct number of values) it will be output. so the correct message would be 00 03 04 17 11 01

phew, now to my problem, i still don’t have any rs232 device to test here until next week, so

each value/part of my tlv messages is sent as one binary byte, correct me if i’m wrong, with a maximum bitrate of 115200 bit/s or 14400 byte/s i can receive max 14400/60=240 bytes per frame when running with 60 fps, this would be between 30 and 60 tlv’s (depending on their length) per frame, very cool, BUT to check them with my state machine i’d need to feed them to it sequentially (?), which would mean one part of a tlv per frame - with a minimum tlv length of 4 this results in max 15 messages per sec transmitted, this is ok for one turned knob on my rs232 device, but not when turning multiple knobs or sending longer messages (mostly the case).

any way out? much appreciated,

dw

I think you should have a look at Tokenizer (String).

hi bjoern, thx for your time, but no it’s not - tokenizer’s help file and posts about it in the forums actually made me aware of my problem - tokenizer will output all received bytes as spreads, which i’d still have to feed sequentially to my state machine, one value after the other :(

maybe it would be easier for us to follow if you provide a patch that shows your problem!?

hmm, i will do a patch reproducing my task asap, for now please see attached patch for automata code and some examples on tlv’s. take second one!

to state my problem as short as possible: given all received bytes of the last frame as a spread, depending on the order and occurence of values in my spreaded input string i’d need to go through several states of the automata node within one vvvv frame to output the right decoded message(s) from the spread(or find another way without automata to do this). see end of text in file.

thx a lot :)

rs232.v4p (13.6 kB)

ok here’s a patch “showing” my problem. to pretend serial communication i use a string io with normal values (to make life easier…)

…chatting with kalle and bilderbuchi however made me aware that it’s probably time for my very first own vvvv plugin - still a bit scared of that though :D so i’d appreciate any other solution too.

thank you :)

rs232.v4p (27.9 kB)