Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

compare ASCII

Status
Not open for further replies.

alamy

New Member
Dear all..

how to compare the character...

for example...if pic receive the character..ABDC then it will reply 1234, and FGHJ then respond 5678..

thanks in advance
 
Creat a Lookup Table

For your examples it's easy. ABCDEFG corresponds to hex 0x41, 0x42, 0x43 ect. If you simply mask the high nibble (AND with 0xF0) then pack 0x30 (OR with 0x30), then 0x41 will be converted to 0x31 ( this is ASCII code for digit "1". To use letters of the alphabet past an index of 9, you will need to utilize a lookup table. In this case I would recommend masking the highest 3 bits and using the results as the index in the table.
 
Status
Not open for further replies.

Latest threads

Back
Top