| ??? 09/15/07 03:04 Read: times |
#144639 - Tried your method Responding to: ???'s previous message |
Hello Hans, I tried your method (like deadzone), WOW, it's much better now... i made a code a bit different from yours, could you have a look if its ok?
READ0: CALL READ ; Read ADC
MOV TH,A
MOV TP,@R0 ; Remember previous value
CLR C
SUBB A,TP ; Current - Previous
JNC ABSEND ; If carry: result was negative, CPL IT!
CPL A
ABSEND: CJNE A,#1,TRESADC ; Compare change to "deadzone" value
TRESADC:JC INCI ; less than value. ignore
MOV A,TH
SEND0: MOV @R0,A ; Update ram value with new one
CALL SEND
INCI: ;rest of code...
The only thing It is doing wrong is when I rotate the pot increasing the value it is sending the value twice like... IE: 31 31 32 32 33 33 34 34... for decreasing values it is flawless, but couldnt debug this problem yet. Another thing... in you code, after complementing (CPL A) you are incrementing A (INC A), why? Can you explain for me? Thanks. |



