Pic16f84

Fire Starter's Avatar, Join Date: Jan 2007
Newbie Member
G'day. Just wondering if anyone could let me know if they can see any bugs in this program... been over it heaps but I still cant see why its not doing what its suppose to be doing. What it is suppose to be doing is tuning on a led out of port Rb4 when an input is recived from port Ra0.
thanks.
The Fire Starter.

Code:
Code:
	   maclib  'p16f8x.inc'
;
                   device  pic16f84,xt_osc,wdt_off,pwrt_on,protect_off
;
leds          =       portb           ;led output port
Input	=       porta
;
dir_b         =       00h             ;all out
dir_a	=       01h		;RA0 in
;
	org     0ch             ;start of ram space
;
	org     0               ;reset vector
;
	jmp     start           ;go to beginning of program on reset
;
	org     5               ;start of code space
;
;
;	sets up leds and direction registers
;
start         mov     leds,#0         ;start with all leds off
                setb    rp0             ;point to register page 1
                mov     trisb,#dir_b    ;set port b data direction register
	mov	trisa,#dir_a	;set port a data direction register
                clrb    rp0             ;point back to register page 0
;
;
; main loop to light leds when input on pin Ra0
;
;
ledon
	mov   leds,8		;turn leds on at port Rb4
	jmp   mainloop	;do it forever
;
;
mainloop 
	cje     1,input,ledon	;compare the input to the value 1 and jump if equal
	mov    leds,0		;turn leds off if input is not present
	jmp     mainloop        ;do it forever

Last edited by shabbir; 8Jan2007 at 10:34.. Reason: Code formating.
0
Fire Starter's Avatar, Join Date: Jan 2007
Newbie Member
P.S Sorry About the spaceing of the code....