In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Professorwiz wrote: High all, I'm writing one of my first larger programs for the SX, it's not huge but I'm getting this error Line 238, error 44, pass2: Address 295 is not within lower half of memory page Here's the program.. Sorry for the poor programming syntex I am working on it. Any help would be appriciated. I think one of the first things to do is make a subroutine for the pause command. Other than that? Russ ' ========================================================================= ' ' File...... PhotoTimer ' Purpose... Help take time lapse photos ' Author.... Russell Wizinsky ' E-mail.... [url=russw@professorwiz.com]russw@professorwiz.com[/url] ' Started... 4/16/07 for the Basic stamp ' revision.. 8/20/07 for the Parallax SX Chip ' Updated... 8/26/07 ' ========================================================================= ' ------------------------------------------------------------------------- ' Program Description ' ------------------------------------------------------------------------- ' Program will close shutter switch at set timed intervals. ' One button will adjust the timing, ' timing will be shown as a number 0-9 on the 7 segment display ' When start button is depressed camera will start taking photos ' When start button is depressed again. Camera will stop and ' 7 segment display will flash out count of how many pictures it took ' until the adjust button is pressed again. ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX28, OSC4MHZ, TURBO, STACKX, OPTIONX FREQ 4_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- 'RC Pins for Output for 7 Segment Display 'RB0 Pin for Pushbutton for start 'RB1 Change timing of shutter 'RB2 Output for Test LED 'RB3 Solid state Cmos switch Segments PIN RC output '7 Segment display StartButton PIN RB.0 INPUT 'PushButton Switch TimeButton Pin RB.1 Input 'PushButton Switch Shutter Pin RB.2 output 'Output to Cmos switch ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- ISPRESSED CON 1 'FOR ACTIVE-HIGH INPUT ISNOTPRESSED CON 0 ISOpen Con 1 'Shutter is opened IsClosed Con 0 'Shutter is closed ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- idx VAR BYTE ' Index for Data of 7 Segment display counter VAR Word ' timing variable time VAR Word ' variable for rc time del1 VAR Word ' Delay Variable pics VAR Word ' Number of pictures taken ' ========================================================================= PROGRAM Start ' ========================================================================= ' ------------------------------------------------------------------------- ' PROGRAM CODE ' ------------------------------------------------------------------------- Start: 'gosub DisplayTiming Do read dig_map + counter, segments If TimeButton = ispressed then do loop until TimeButton = isnotpressed Inc counter If counter = 10 then counter = 0 Endif Pause 250 EndIf loop until StartButton = ispressed Do loop until StartButton = isnotpressed 'Don't start until button is released gosub calctime 'Calculate time between pictures gosub takepics 'Trigger the shutter at calcuated time gosub dispcount 'Display how many pictures where taken Pause 1000 goto start ' ------------------------------------------------------------------------- ' SUBROUTINES ' ------------------------------------------------------------------------- calctime: 'Caclulate time between frames selected by pushbutton IF counter = 0 THEN del1 = 1 'Time interval 1 sec ENDIF IF counter = 1 THEN del1 = 2 'Time interval 2 sec ENDIF IF counter = 2 THEN del1 = 3 'Time interval 3 sec ENDIF IF counter = 3 THEN del1 = 5 'Time interval 5 sec ENDIF IF counter = 4 THEN del1 = 10 'Time interval 10 sec ENDIF IF counter = 5 THEN del1 = 20 'Time interval 20 sec ENDIF IF counter = 6 THEN del1 = 30 'Time interval 30 sec ENDIF IF counter = 7 THEN del1 = 50 'Time interval 50 sec ENDIF IF counter = 8 THEN del1 = 100 'Time interval 100 sec ENDIF IF counter = 9 THEN del1 = 120 'Time interval 120 sec ENDIF RETURN TakePics: 'Trigger the shutter at calcuated time Do Shutter = ISOpen pause 50 Shutter = ISClosed pause del1 loop until StartButton = ispressed RETURN DispCount: 'Display how many pictures where taken RETURN ' ------------------------------------------------------------------------- ' end of form ' ------------------------------------------------------------------------- 'data ' ------------------------------------------------------------------------- DIG_MAP: ' BAFG.CDE DATA %11100111 '0 DATA %10000100 '1 DATA %11010011 '2 DATA %11010110 '3 DATA %10110100 '4 DATA %01110110 '5 DATA %01110111 '6 DATA %11000100 '7 DATA %11110111 '8 DATA %11110110 '9 ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=211027 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)