6070IH问题,请各位朋友解答,数据移位时第八位数据丢失,怎么解决 点击:255 | 回复:0



JAJ

    
发表于:2010-08-24 13:08:20
楼主

自由口通讯时,宏定义程序如下:


command【0】 = 0X1// station no
command【1】 = 0X3//
address=16640
HIBYTE(address, command【2】)
LOBYTE(address, command【3】)
read_no=6
HIBYTE(read_no, command【4】)
LOBYTE(read_no, command【5】)
CRC(command【0】, checksum, 6)
LOBYTE(checksum, command【6】)
HIBYTE(checksum, command【7】)
OUTPORT(command【0】, "Free Protocol", 8)// send command
INPORT(response【0】, "Free Protocol",17, return_value)// read response

SetData(return_value, "Local HMI", LW, 500, 1)// return_value ==0 -> error
if return_value ==0 then
err=1
end if
SetData(err, "Local HMI", LB, 500, 1)
if (return_value >0 and response【1】==0x3) then
read_data【0】 = response【4】+(response【3】<<8)
read_data【1】 = response【6】+(response【5】<<8)
read_data【2】 = response【8】+(response【7】<<8)
read_data【3】 = response【10】+(response【9】<<8)
read_data【4】 = response【12】+(response【11】<<8)
read_data【5】 = response【14】+(response【13】<<8)
err=0
SetData(response【9】, "Local HMI", LW, 900, 1)
SetData (read_data【0】,"Local HMI",LW,550,6)
end if
if read_data【0】>0 then
sd=1
end if
if read_data【0】==0 then
sd=0
end if
SetData(sd, "Local HMI", LB, 501, 1)



加黑部分数据lw900实际数据为       0110 1001                但lw553数据实际值为0110 1000 1010 1011        

这组数据是在同一个界面上得到的,lw900是直接显示数据,     lw553是移位以后的数据,为什么后面的数据丢了呢?

还有,我发送了一个组数据至LW550   内容是0E D8   ,但是实际显示的却是 0D D8

各位大侠,问题到底出在什么地方呢   



楼主最近还看过

SSI ļʱ