UART - Decision on Received Bytes

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

UART - Decision on Received Bytes

Post by Docara »

Morning everyone,

How do you go about receiving and then acting on multiple received bytes from a comms port.

So, say I setup a transmit AE 12 AC (whatever) how do I act on these bytes to do some on the receiving end, what is the decision method to extract the data from these bytes and act on it - how is it done.

Thanks
Matt

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: UART - Decision on Received Bytes

Post by Benj »

Hi Matt,

Examples 1 and 2 on this Wiki page should help to get you started.
https://www.matrixtsl.com/wikiv7/index. ... ateMachine

Let us know how you get on.

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: UART - Decision on Received Bytes

Post by Docara »

Hi Ben,

Thanks for the Link

Unfortunately I don't have the Comms Pack for USB so I can't simulate "1"

Number "2" doesn't seem to do anything in Simulation

MAtt

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: UART - Decision on Received Bytes

Post by Docara »

Any thoughts?

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: UART - Decision on Received Bytes

Post by Benj »

Hi Matt,
Number "2" doesn't seem to do anything in Simulation
Are you providing data to drive the simulation, say via a COM port or via another Flowcode sim running and connected using the vNet injectors? The example is a communications example and needs communications data to drive it. It's more a how to handle the comms data using a state machine that I thought would be useful to you.

Docara
Posts: 315
Joined: Sun Jun 23, 2013 1:29 pm
Has thanked: 28 times
Been thanked: 61 times
Contact:

Re: UART - Decision on Received Bytes

Post by Docara »

Hi Ben,

I think the code in principle is exactly what I'm after. I was thinking of the same idea just dont how to do it fully.

Im confident I could read in a byte of data when a RX Int was triggered and use it with a decision but it's the next stage I'm struggling with. How and where do you read the subsequent bytes store it in a buffer (somewhere) untilit tcan be read and act on it.

I have no idea what an injector is or what is used for,

Matt

Post Reply