saviourm
Junior Member level 3

Dear all,
I am learning the pic ,can someone help me?
I have the following program in assembly.My problem is ,when I am tyring to display the value H'0001' and H'0002' on PORTB via set of Leds the value displayed is incorrect. But the other values on the program are dispalyed correctly .I tried to put the values in HEX,Binary and Decimal but the same result occured !
_PWRTE_ON EQU H'3FF7'
_PWRTE_OFF EQU H'3FFF'
_WDT_ON EQU H'3FFF'
_WDT_OFF EQU H'3FFB'
_LP_OSC EQU H'3FFC'
_XT_OSC EQU H'3FFD'
_HS_OSC EQU H'3FFE'
_RC_OSC EQU H'3FFF'
__CONFIG _CP_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC
TRISA equ H'0085'
PORTA equ H'0005'
COUNT1 equ H'0008'
COUNT2 equ H'0009'
STATUS equ H'0003'
PORTB equ H'0006'
TRISB equ H'0086'
PCL equ H'0002'
PCLATH equ H'000A'
org H'0010'
bsf STATUS,5
movlw H'0000'
movwf TRISB
bcf STATUS,5
start movlw H'0004' ;value to be displayed
Call Table
movwf PORTB
Table addwf PCL
retlw H'0012'
retlw H'0008'
retlw H'0015'
retlw H'0003'
retlw H'0001'
retlw H'0002'
return
end
I am learning the pic ,can someone help me?
I have the following program in assembly.My problem is ,when I am tyring to display the value H'0001' and H'0002' on PORTB via set of Leds the value displayed is incorrect. But the other values on the program are dispalyed correctly .I tried to put the values in HEX,Binary and Decimal but the same result occured !
_PWRTE_ON EQU H'3FF7'
_PWRTE_OFF EQU H'3FFF'
_WDT_ON EQU H'3FFF'
_WDT_OFF EQU H'3FFB'
_LP_OSC EQU H'3FFC'
_XT_OSC EQU H'3FFD'
_HS_OSC EQU H'3FFE'
_RC_OSC EQU H'3FFF'
__CONFIG _CP_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC
TRISA equ H'0085'
PORTA equ H'0005'
COUNT1 equ H'0008'
COUNT2 equ H'0009'
STATUS equ H'0003'
PORTB equ H'0006'
TRISB equ H'0086'
PCL equ H'0002'
PCLATH equ H'000A'
org H'0010'
bsf STATUS,5
movlw H'0000'
movwf TRISB
bcf STATUS,5
start movlw H'0004' ;value to be displayed
Call Table
movwf PORTB
Table addwf PCL
retlw H'0012'
retlw H'0008'
retlw H'0015'
retlw H'0003'
retlw H'0001'
retlw H'0002'
return
end