I am converting my old digital camera into a time laps camera using an 8 bit dip switch on PortB of a 16F84A to set the delay between frames. I want to use the Sleep command for delay times longer than two seconds. PortA will control the camera trigger switch, and for longer delays the power switch is controlled. I thought my code looked good until I tried to compile… So much for looks!
I get these Errors in the Select Case portion of the code;
C/pbp/pbppic14.lib 47 : [226] Numeric Constant or Symbol Name Expected
C/pbp/pbppic14.lib 47 : [201] ‘)’ Expected
These two error lines show up numerous times in the Select Case portion of the code until the last line says “too many errors”.
I have looked over Select Case command and I can’t see any problem. DelayMode is a Variable for PortB; Smode is a Word Variable to be used with the Sleep command. Sleep command line is not committed in the error messages. Got Me!
I'm know I haven't set the Header yet but I don't think that should be a problem at this time. I hope someone can spot some stupid error I overlooked. Comments please!
Code:define osc 4 ; PowerSW var PortA.0 CameraTrig var PortA.1 DelayMode var PortB AVAR VAR BYTE ;General variable Bvar var byte SMode var word ;var holds convertion for sleep command MAXPIX VAR BYTE ;Maxumn number of pictues per memory available ; Set Hardware OPTION_REG.7=0 ' Enable Weak Pull-Ups ' TRISA=%00000000 ' PORTA all set to RA0-RA3 input, RA4-RA7 output TRISB=%11111111 ' PORTB all set to input ;XXXXXXXXXXXXXXX Main Program Area XXXXXXXXXXXXXX ; WEAK PULLUPS ??? MAXPIX=150 ;make adjustment to this number based on test of memory low PowerSW select case Delaymode ;MODE of delay based on input read case 1 ;one second mode bvar=1000 goto MODE1 case 2 ;two second mode Bvar=2000 goto MODE1 case 4 ;thirty second mode smode = 30 goto MODE2 case 8 ;one minute mode smode = 60 goto MODE3 case 16 ;five minute mode smode = 300 goto MODE3 case 32 ;15 minute mode smode = 900 goto MODE3 case 64 ;one hour mode smode = 3600 goto MODE3 case 128 ;three hour mode smode = 10800 goto MODE3 end select MODE1: FOR AVAR=1 TO MAXPIX ; from 1 to Maxumn number of pictues per memory available HIGH CameraTrig ;gate trigger PAUSE 10 ;time for trigger pulse to settle LOW CameraTrig ;clear trigger pause bvar NEXT AVAR goto Shutdown MODE2: ;uses Sleep command FOR AVAR=1 TO MAXPIX ; from 1 to Maxumn number of pictues per memory available HIGH CameraTrig ;gate trigger PAUSE 10 ;time for trigger pulse to settle LOW CameraTrig ;clear trigger sleep smode NEXT AVAR goto Shutdown MODE3: ;powers camera on and off each fram - uses Sleep command high PowerSW FOR AVAR=1 TO MAXPIX ; from 1 to Maxumn number of pictues per memory available HIGH CameraTrig ;gate trigger PAUSE 10 ;time for trigger pulse to settle LOW CameraTrig ;clear trigger low PowerSW sleep smode high PowerSW NEXT AVAR Shutdown: ;end program and go to low power end




Bookmarks