avr: "Utils_WaitNanoSecs 100000" doesn't work at 8MHz (too many cycles).
This commit is contained in:
@@ -11,14 +11,28 @@
|
|||||||
|
|
||||||
|
|
||||||
; ---------------------------------------------------------------------------
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine Utils_WaitFor10MicroSecs @global
|
||||||
|
;
|
||||||
; wait for 10 microsecs (minus cycles for call and ret).
|
; wait for 10 microsecs (minus cycles for call and ret).
|
||||||
;
|
;
|
||||||
; IN:
|
; @clobbers r22
|
||||||
; - nothing
|
|
||||||
; OUT:
|
|
||||||
; - nothing
|
|
||||||
; REGS: r22
|
|
||||||
|
|
||||||
Utils_WaitFor10MicroSecs:
|
Utils_WaitFor10MicroSecs:
|
||||||
Utils_WaitNanoSecs 10000, 7, r22 ; wait for 10us (minus RCALL and RET)
|
Utils_WaitNanoSecs 10000, 7, r22 ; wait for 10us (minus RCALL and RET)
|
||||||
ret
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
; ---------------------------------------------------------------------------
|
||||||
|
; @routine Utils_WaitFor50MicroSecs @global
|
||||||
|
;
|
||||||
|
; wait for 50 microsecs (minus cycles for call and ret).
|
||||||
|
;
|
||||||
|
; @clobbers r22
|
||||||
|
|
||||||
|
Utils_WaitFor50MicroSecs:
|
||||||
|
Utils_WaitNanoSecs 50000, 7, r22 ; wait for 50us (minus RCALL and RET)
|
||||||
|
ret
|
||||||
|
; @end
|
||||||
|
|
||||||
|
|||||||
@@ -294,8 +294,9 @@ si7021MeasureAny_loop: ; (R22)
|
|||||||
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
rcall twiSendByteExpectAck ; (R16, R17, R18, R22)
|
||||||
brcs si7021MeasureAny_gotValue ; chip responds, receive values
|
brcs si7021MeasureAny_gotValue ; chip responds, receive values
|
||||||
dec r14
|
dec r14
|
||||||
breq si7021MeasureAny_error ; timeout
|
breq si7021MeasureAny_error ; timeout
|
||||||
Utils_WaitNanoSecs 100000, 0, r22
|
rcall Utils_WaitFor50MicroSecs ; wait for 100usecs total
|
||||||
|
rcall Utils_WaitFor50MicroSecs
|
||||||
rjmp si7021MeasureAny_loop
|
rjmp si7021MeasureAny_loop
|
||||||
|
|
||||||
si7021MeasureAny_gotValue:
|
si7021MeasureAny_gotValue:
|
||||||
|
|||||||
Reference in New Issue
Block a user