Need some help with to make short/fast assembler code for revesable counter. Using PIC 18F242 or 18F2550 for now.
- Interruput routine using INT0
- 16 bit counter counting from 0 to 2499
- If RA1 is ON then counter+1, roll back to 0 if>= 2500
- IF RA1 if OFF then counter-1, roll to 2499 if <0
Also:
- If counter =0 to 3 then set RB1=1, else RB1=0
2500 I used as an example, it can be any number from 1000 to 10000
Counter can count from 1 to 2500 if it will be easy.
Again, need very short and fast code, can't spend too much time servicing this interrupt.
Any help or ideas will be helpful.
Thanks
- Interruput routine using INT0
- 16 bit counter counting from 0 to 2499
- If RA1 is ON then counter+1, roll back to 0 if>= 2500
- IF RA1 if OFF then counter-1, roll to 2499 if <0
Also:
- If counter =0 to 3 then set RB1=1, else RB1=0
2500 I used as an example, it can be any number from 1000 to 10000
Counter can count from 1 to 2500 if it will be easy.
Again, need very short and fast code, can't spend too much time servicing this interrupt.
Any help or ideas will be helpful.
Thanks