En cours

Dynamic C program

I need someone to write software in C for a singleboard computer that I am using to emulate two pieces of outdated hardware.

I have most of the code written already, I just need it to compile and run.

Description of the code:

The singleboard computer has two serial ports, E and F.

Serial Port E will be recieving commands in hex which are described below:

Init command which is constantly sent through serial port E to determine if a viable connection is established.

>we receive

0x0D

0x03

>we respond

0x0D

0x0A

0x3E

0x0D

0x0A

These responses will need to be sent back and forth throughout the emulation.

We will recieve "non-init" commands through serial port E. These commands have a 3 byte prefix, a 2-6 byte "command op-code", and a 4 byte suffix. Each time we receive a command, we will need to determine what command it is, send a proper response back through serial port E, and convert the command and send it through serial port F.

Typical serial port E command:

0x80 //prefix

0x00 //prefix

0x01 //prefix

0x00 // changing variable that determines what the command does

0x00 // changing variable that determines what the command does

0x00 // optional changing variable (the command has either 2 bytes of changing variables or 6 bytes)

0x00 // optional changing variable

0x00 // optional changing variable

0x00 // optional changing variable

0x03 //suffix

0x03 //suffix

0x03 //suffix

0x03 //suffix (these 4 0x03 suffix hex tells us when we reach the end of a command)

Response to command string from serial port E to serial port E should be 11 bytes.

something like this:

0x01 //prefix

0x00 //prefix

0x2c //prefix

0x00 //changing variable depending on what we were sent on serial port E

0x0d //suffix

0x0a //suffix

0x0d //suffix

0x0a //suffix

0x3e //suffix

0x0d //suffix

0x0a //suffix

Once we have sent a reponse to serial port E, we need to send another reponse through serial port F (depending on what op-code we received)

(op-code is the 2-6 byte part of the serial port E command that changes depending on what command is coming through).

I have already written fuctions for the responses that need to be re-written for this code. They are called PI-functions.

example:

/* Move Absolute Address *********************************************/

/* Move to an absolute location as a function of the zero location */

/*********************************************************************/

int pi_move_abs(int axis, double loc)

{

char buf[BUFLEN];

if (-999 == pi_ref[axis])

if (-1 == pi_get_limits(axis))

return -1;

snprintf(buf, BUFLEN, "MOV %d %f\n", axis, (loc / 1000000) + pi_ref[axis]);

return pi_send_cmd(buf);

}

serEgetc(); // reads incoming serial port E commands

serEputc(); // sends a command through serial port E

serFgetc(); // reads incoming serial port F commands

serFputc(); // sends a command through serial port F

I have attached a manual for the commands being sent through serial Port E.

I have also attached burleigh.h which describes what the op-codes mean

I have attached PI functions.c which need to be re-written in terms of serFputc(); etc.

This project was a bit hard to desribe, feel free to ask questions.

Compétences : Tout va bien, Programmation C, Programmation C++, Architecture Logicielle, Visual Basic

Voir plus : serial port dynamic, what is in c programming, what is dynamic programming, what is computer program, what is a variable in programming, what is a variable in computer programming, what is a string in programming, what is a function in computer programming, what does mean in c programming, what does mean in computer programming, what does description mean, variable programming, variable in programming, string prefix, string in c programming, string c programming, software for dynamic programming, serial programming, serial port programming, questions on dynamic programming, proper suffix, program of computer, programming variables, programming variable, programming terms

Concernant l'employeur :
( 1 commentaire ) Hillsboro, United States

N° du projet : #2404154

1 freelance a fait une offre moyenne de 80 $ pour ce travail

kaloyan13

C programmer and CST engineer.

80 $ USD en 2 jours
(191 Commentaires)
6.6