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

Can you think of any other way the bit 5 in Port A could be set and cleared without using the BSF and BCF instructions? Count how many instructions in the above program that use \"immediate\" addressing. Draw the circuit that includes the output pin (RA5) through the LED. Explain why the LED turns on when the RA5 bit is set to 1 How much current is flowing out or into the pin (RA5) and where is the maximum allowable current level found in the data sheet (on black board)? By trial and error figure out what value with the old delay routine, instead of 0 times C800 would be required to get exactly 1/2 second out of the loop using the clock rate we set of 4MHz, so that with outside set to 2 it would take exactly 1 second per complete blink cycle.

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

These questions are reffered to Assembler Language, PIC16F1829. Here is the program I wrote: ; PIC16F1829 Configuration Bit Settings ; ASM source line config st
These questions are reffered to Assembler Language, PIC16F1829. Here is the program I wrote: ; PIC16F1829 Configuration Bit Settings ; ASM source line config st

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site