IanP
Advanced Member level 7
- Joined
- Oct 5, 2004
- Messages
- 7,929
- Helped
- 2,311
- Reputation
- 4,624
- Reaction score
- 531
- Trophy points
- 1,393
- Location
- West Coast
- Activity points
- 66,416
Implementing direction control involves the following modifications to the T0ISR:
Regards,
IanP
Code:
; Timer0 interrupt ..
T0ISR:
CLR TR0
MOV TH0, #HIGH(-921)
MOV TL0, #LOW(-921)
INC R1
MOV C, P3.1 ; Test if P3.1 SW closed ..
JC Set_Dir ; If closed (0V) -> CW ..
CLR Direction
JMP T0ISR_Exit
Set_Dir:
SETB Direction ; If open (5V) -> CCW ..
T0ISR_Exit:
SETB TR0
RETI
Regards,
IanP