Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Assembly Language Programming (ALP) Forum (http://www.go4expert.com/forums/assembly-language-programming-forum/)
-   -   Pic16f84 (http://www.go4expert.com/forums/pic16f84-t2467/)

Fire Starter 7Jan2007 17:49

Pic16f84
 
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


Fire Starter 7Jan2007 17:51

Re: Pic16f84
 
P.S Sorry About the spaceing of the code....


All times are GMT +5.5. The time now is 11:35.