christina86
Newbie level 5

Dear Friends,
I am using the MPLab 7.2 to write an assembly language using PIC16C745 to turn ON & OFF the Led Light using the push button.
I have successfully burn the Code inside the PIC16C 745 but when i apply the 5V voltage .it failed to turn on.
Here is my code :
list p=16c745 ; list directive to define processor
#include <p16c745.inc> ; processor specific variable definitions
__CONFIG _H4_OSC&_WDT_OFF&_PWRTE_OFF&_CP_OFF
org 0X00000030
Start
bsf STATUS,RP0 ; select bank1
movlw b'00000110' ; Set pins PORTB 1,2 as Input and the rest as "output"
movwf TRISB ;
bcf STATUS, RP0 ; go back to Bank 0
ON
btfsc PORTB,1 ; has S1 been press? (Normally high,goes low when pressed.)
goto ON ; No, go back check again
bsf PORTB,0
OFF
btfsc PORTB,2 ; Has key been press? (Normally high, goes low when pressed.)
goto OFF ; No, check again
bcf PORTB,0
goto Start
end ; directive indicates end of code
Can you help me to check where did i go wrong and how the correct way should be ?
I am using the MPLab 7.2 to write an assembly language using PIC16C745 to turn ON & OFF the Led Light using the push button.
I have successfully burn the Code inside the PIC16C 745 but when i apply the 5V voltage .it failed to turn on.
Here is my code :
list p=16c745 ; list directive to define processor
#include <p16c745.inc> ; processor specific variable definitions
__CONFIG _H4_OSC&_WDT_OFF&_PWRTE_OFF&_CP_OFF
org 0X00000030
Start
bsf STATUS,RP0 ; select bank1
movlw b'00000110' ; Set pins PORTB 1,2 as Input and the rest as "output"
movwf TRISB ;
bcf STATUS, RP0 ; go back to Bank 0
ON
btfsc PORTB,1 ; has S1 been press? (Normally high,goes low when pressed.)
goto ON ; No, go back check again
bsf PORTB,0
OFF
btfsc PORTB,2 ; Has key been press? (Normally high, goes low when pressed.)
goto OFF ; No, check again
bcf PORTB,0
goto Start
end ; directive indicates end of code
Can you help me to check where did i go wrong and how the correct way should be ?