我想将两个A/D口的电压相减,用得到的值的大小作为一个条件!当条件为真时,即FLAG为51h时,才执行另外程序,否则不执行!但是加上这个程序后,不管任何情况下,另外一个程序都会执行!不知道这个条件程序执行了没有,谢谢帮我看看!
LD Acc1, #1 ; 1th channel
LD Acc0, #6 ; 6 sample times
CALL AdcConvert
LD Acc0, #6 ; 6 adjust number
CALL AdcDataAdjust
CALL AverageValue
LD CellVoltageL, AverageValueL
LD CellVoltageH, AverageValueH
LD Acc9, CellVoltageL
LD Acc10, CellVoltageH
;---------------
LD Acc1, #0 ; 0th channel
LD Acc0, #6 ; 6 sample times
CALL AdcConvert
LD Acc0, #6 ; 6 adjust number
CALL AdcDataAdjust
CALL AverageValue
LD CellVoltageL, AverageValueL
LD CellVoltageH, AverageValueH
LD Acc7, CellVoltageL
LD Acc8, CellVoltageH
SUB Acc9, Acc7
SBC Acc10, Acc8
SUB Acc9, #>41 ; 0.2v
SBC Acc10, #<41
JR ULT, CJV_Down_0v2
INC Counter_Up_0v2
CP Counter_Up_0v2,#2 ;2*0.5s
JR ULT, DCC_Exit
LD Counter_OutputUp, #51h
JR CJV_Exit
CJV_Down_0v2:
CLR Counter_OutputUp
CLR Counter_Up_0v2
CJV_Exit:
RET