Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DB Define Byte Usage

Status
Not open for further replies.

deanlwvu

Technical User
Jul 23, 2003
25
US
I know how to define a byte, but I don't know how to use it. I'm using some serial communication, and I need to see if a command is received.
Code:
ExitCmdString: DB  45h, 78h, 69h, 74h, 43h, 6Dh, 64h, 00h
My command interpreter is going to look at each character received and if all chars received in the string, then it will stop serial communication. My question is "How do you look through the string and see if what you are receiving matches your command string?

 
you need to do some kind of compare string function. In some languages, you compare each value in the string to see if its the one you are looking for, if not, then go to next.
Like a for next loop, or do while. some logic might be ...

get value
check value for 45h
if not next value
if yes, check for 78h
(and so on)

until the whole string has been matched.

Thaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top