UML State Machine C

Slutfört Publicerat 1 år sedan Betalades vid leverans
Slutfört Betalades vid leverans

We have a stream of Hex data that needs to be decoded and then a decision made on what to do next. The data is received as a single byte. A loop will be the receipt of a byte. The code must be written in C because it will be integrated into an already active microcontroller code.

There will be an input section, verification and then an output section. There must be a variable to set the unit number as well. Entry into the code could be something like this

Void SerialDataEntry( int MyData ) = That I will use as the entry into the state diagram.

intUnitNumber = 1 - 16. I will set this before I call the procedure.

Int ReceiveDerialData( void ) = I use this to check if data is available. Please use -1 to indicate no data is present.

Char GetState( void ) = Get the state that we in or read the state variable

There will be 4 states

BLOCK

PASS

TAG

SWITCHINFO

BULK

AA BB 01 00 00 09 F6 AA BB 02 00 00 11 EE FF AB BB 01 01 A1 A2 A3 etc

The commands that are embedded into the string would be

AA BB 01

AB BB 01 01

AC BB 01

AD BB 01

The first byte is the main command identifier

AA = SwitchLoop

AB = Read Tag

AC = Chek Main Switch

AD = Get Status

The second part, BB, of the command sequence is just a conformation of the fact that it is a command/ If the next byte is not a BB the vyte will be passed through the system as a normal byt ie

Input AA BB 01 A1 A2

Output A1 A2

Or

Input AA 01 FF 3C

Output AA 01 FF 3C

The third is a number only sequence that can be between 1 and 16 for AA, AC and AD and 1 and 16 and 1 and 2 for AB.

I will send an AA and read the result and check the state. The state machine must check that it's a command char (AA, AB, AC, AD) and remember that it's a potential command but keep from sending it back. I will read the output and see its -1 and the state and do nothing.

I send BB. The state machine sees that this definitely a command character and get ready to change its state. Now it will look for a number between 1 and 16.

I send 1. The state machine will see that this is a command and will check if its for this unit. If the variable I set is the same as the one I set then the state will change to PASS and any new char I send will be returned to me. If its not the same the bytes will be discarded because its a command char even though not for this [login to view URL] bytes are discarded in any case.

I now send the 00, When I read i will get the 00 then I can send it down the line.

All characters from this point will be send through until a command byte is received. (AA, AB, AC, AD).

Command AB will set the state to TAG, AC to switch info and AD to bulk.

Any control characters that is received and blocked without the other is passed through ie 01 AA 02 will be passed through as BB 01 AA or BB AA. Its only the exact sequence that has to be read and blocked.

Sample input and output for unit will will be

Input

AA BB 01 00 00 09 F6 AA BB 02 00 00 11 EE FF AB BB 01 01 A1 A2 A3 etc

Output

00 00 09 F6

C-programmering Mikrokontroller

Projekt-id: #34061826

About the project

14 offerter Distansprojekt Aktivt 1 år sedan

Tilldelades:

(5 omdömen)
3.6

14 frilansare har lagt bud på i genomsnitt $830 för det här jobbet

hnutweblera

Hello there. I have good experience with c programming and can help your project. So if u choose me, you will get best result. i am embedded expert. Hope u choose me. Regards.

$500 USD inom 7 dagar
(6 omdömen)
6.6
VoblNet

Hello, An interesting task. Ready to make this parser with state machine, in accordance with your requirements. In C code, given that it will be for the controller. With testing on simulated units.

$450 USD inom 10 dagar
(38 omdömen)
6.4
apgrl123

I CAN COMPLETE YOUR PROJECT EASILY Hello, I am programmer with enough experiences on C/C++ for 10+ years. C/C++ is nice programming language and I am majoring on it for long years so I have confident to complete your p Mer

$500 USD inom 7 dagar
(10 omdömen)
5.9
techplusintl

Hi there, ★★★ C / C++ / C# Expert ★★★ 5+ Years of Experience ★★★ I've read requirements and ready to work on your project. I have strong grasp on Object-Oriented Programming along with excellent analytical and program Mer

$2500 USD inom 15 dagar
(10 omdömen)
5.4
letshappy

I am expert of C programme I understood your requirements but I have a few doubts, text me so I can clear all my doubts right away

$900 USD inom 9 dagar
(7 omdömen)
4.7
elect2eng

I have good knowledge of state machine programming using c language. We need to work together to meet your requirements

$500 USD inom 7 dagar
(34 omdömen)
4.9
nachimd1985

hi, this is Nasir Mehmood. I am a software engineer and have more than 20 years of development experience in embedded systems, database design, web design, graphics, and mobile applications. i have extensive knowledge Mer

$500 USD inom 7 dagar
(12 omdömen)
5.1
KolaPeters

I have thoroughly gone through your project description, I'm an expert and I can help you. Kindly send me a message I'm a senior engineer with rich experience in C Programming, Microcontroller. I am a Python developer Mer

$500 USD inom 5 dagar
(4 omdömen)
3.1
jahoyz

Hi, I've read your description carefully. I have full experience with C, UML I've also worked on several similar projects. So I can complete your project with high quality on time. Looking forward to hear more about th Mer

$500 USD inom 7 dagar
(2 omdömen)
2.9
pyanskiy

Hello there. Expert is here. Pls contact me. Let's have deep discussion about your project. Thanks.

$300 USD inom 7 dagar
(2 omdömen)
2.2