Hi All

Having completed the code for DS1990A reading (thanks Darrel) I have a working code section but I`m looking for a much more efficient way to compare the results. Code section included below for reference. The individual iButtons are used to identify room access by person.

The iButton id number is contained in these variables, 6 hex bytes:
id[0],id[1],id[2],id[3],id[4],id[5]

Assuming there is a button in the socket, whats the best way to do a compare to see if its the same button or a different one, without strings of comparsons against the last valid number?


Cheers Pete




Fam var byte
id var byte[6]
crc var byte

OWOUT portb.0,1,[$33], NotThere ' Issue Read ROM, jump to NotThere if no button

OWIN PORTA.1,0,[Fam,id[0],id[1],id[2],id[3],id[4],id[5],crc] 'Read the button

(code required)

goto main



NotThere:

id[0]=0:id[1]=0:id[2]=0:id[3]=0.id[4]=0:id[5]=0 'set all to zero if no iButton inserted

goto main