In SX Microcontrollers, SX/B Compiler and SX-Key Tool, threepointone wrote: Alright, I've trimmed down on everything extraneous (there is a lot of code in here that's specific to how the sensor and LCD I use respond using the I2C protocol, just ignore that). I tested it again, and it's completely noticable--when the character count is a byte in an array, the program starts doing strange things (specifically, the measured capacitance will never update even though it's clearly not stuck in some outside loop and will still respond to button presses) I've attached a heavily condensed version of the code, and I'm pasting the specific code regions which seem to be the culprits. [code] LCD_TempStr Var Word LCDVars Var Byte(5) LCD_Temp1 Var LCDVars(0) LCD_TempHex Var LCDVars(1) LCD_TempHexChar Var LCDVars(2) LCD_TempCharCnt Var LCDVars(3) LCD_TempChar Var LCDVars(4) . . . LCD_DispChar: LCD_TempChar = __Param1 If __ParamCnt = 1 then LCD_TempCharCnt = 1 else LCD_TempCharCnt = __Param2 endif LCD_I2CStart LCD_DataMode Do LCD_I2CSend LCD_TempChar LCD_TempCharCnt = LCD_TempCharCnt - 1 if LCD_TempCharCnt = 0 then exit Loop LCD_I2CStop Return [/code] Sorry if the code's messy/unoptimized; I actually discovered this problem while I was trying to tidy it up and stuff everything I could into the array variable space, as I was running low on RAM before. A condensed form of the code is attached--basically, this dispChar subroutine is called by two other high level routines, RetHome (which basically writes spaces to the LCD and returns the cursor) and DispHex, which converts a variable into hex ascii. I'm completely stumped at the moment. Although I've been able to fix it, I really want to know why array variables won't work here--I don't see any obvious reasons. I've messed around with the order of the variables (since the variable causing problems just happens to be at the edge of a bank) and it didn't do anything. For some odd reason, adding pauses in the main code that calls all of the LCD writes makes it work (in a really strange manner)--this leads me to think that I've messed something up with my LCD_I2CSend routine and the acknowledgement bit, but I've been looking through the assembly and I can't seem to find anything wrong. Thanks for your assistance! ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=246928#m246994 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)