| ??? 11/17/07 02:49 Read: times |
#147106 - changed the code, but cant debug! Responding to: ???'s previous message |
Hi again, Hans, I have changed the code to be more likely to yours but my controller is responsing very strange, I already read and rewrite code many times and cant find the faulty, everythings apears to be correct (maybe blindness or donkeyness), it keeps sending all values all time (never stop), can you help me, here is my code, thanks in advance.
READ0: CALL READ ; Read ADC (Result on A) 8bit
MOV TH,A
MOV TP,@R0 ; Remember previous value
CLR C
SUBB A,TP ; Current - Previous
MOV DIR,C
JNC ABSEND ; If carry: result was negative, CPL IT!
CPL A
INC A
ABSEND: CJNE A,#1,TRESADC ; Compare change to deadzone
TRESADC:JC INCI ; changed less than value. ignore
MOV A,TH ; remember current value
JB DIR,addtres ; If change is up, compensate down
CLR C
SUBB A,#1
JMP SEND0
AddTres:ADD A,#1 ; If change is down, compensate up
SEND0: MOV @R0,A ; Update ram value with new one
CALL SEND ; send midi data
INCI: ;code continues - next input read
|



