Hey,
I am using PIC16F84A micro controller. I am trying to program a 7 segment display to count until 9. The code in assembly I wrote for that is as follows: Its not working and i dont know why. Can anyone help me pls ? its quite simple example
#include P16F84A.INC
__config _XT_OSC & _WDT_OFF & _PWRTE_ON
The code has quite a few issues. So here's a rewrite that replaces the original 'loop' and 'counter' routines.. Not tested but seems ok.
Code:
loop;
movf COUNT,w ; get pointer
call conversion; convert to 7 seg bits
movwf PORTB; drive 7 seg display
call delay_loop; make it visible.
incf COUNT,f ; increment pointer
movf COUNT,w ; into wreg
sublw .9 ; compare to 9 decimal.
skpz ; skip next if = to .9, else
goto loop; continue counting up
clrf COUNT; reset pointer/counter if 9 count was reached
goto loop; continue display.