In SX Microcontrollers, SX/B Compiler and SX-Key Tool, p.realacci wrote: Hi, I think I've found two problems with the SXB compiler v. 1.51.03 when used with the SX48 chip. First problem: The I2CSTOP function modifies the data direction register of the port associated with the SDA and SCL lines. Example: SDA var ra.0 SCL var ra.1 The function I2CSTOP SDA may randomly change the direction of the lines RA.2 and RA.3 This happens because the compiled code loads the tris_a register with the value in __PARAM1. Suggested workaround: Initialize __PARAM1 with the value of the tris_a register before calling I2CSTOP e.g. __param1 = tris_a I2CSTOP SDA Second problem: The interrupt routine does not preserve the value of __PARAMCNT (which shares the register __PARAM5). As a result, if, from the interrupt, you call a subroutine with a variable number of parameters, you can get unexpected results from your code. Suggested workaround: Use the following code: INTERRUPT NOCODE ASM CLR FSR MOV __INTPARAMFSR,__PARAM1 MOV __INTPARAMFSR+1,__PARAM2 MOV __INTPARAMFSR+2,__PARAM3 MOV __INTPARAMFSR+3,__PARAM4 MOV __INTPARAMFSR+4,__PARAM5 ; ENDASM BANK ....your interrupt code ASM CLR FSR MOV __PARAM1,__INTPARAMFSR MOV __PARAM2,__INTPARAMFSR+1 MOV __PARAM3,__INTPARAMFSR+2 MOV __PARAM4,__INTPARAMFSR+3 MOV __PARAM5,__INTPARAMFSR+4 ENDASM RETURNINT ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=321846 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)