piclearner
New Member
Hi,
I am VERY new on pics and and have been learning on this forum, datasheets, etc. I just programmed my first pic 12C508A and obviously the program is not working...
I think it should be easy and in the simulator kind of worked, but not in real life... does anybody has a suggestion? I know there should be basic errors but i'm really a begginer (you will see it)
THANKS if someone can take a look to the code...
***************************************
list p=12c508a ; list directive to define processor
#include <p12c508a.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_ON & _MCLRE_ON & _ExtRC_OSC
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;***** VARIABLE DEFINITIONS
temp EQU 0x07 ;example variable definition
ret EQU 0x08
delay1 EQU 0x09
delay2 EQU 0x0A
;**********************************************************************
ORG 0x1FF ; processor reset vector
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
ORG 0x000 ; coding begins here
movwf OSCCAL ; update register with factory cal value
; remaining code goes here
routine
bsf 0x06, 0
movlw 0xFF
movwf delay1
loopa
movlw 0xFF
movwf ret
loopb
decfsz ret,f
goto loopb
decfsz delay1,f
goto loopa
bcf 0x06, 0
bsf 0x06, 1
movlw 0xFF
movwf delay2
loopc
movlw 0xFF
movwf ret
loopd
decfsz ret,f
goto loopd
decfsz delay2,f
goto loopc
bcf 0x06, 1
start
nop ; example code
movlw 0x02 ; example code
movwf temp ; example code
tris b'0001000' ; 0,1,2 as outputs
btfss 0x06,3
call routine
goto start
END ; directive 'end of program'
I am VERY new on pics and and have been learning on this forum, datasheets, etc. I just programmed my first pic 12C508A and obviously the program is not working...
I think it should be easy and in the simulator kind of worked, but not in real life... does anybody has a suggestion? I know there should be basic errors but i'm really a begginer (you will see it)
THANKS if someone can take a look to the code...
***************************************
list p=12c508a ; list directive to define processor
#include <p12c508a.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_ON & _MCLRE_ON & _ExtRC_OSC
; '__CONFIG' directive is used to embed configuration word within .asm file.
; The lables following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.
;***** VARIABLE DEFINITIONS
temp EQU 0x07 ;example variable definition
ret EQU 0x08
delay1 EQU 0x09
delay2 EQU 0x0A
;**********************************************************************
ORG 0x1FF ; processor reset vector
; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.
ORG 0x000 ; coding begins here
movwf OSCCAL ; update register with factory cal value
; remaining code goes here
routine
bsf 0x06, 0
movlw 0xFF
movwf delay1
loopa
movlw 0xFF
movwf ret
loopb
decfsz ret,f
goto loopb
decfsz delay1,f
goto loopa
bcf 0x06, 0
bsf 0x06, 1
movlw 0xFF
movwf delay2
loopc
movlw 0xFF
movwf ret
loopd
decfsz ret,f
goto loopd
decfsz delay2,f
goto loopc
bcf 0x06, 1
start
nop ; example code
movlw 0x02 ; example code
movwf temp ; example code
tris b'0001000' ; 0,1,2 as outputs
btfss 0x06,3
call routine
goto start
END ; directive 'end of program'