Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Serial Binary Protocol

Status
Not open for further replies.

embed_v

Junior Member level 1
Joined
Aug 10, 2010
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,432
hiii,
i want to impliment a serial binaryy protocol for my serial communication.
there are two types of serial protocol format 1)TEXT 2) BINARY.

i am want to use binary type so guide me how to code for it.
and format is 1 byte rx and tx. over serial port.
i knw about text format and about its coding in C but how will do this for BINARY.??



Thnx,
 

you set the serial port parameters to 8 bit no parity and your can then send a byte at a time - the is no real difference between characters and binary data except that printable characters are generally 7 bits unless you go to extended character sets - the characters are represented by binary values, e.g. in ASCII character A is 65 decimal 0x41 hex, see
Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion
unless you know exactly how much data you are transfering you probably need to have a protocol, e.g. length of frame, followed by the data followed by a checksum
If you are transfer binary data also be careful of word length, e.g. an int can be 16 bits, 32bits, 48 bits, etc (I tend to use short int as I have always found that to be 16bits but you need to check) and if the machines are little endian or big endian. Also if the data is floating point is the same representation used on both machines.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top