Luciano>>
Thanks for the file..i figured out the logic of the "XOR"..
i included this in my code...[the counting up and counting down lines]
Code:
quad:
new= PORTC & %00000011
start:
old=new & %00000011
again:
new= PORTC & %00000011
IF new=old Then again
direction_bit=old.bit1 ^ new.bit0
IF direct=0 Then cw
LCDOut $fe,1,"Last was CCW"
counter=counter+1
LCDOut $fe,$c0,DEC counter
Pause 5
GoTo start
cw:
LCDOut $fe,1,"Last was CW"
counter=counter-1
LCDOut $fe,$c0,DEC counter
Pause 5
GoTo start
...I am able to see the counter going up and down as the motor changes it's direction..however the LCD line "last was cw/ccw"..keeps on flipping and never remains the same..even if the motor has moved in the same direction..
Im still working on it..and will keep u all posted...
monitor the 'value' variable. or modify it easily to have CW and CCW flag in one shot....
Thanks for the link M_e
..i'll be doing tht to take care of the above problem
Bookmarks