|
发表于 2006-7-18 16:35:05
|
显示全部楼层
End of sync pattern and begin of data bits are detected
according to the last dual low level bits in the sync packet (see Figure 4).
同步块结束和数据位的开始可以依照图4的同步包的最后2个同电平的位来检测。
好像这句翻译少了 LOW 低电平
但是我看他的程序又检测两个连续的高电平,奇怪 所以留意了翻译文章的这一句
并非吹毛求疵 哈哈
我看他的程序
INT0Handler: ;interrupt INT0 多少时间 才能进入中断?
in backupSREG,SREG ;堆栈状态寄存器
push temp0 ;堆栈通用变量0
push temp1 ;堆栈通用变量1
ldi temp0,3 ;counter of duration log0 设置等待时间
ldi temp1,2 ;counter of duration log1 设置等待时间
;waiting for begin packet
CheckchangeMinus:
sbis inputport,DATAminus ;waiting till change D- to 1 检测D-即是(PB0)的状态 为0的时候等待
rjmp CheckchangeMinus
CheckchangePlus: ;校正边沿
sbis inputport,DATAplus ;waiting till change D+ to 1 检测D+(PB1)的状态 为0的时候等待
rjmp CheckchangePlus
DetectSOPEnd: ;等待两个低电平为通信结束
sbis inputport,DATAplus ;检测D+的状态
rjmp Increment0 ;D+ =0 如果为零的话 运行Increment0
Increment1:
ldi temp0,3 ;counter of duration log0
dec temp1 ;how many cycles takes log1
nop
breq USBBeginPacket ;检测到两个高电平 奇怪 if this is end of SOP - receive packet
rjmp DetectSOPEnd
Increment0:
ldi temp1,2 ;counter of duration log1
dec temp0 ;how many cycles take log0
nop
brne DetectSOPEnd ;if there isn't SOF - continue
rjmp EndInt0HandlerPOP2 |
|