'***************触摸板数据解析****************
dim crc as INTEGER
dim byteArray(32) as BYTE
dim crc_L as INTEGER
dim crc_H as INTEGER
dim cardIDtemp as STRING
dim TouchDataTemp as INTEGER
!SetStrToByteArr (byteArray,1, REC_DATA )
crc= !SvrByteArrayModbusCRC(byteArray,1,!Len(REC_DATA)-2)
crc_H=!BitRShift(crc,8)
crc_L=!BitAnd(crc,0xff)
IF crc_H=byteArray[!Len(REC_DATA)] AND crc_L=byteArray[!Len(REC_DATA)-1] THEN
if byteArray[1]=0x0A then
!GetStrFromByteArr(byteArray,2,10,cardIDtemp)
if cardIDtemp <>"0000000000" then
cardID=cardIDtemp
endif
endif
IF byteArray[1]=0x0B THEN
TouchDataTemp=byteArray[2]
if TouchDataTemp > 0 then
TouchData=TouchDataTemp
KEY0=!BitRShift(!BitAnd(TouchData,BIT0),0)
KEY1=!BitRShift(!BitAnd(TouchData,BIT1),1)
KEY2=!BitRShift(!BitAnd(TouchData,BIT2),2)
KEY3=!BitRShift(!BitAnd(TouchData,BIT3),3)
KEY4=!BitRShift(!BitAnd(TouchData,BIT4),4)
KEY5=!BitRShift(!BitAnd(TouchData,BIT5),5)
KEY6=!BitRShift(!BitAnd(TouchData,BIT6),6)
KEY7=!BitRShift(!BitAnd(TouchData,BIT7),7)
endif
ENDIF
ENDIF
| 留言与评论(共有 0 条评论) “” |