Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
p=18f2550
#include <p18f2550.inc>
;....................
;.................... CONFIGURACIN DE FUSIBLES;
;..... consultar C:\Program Files (x86)\Microchip\MPASM
Suite\hlpPIC18ConfigSet.chm
config PLLDIV = 2
; 8 MHz
config BOR
config BORV
External oscillator
= ON
= ON
config PWRT
= OFF
= OFF
=2
config VREGEN = ON
config WDT
config WDTPS
= 32768
config MCLRE
= ON
; MCLEAR Pin on
= OFF
; config ICPRT
= OFF
config XINST
= OFF
config DEBUG
config CP0
= OFF
= OFF
config CP1
= OFF
; config CP2
= OFF
; config CP3
= OFF
config CPB
= OFF
; config CPD
= OFF
config WRT0
= OFF
config WRT1
= OFF
; config WRT2
= OFF
; config WRT3
= OFF
config WRTB
= OFF
config WRTC
= OFF
; config WRTD
= OFF
config EBTR0
= OFF
config EBTR1
= OFF
; config EBTR2
= OFF
; config EBTR3
= OFF
config EBTRB
= OFF
;....................
;.................... INICIO DEL CDIGO;
ORG
0x1000
;....................
;.................... ENCENDER LA MITAD DE LEDS PUERTO B;
;....................
;.................... INICIALIZACIN GENERAL;
Configuracion:
CLRF TBLPTRU
FUSIBLES
;0'S
BCF
RCON,7
PRIORIDAD DE INTERRUPCIONES
;0
CLRF
DE MEMORIA
FSR0H
;0S
-> FSR0H
DIRECCIONAMIENTO DE BANCO
CLRF
DE MEMORIA
FSR0L
;0S
-> FSR0L
DIRECCIONAMIENTO DE BANCO
MOVF
ADCON1,W
ANDLW
0xC0
IORLW
0x0F
MOVWF
ANALOGICOS
MOVLW
MOVWF
COMPARADORES
;ADCON1
ADCON1
;W
-> W
0x07
CMCON
CONFIG. MODULO
setup
movlw b'11111111'
with
movwf PORTB
begin
starts.
movlw b'11000000'
combination so that
movwf PORTB
call Delay
for a moment.
movlw b'11111001'
combination so that
movwf PORTB
call Delay
for a moment.
movwf PORTB
;
movlw b'10110000'
combination so that
movwf PORTB
;
call Delay
number there for a moment.
movlw b'10011001'
combination so that
movwf PORTB
call Delay
number there for a moment.
movlw b'10010010'
combination so that
movwf PORTB
call Delay
there for a moment.
movlw b'10100100'
combination so that
call Delay
for a moment.
movlw b'10000010'
combination so that
movwf PORTB
call Delay
that number there for a moment.
movlw b'11111000'
combination so that
movwf PORTB
call Delay
number there for a moment.
movlw b'10000000'
combination so that
movwf PORTB
;
movlw b'10011000'
combination so that
countI set 0
MLoop set 2
goto begin
Delay
movwf PORTB
call Delay
there for a moment.
call Delay
number there for a moment.
and repeat!
movlw .9
movwf MLoop
movlw 1
;moving .9 to MLoop
; 1 is asigned to w
inicioCicloTres
cpfsgt MLoop
method
goto finCicloTres
cuerpoCicloTres
; ------------- 2 Cycle
iniciaVarContExt
movlw .255 ; asigns .255
movwf countI
movlw 1
; Asigns 1 to w
inicioCicloExt
cpfsgt countI; it is more than and cause to go to EndF method
goto finCicloExt
interuption
cuerpoCicloExt
; ------Last Cycle
iniciaVarContCiclo
movlw 0
movwf count2
movlw .255
; Asigns 0 to w
; Makes countx 0
; asigns .255
iniciaCiclo
cpfslt count2 ; it is more than and cause to go to final method
cuerpoCiclo
nop
goto iniciaCiclo
finCiclo
modificaVarContExt
decf countI
movlw 1
;Asigns 1 to w
goto inicioCicloExt
finCicloExt
;Cycle ends
modificaVarContTres
decf MLoop
movlw 1
return
; Delay Ends
end
; Program Ends