Microcontrollers PIC18F course second sample using assembler
This is the second sample of my course if you interested in the course or you need help in a project (not for free) you can contact me at:
postgraduatecahg@gmail.com
list p=18f2550
include "P18F2550.INC"
;Bits de configuracion
CONFIG FOSC = HS
; High speed clock.
CONFIG MCLRE = OFF ; Master Clear OFF
CONFIG BOR = OFF ; Brown-out OFF
CONFIG PWRT = OFF ; Power-up Timer OFF
CONFIG LVP = OFF
CONFIG XINST = OFF
CONFIG PBADEN = OFF
CONFIG CP0 = OFF
CONFIG CP1 = OFF
CONFIG CP2 = OFF
CONFIG CP3 = OFF
CONFIG CPB = OFF
CONFIG CPD = OFF
ORG 0x00
; start from 0x00 address
GOTO START
;jump to start label.
ORG 0x50 ; space for IRS
START
movlw 0x0F;
movwf ADCON1,0
;PORTAandPORTB pins are digitals
clrf TRISB,0
;PORT B as an output.
movlw b'00011111';
movwf TRISA,0
;PORT A as input
LOOP
movf PORTA,W,0
;Move Port A and store it in W.
andlw 0x0F
;W = W(AND)00001111
movwf PORTB,0;
goto LOOP; for make a loop
end; END of the program.
Figure 1. Circuit diagram.
You can ask by my course in Spanish.
No hay comentarios.:
Publicar un comentario