AtomSoft
Well-Known Member
This is so confusing this is basically my setup but its on RB1
**broken link removed**
This is the code im trying to use or well trying to correct. Can someone help. Im using a junebug (you prob know by now) as my Test Circuit and connecting RB1 from side pins to my switch.
**broken link removed**
This is the code im trying to use or well trying to correct. Can someone help. Im using a junebug (you prob know by now) as my Test Circuit and connecting RB1 from side pins to my switch.
Code:
list p=18F1320
include <p18F1320.inc>
CONFIG OSC = INTIO2, WDT = OFF, LVP = OFF
LED macro x,y ;MACRO LED <PORTA>, <TRISA>
movlw x
movwf LATA ;LATA = x
movlw y
movwf TRISA ;TRISA = y
call Delay ;call the Delay subroutine
endm ;end macro
Count equ 0 ;delay loop counter
org 0x00 ; reset vector
goto Main
org 0x08 ; ISR Low vector
goto ISR
org 0x18 ; ISR Low vector
goto ISR
Main
; bsf ADCON1,0 ;make RA0 digital
CLRF PORTB ;Initialize PORTB by clearing output data latches
CLRF LATB ;Alternate method to clear output data latches
MOVLW b'00000001'
MOVWF ADCON1
MOVLW b'11010101'
MOVWF ADCON0
MOVLW b'00010011'
MOVWF ADCON2
MOVLW b'11001111'
MOVWF TRISB
MOVLW b'11111000'
MOVWF INTCON
MOVLW b'01110000'
MOVWF INTCON2
MOVLW b'00011000'
MOVWF INTCON3
MOVLW b'01000000'
MOVWF PIE1
LED1 LED b'00000001',b'10111110'
LED2 LED b'01000000',b'10111110'
LED3 LED b'01000000',b'00111111'
LED4 LED b'10000000',b'00111111'
LED5 LED b'10000000',b'01111110'
LED6 LED b'00000001',b'01111110'
goto LED1 ;loop forever
Delay decfsz Count,f ;decrement Count and skip when zero
goto $-2 ;not zero? repeat
return
ISR BCF INTCON3, 0
BCF INTCON3, 1
BCF INTCON, 0
BCF INTCON, 1
BCF INTCON, 2
call Delay
LED b'00000001',b'01111110'
call Delay
BSF ADCON0, 1
Loop1 BTFSC ADCON0, 1
goto Loop1
call Delay
call Delay
retfie
END