A little Blink WWAN LED - Test on the V1.1 Board (Comments will be translated later), Write the Little Code with mpasm.
main.asm
;list p=18f2550
include "p18f2550.inc"
org 0x000800 ; Starte Programm
goto init
org 0x000808 ; Interuptvector High
; call or goto blablub
org 0x000818 ; Interuptvector Low
; call or goto blablub
org 0x000828 ; Erste Rotine auf Adr. 0x820
cblock 0x00 ; Variabeln ab 0x00
t1 ; Delay
t2 ; Delay
t3 ; Delay
endc
#define WPAN PORTC,0 ; WPAN LED
#define WLAN PORTC,1 ; WLAN LED
#define WWAN PORTC,2 ; WWAN LED
include "portreg.inc" ; Ports einstellen (portreg)
include "delay.inc" ; Software Delays (delay)
;include "i2c.inc" ; I2C Routinen
init
call portreg ; Ports einstellen
main ; Mainschleife
bsf WWAN
call delay_1s
bcf WWAN
call delay_1s
goto main
end
delay.inc
delay_1s
movlw 0x6d
movwf t1
movlw 0x5e
movwf t2
movlw 0x1a
movwf t3
loop_1s
decfsz t1, 1
goto loop_1s
decfsz t2, 1
goto loop_1s
decfsz t3, 1
goto loop_1s
return
portreg.incportreg ; PORTA
movlw B'00000000' ; PortA I/O setzen (1=In, 0=Out) (Reinfolge RB7,RB6...)
movwf TRISA ; PortA I/O setzen
clrf PORTA
; PORTB
clrf PORTB ; PortB auf 0 setzen
clrf LATB ; Data Latch löschen
movlw B'00000011' ; PortB I/O setzen (1=In, 0=Out) (Reinfolge RB7,RB6...) (I2C Slave RB7/RB6 = input)
movwf TRISB ; PortB I/O setzen
movlw B'00001111' ; Alle I/0 Digital
movwf ADCON1
; PORTC
movlw B'00000000' ; PortC I/O setzen (1=In, 0=Out) (Reinfolge RC7,RC6...)
movwf TRISC ; PortC I/O setzen
clrf PORTC ; PortC auf 0 setzen
return
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.