Code hangs with illegal bP 9S12 with CW3.1

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Code hangs with illegal bP 9S12 with CW3.1

2,011 次查看
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.
标签 (1)
0 项奖励
回复
1 回复

693 次查看
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 项奖励
回复