In SX Microcontrollers, SX/B Compiler and SX-Key Tool, p.realacci wrote: Hello, I'm having a very strange problem with the SX48. I'll try to explain what's happening: The chip is used to control a disc loading robot with two DC motors, one solenoid and four optical sensors. The program is written in SXB, and uses a small time-based ISR written in assembler. Here is the description of the problem: The program uses a subroutine (MoveToPosition_Y) that moves vertically the loading arm until it reaches certain position. This subroutine calls the "Move_V" subroutine which gives power to the motor and programs a timer in PWM mode for the speed control. The problem is that "Move_V" is never called from the MoveToPosition_Y sub. Using the debugger, I've inserted a break-point in the compiler generated code where the jump to the actual address of Move_V is coded. I've attached a picture that shows the status of the registers as soon as the break-point pops up. As you can see, the last executed instruction should be "PAGE 800", but the STATUS register does not have the correct value, and points instead to a wrong page. As a result, the following jump instruction loads the PC with the wrong address. The strange thing is that if I insert a NOP at any point in the code before calling the Move_V sub, the program works perfectly. I'm really getting crazy because I cannot find out the cause of this strange behavior. I'm using the SX-Key ver. 3.2 SASM DLL ver. 1.51.07 SX-B ver. 1.51.03 SXSim ver. 2.08.05 Does anybody have an idea? I can post the full source code if needed. Thank you. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=257881 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)