I've been working on some code, which basically pulses RB0 (defined as STEPPER2) until the countsteps equal zero.
Because I need to work with a bigger number than 255, countstepL handles the smaller digits, whilst i would like countstepH to act like the bigger number. Ideally upto 65,000
I can't seem to see why it only allows up to 255, despite putting 255 in both countstepL and countstepH.
any ideas?
Because I need to work with a bigger number than 255, countstepL handles the smaller digits, whilst i would like countstepH to act like the bigger number. Ideally upto 65,000
I can't seem to see why it only allows up to 255, despite putting 255 in both countstepL and countstepH.
any ideas?
Rich (BB code):
runstepper movf countstepH, w ; Copy contents of address to W
xorlw 0x00 ; Is it Zero? Logical-XOR W with value, place result in W
btfsc STATUS, Z ; Test bit, skip next instruction if bit is 0
goto checkstepL ; if it is zero goto check countstepL if its zero
checkstepL movf countstepL, w ; Copy contents of CountstepL to W register
xorlw 0x00 ; Is it zero? So do the opposite. If the bit is 1 then goto main
btfsc STATUS, Z ; Test bit, skip next instruction if bit is 1
goto main ; Reset the pic back to the start of the program
decfsz countstepL, f ; Decrease value by 1 and skip next instruction if result is 0
goto runit ; If countstepL equals zero then goto runit
decf countstepH, f ; decrement countstepH by 1
runit BSF STEPPER2 ; Turn on Step output
call Delay ; Delay by 500micro seconds
BCF STEPPER2 ; Turn off Step Output
call Delay ; Delay by 500micro seconds
goto runstepper