Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
; *** Junebug 18F1320 LED sequencer demo ***
; Flashes LEDs1 thru 6 from left to right forever
; DIP Switch (SW6) must have TUTOR on (SW6-1,2,3) all other switches off
list p=18F1320
include <p18F1320.inc>
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF
org 0x000 ; RESET vector
; INIT
INIT movlw 0x72 ; 8MHz OSC
movwf OSCCON
movlw 0x7F
movwf ADCON1 ; Set to all digital
movlw b'00111111'
movwf TRISA
movlw b'01111111'
movwf PORTA
movlw b'00100101'
movwf TRISB
bcf INTCON2,RBPU ; Enable pullups
MAIN btfss PORTB,RB2 ; is button #2 pressed?
goto LED3 ; yes?
LED4 movlw b'10000000'
movwf PORTA ; LED4 on, 3 off
goto MAIN
LED3 movlw b'01000000' ; RB2 pressed
movwf PORTA ; LED3 on, 4 off
goto MAIN
END
; *** Junebug 18F1320 LED sequencer demo ***
; Flashes LEDs1 thru 6 from left to right forever
; DIP Switch (SW6) must have TUTOR on (SW6-1,2,3) all other switches off
list p=18F1320
include <p18F1320.inc>
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF, DEBUG = ON
org 0x000 ; RESET vector
; INIT
INIT
movlw 0x72
movwf OSCCON ; Speed the clock
movlw 0x7F
movwf ADCON1 ; Set to all digital
movlw b'01111110'
movwf TRISA
movlw b'00000001'
movwf PORTA
movlw b'00100101'
movwf TRISB
bsf INTCON2,RBPU ; Set pullups
MAIN
btfss PORTB,RB2 ; Is button 2 pressed?
goto LED6 ; Yes?
movlw b'10000000'
movwf PORTA
goto MAIN
LED6 movlw b'00000001'
movwf PORTA
goto MAIN
END