In SX Microcontrollers, SX/B Compiler and SX-Key Tool, spacejunk wrote: I am working on a minisumo robot, which I have named Panther. I finished a section of code I was working on and compiled the program. The compiler generated an error. It read: Line 159, Error 3, Pass 1: Variable exceed available RAM My problem is my program only uses 19 Bytes and 2 Bits of RAM. Is this more than the SX can handle? It seems to me that it should be able to take more. The data sheet suggests 262 Byte... I assume some of this is used by SX/B but there should be plenty left for my use. The error occurs at the AddressPointer Variable. Anyway, I have included the section of my code that deals with the variables and constants. It is very well commented. Any help with this issue would be appreciated... I have a feeling it is a simple thing that I'm missing. Code: [code] ' ========================================================================= ' ' File...... Main#.SXB ' Purpose... Panther Mini Sumo ' Author.... Lee Szuba ' E-mail.... [url=spacejunk@magma.ca]spacejunk@magma.ca[/url] ' ' ========================================================================= 'NOTES (To Do) 'Hardware 'Electrical 'Software 'Done ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX48, OSCHS1 FREQ 20_000_000 ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- 'Motor Pins PWMPinR PIN RD.1 'Pin used by interrupt, right motor PWMPinL PIN RD.2 'Pin used by interrupt, left motor DirPinR PIN RD.0 'Direction pins, set 1 for forward, 0 for reverse DirPinL PIN RD.3 'Line Sensor Pins rLine PIN RB.3 SCHMITT 'Right line sensor, active high lLine PIN RB.6 SCHMITT 'Left line sensor, active high 'Object Sensor Pins lSeek PIN RB.7 'Left front object sensor, active low rSeek PIN RB.4 'Right front object sensor, active low lSideSeek PIN RE.1 'Left side object sensor, active low rSideSeek PIN RE.0 'Right side object sensor, active low 'Close Proximity Sensors FrontProx PIN RB.5 'Front ProxDot, active low BackProx PIN RD.7 'Rear ProxDot, active low 'Control Buttons StartButton PIN RA.2 'Press to start routine (top button) NextButton PIN RA.3 'Cycle routines (bottom button) 'I2C EEPROM Pins SDA PIN RD.4 'Data line SCL PIN RD.5 'Clock out 'ADC SPI Pins 'ADC pinout incorrect, currently not used 'CS pin needs to be controlled, in Rev. G, tied to VSS 'Fixed in current circuit (Rev. H) design CLK PIN RE.2 'Clock signal Dout PIN RE.3 'Data out pin Din PIN RE.4 'Data in pin 'Accelerometer Pins Yacl PIN RB.0 'Y axis, pulse width Xacl PIN RB.1 'X axis, pulse width 'Serial Out (RS232 level) For Debugging RX PIN RA.1 'Serial debug recieve TX PIN RA.0 'Serial debug transmit 'Unused Pins RB_Unused PIN RB.2 PULLUP 'Set weak internal pullups RD_Unused PIN RD.6 PULLUP RE_Unused1 PIN RE.5 PULLUP RE_Unused2 PIN RE.6 PULLUP RE_Unused3 PIN RE.7 PULLUP ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- Baud CON "N38400" 'Serial Baud rate, 38400, Inverted True CON 1 'Constants used by state machine False CON 2 ' ------------------------------------- ' Seven Segment Numbers ' ------------------------------------- 'Table of seven segment display numbers 'Zero is on, one is off NumberOne CON %01011111 NumberTwo CON %00100011 NumberThree CON %00000111 NumberFour CON %01001101 NumberFive CON %10000101 NumberSix CON %10000001 NumberSeven CON %00011111 NumberEight CON %00000001 NumberNine CON %00001101 NumberZero CON %00010001 LetterP CON %00101001 LetterD CON %01000011 ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- PWMCount VAR Byte 'PWM variables, used by interrupt PWMValueR VAR Byte PWMValueL VAR Byte Temp VAR Byte 'General work/counter SensFlags VAR Byte 'Order (LSB first) - Edge_L, Edge_R, Obj_L, Obj_R, Obj_LS, Obj_RS, Prox_F, Prox_R CurPos VAR Byte 'Seven segment display work variables CurNum VAR Byte 'DirR VAR Bit Currently unused, may be used to improve motor control 'DirL VAR Bit DebugByte VAR Byte temp1 VAR Byte 'Subroutine work vars temp2 VAR Byte temp3 VAR Byte temp4 VAR Byte temp5 VAR Byte temp6 VAR Bit CurrentState VAR Byte 'State machine current state variable NextState VAR Byte 'State machine next state variable, used for transitions CycleCount VAR Byte 'State machine cycle counter, used for timeing InitState VAR Bit 'State machine initiate state flag, 1 when state change LineFlagL VAR SensFlags.0 'SensFlags Var broken out into individual variables LineFlagR VAR SensFlags.1 ObjFlagL VAR SensFlags.2 ObjFlagR VAR SensFlags.3 ObjFlagSL VAR SensFlags.4 ObjFlagSR VAR SensFlags.5 ProxFlagF VAR SensFlags.6 ProxFlagR VAR SensFlags.7 AddressPointer VAR Byte AddressVal VAR Word [/code] Thank you, Lee Szuba ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=305715 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)