These questions are reffered to Assembler Language PIC16F182
These questions are reffered to Assembler Language, PIC16F1829.
Here is the program I wrote:
; PIC16F1829 Configuration Bit Settings
; ASM source line config statements
#include \"p16F1829.inc\"
; CONFIG1
; __config 0xC9E4
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
; CONFIG2
; __config 0xDEFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_OFF
; Id processor and set radix to decimal
list p=16F1829, R=DEC
CBLOCK 0x30 ; Define GPR variable register locations
DLAY
DLAY1 ;Vars for this routine
LOOPcount
ENDC
ORG 0
goto Start
;put a return from interrupt at the interrupt vector location 0x04
ORG 4
RETFIE;
Start
; Main code starts here
; First set up clock
BANKSEL OSCCON ;oscon is where the bits are set or cleared to fix clock
movlw 0x6A ; set up for 4MHz clock int oscilator
movwf OSCCON
BANKSEL TRISA ;Sets the tristate buffers on for port A
clrf TRISA
BANKSEL LATA
clrf LATA
Loop
BANKSEL LATA
BSF LATA,5
CALL Tdelay
BANKSEL LATA
BCF LATA,5
CALL Tdelay
Goto Loop
Tdelay ;Here is the delay subroutine, counts to 65,536
BANKSEL DLAY ;make sure we are in the right bank
movlw 0xFF
movwf DLAY
Outside
decfsz DLAY
goto Goon
return ; jump out when outside is done
Goon
movlw 0xFF
movwf DLAY1
Inside
decfsz DLAY1
goto Inside
goto Outside
end
Solution
CONFIG1
; __config 0xC9E4
__CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _CPD_OFF & _BOREN_OFF & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF
; CONFIG2
; __config 0xDEFF
__CONFIG _CONFIG2, _WRT_OFF & _PLLEN_OFF & _STVREN_ON & _BORV_LO & _LVP_OFF
; Id processor and set radix to decimal
list p=16F1829, R=DEC
CBLOCK 0x30 ; Define GPR variable register locations
DLAY
DLAY1 ;Vars for this routine
LOOPcount
ENDC
ORG 0
goto Start
;put a return from interrupt at the interrupt vector location 0x04
ORG 4
RETFIE;
Start
; Main code starts here
; First set up clock
BANKSEL OSCCON ;oscon is where the bits are set or cleared to fix clock
movlw 0x6A ; set up for 4MHz clock int oscilator
movwf OSCCON
BANKSEL TRISA ;Sets the tristate buffers on for port A
clrf TRISA
BANKSEL LATA
clrf LATA
Loop
BANKSEL LATA
BSF LATA,5
CALL Tdelay
BANKSEL LATA
BCF LATA,5
CALL Tdelay
Goto Loop

