Error[113] TEMPLATE\CODE\MYCODE.ASM 18 : Symbol not previously defined (osccan)
list p=pic16f737
#include <P16F737.inc> ; processor specific variable definitions
radix hex
;
__CONFIG _CONFIG1, _CP_OFF & _CCP2_RB3 & _DEBUG_OFF & _VBOR_2_0 & _BOREN_0 & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _INTRC_IO
__CONFIG _CONFIG2, _BORSEN_0 & _IESO_OFF & _FCMEN_OFF
;------------------------------------------------------------
;=============Pedalboard PIC code JFETs===============2009 08 26===
list p=pic16f737
#include <P16F737.inc> ; processor specific variable definitions
radix hex
;
__CONFIG _CONFIG1, _CP_OFF & _CCP2_RB3 & _DEBUG_OFF & _VBOR_2_0 & _BOREN_0 & _MCLR_ON & _PWRTE_ON & _WDT_OFF & _INTRC_IO
__CONFIG _CONFIG2, _BORSEN_0 & _IESO_OFF & _FCMEN_OFF
;------------------------------------------------------------
; Counter locations
dbcount equ 0x21
dc1 equ 0x22
;------------------------------------------------------------
org 0x000
;
;Initialization
start bsf osccan,ircf2 ;set int osc 110=4Mhz
bsf osccan,ircf1
bcf osccan,ircf0
bsf adcon1,pcfg3 ;make all pins digital I/O
bsf adcon1,pcfg2
bsf adcon1,pcfg1
bsf adcon1,pcfg0
movlw 0xf8 ;load w with 11111000
tris porta ;make RA0-RA4 inputs,RA5-RA7 outputs
movlw 0xff ;load w with 1's
tris portb ;make portb inputs
bcf option_reg,7 ;enable portb pullups
movlw 0x00 ;load w with 0's
tris portc ;make portc outputs
bsf porta,6 ;output hi RA6 - mute on
nop
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
movlw 0xaa ;load w with 10101010
movwf portc ;all effects bypassed
bcf porta,6 ;output lo RA6 - mute off
;Main Program
switch btfss porte,3 ;bypass switch hi?
goto bypass ;no - swtich pressed
btfss porta,0 ;comp vb switch hi?
goto compvb ;no - switch pressed
btfss porta,1 ;comp switch hi?
goto comp ;no - switch pressed
btfss porta,2 ;flanger switch hi?
goto fl ;no - switch pressed
btfss porta,3 ;chorus switch hi?
goto chorus ;no - switch pressed
btfss porta,4 ;delay switch hi?
goto delay ;no - switch pressed
btfss portb,0 ;comp delay switch hi?
goto compdly ;no - switch pressed
btfss portb,1 ;comp flanger switch hi?
goto compflanger ;no - switch pressed
btfss portb,2 ;ch delay switch hi?
goto chdelay ;no - switch pressed
btfss portb,3 ;clch delay switch hi?
goto clch delay ;no - switch pressed
btfss portb,4 ;cl flanger switch hi?
goto clflanger ;no - switch pressed
btfss portb,5 ;cl chorus switch hi?
goto clchorus ;no - switch pressed
btfss portb,6 ;clean switch hi?
goto clean ;no - switch pressed
btfss portb,7 ;comp delay vb switch hi?
goto compdlyvb ;no - switch pressed
goto switch ;check all switches again
; Switch Actions
;
bypass ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc porte,3 ;if button up (RE3 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
nop
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
movlw 0xaa ;load w with 10101010
movwf portc ;all effects bypassed
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss porte,3 ;if button down (RE3 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
compvb ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc porta,0 ;if button up (RA0 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'01101010'
movwf portc ;turn comp on
bcf porta,5 ;output lo RA5 - vb on
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss porta,0 ;if button down (RA0 = lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
comp ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc porta,1 ;if button up (RA1 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'01101010'
movwf portc ;turn comp on
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss porta,1 ;if button down (RA1 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
flanger ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc porta,2 ;if button up (RA2 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'10011010'
movwf portc ;turn flanger on
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss porta,2 ;if button down (RA2 = lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
chorus ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc porta,3 ;if button up (RA3 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'10100110'
movwf portc ;turn chorus on
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss porta,3 ;if button down (RA3 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
delay ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc porta,4 ;if button up (RA4 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'10101001'
movwf portc ;turn delay on
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss porta,4 ;if button down (RA4 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
compdelay ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc portb,0 ;if button up (RB0 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'01101001'
movwf portc ;turn comp and delay on
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss portb,0 ;if button down (RB0 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
compflanger ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc portb,1 ;if button up (RB1 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'01011010'
movwf portc ;turn comp and flanger on
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss portb,1 ;if button down (RB1 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
chdelay ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc portb,2 ;if button up (RB2 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'10100101'
movwf portc ;turn chorus and delay on
bsf porta,5 ;output hi RA5 - vb off
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss portb,2 ;if button down (RB2 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
clchdelay ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc portb,3 ;if button up (RB3 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'10100101'
movwf portc ;turn chorus and delay on
bsf porta,5 ;output hi RA5 - vb off
nop
bcf porta,7 ;output lo RA7 - clean channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss portb,3 ;if button down (RB3 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
clflanger ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc portb,4 ;if button up (RB4 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'10011010'
movwf portc ;turn flanger on
bsf porta,5 ;output hi RA5 - vb off
nop
bcf porta,7 ;output lo RA7 - clean channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss portb,4 ;if button down (RB4 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
clchorus ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc portb,5 ;if button up (RB5 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'10100110'
movwf portc ;turn chorus on
bsf porta,5 ;output hi RA5 - vb off
nop
bcf porta,7 ;output lo RA7 - clean channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss portb,5 ;if button down (RB5 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
clean ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc portb,6 ;if button up (RB6 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'10101010'
movwf portc ;turn chorus and delay on
bsf porta,5 ;output hi RA5 - vb off
nop
bcf porta,7 ;output lo RA7 - clean channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss portb,6 ;if button down (RB6 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
compdlyvb ; debounce switch down
db_down movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
dn_dly incfsz dc1,f ;delay 256x3 = 768us
goto dn_dly
btfsc portb,7 ;if button up (RB7 hi),
goto db_down ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto dn_dly
; actual switching
bsf porta,6 ;turn mute on
movlw b'01101001'
movwf portc ;turn comp and delay on
bcf porta,5 ;output lo RA5 - vb on
nop
bsf porta,7 ;output hi RA7 - lead channel on
call mutedelay ;mute for 2ms
bcf porta,6 ;turn mute off
; debounce switch up
db_up movlw 0x0d ;max count = 10ms/768us = 13 = 0x0d
movwf dbcount
clrf dc1 ;reset dc1
up_dly incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
btfss portb,7 ;if button down (RB7 lo),
goto db_up ; restart count
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
goto switch ;check switches again
;-----------------------------------------------------------------------------
; mutedelay - 2ms delay
;
mutedelay movlw 0x03 ;max count = 2ms/768us = 3
movwf dbcount
clrf dc1 ;reset dc1
incfsz dc1,f ;delay 256x3 = 768us
goto up_dly
decfsz dbcount,f ;else repeat until max count is reached
goto up_dly
return
end
Yes, that is the proper way to implement the inc file by using the #include.
porta equ 0x05
The TRIS PORTA is only valid for 12bit core PICs. You movwf TRISA with 14bit core PICs. You also have to set the bank first.
That was my understanding too, but if it has the equates, why do I get the 'Symbol not previously defined (porta)' errors? Is the inc file just to show you how to lay out the statements or does it actually replace the equ statements?
Thanks
movlw 0x00
bsf STATUS, RP0
movwf TRISA
movwf TRISB
bcf STATUS, RP0
movlw 0xFF
movwf PORTA
movwf PORTB
They are defined in upper case in the include file so porta should be PORTA.
movlw 0x00
bsf STATUS, RP0 ;select bank 1
movwf TRISA ;make porta ouputs
movwf TRISB ;make portb ouputs
bcf STATUS, RP0 ; select bank 0
movlw 0xFF
movwf PORTA ;set porta outputs hi
movwf PORTB ;set portb outputs hi
tempus ...cursed case sensitivity.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?