Code hangs with illegal bP 9S12 with CW3.1

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Code hangs with illegal bP 9S12 with CW3.1

1,694 Views
JohnnyP
Contributor III
Hi:

I'm debugging the proportional part of a PID controller with a P&E USB pod connected to the target. It runs until I adjust one of the variables "too far", then hangs with an illegal bp.

The code is in an interrupt routine, so I copied it into a new project with no interrupts and it runs on the simulator, taking the appropriate branches when I adjust the variables.

Back to the target. I copied and pasted the code to the top of my program, disabled interrupts, and commented out the branches in the original code. It runs as before, then hangs with illegal bp when I adjust one of the variables beyond a certain point.

How to tell where the program is going? I didn't set any breakpoints.
Labels (1)
0 Kudos
Reply
1 Reply

376 Views
JohnnyP
Contributor III
Ok, found my problem. Rookie move.

I set my proportional gain to three, so I saved the error voltage on the stack, did an ASLA and checked for overflow, then PUlB to do an ABA. Forgot to fix the stack if it branched.
0 Kudos
Reply