Altera_Forum
Honored Contributor
21 years agonew user needs help with var inits..
Hello,
I have a NIOS-1 design that I am having some trouble with. My tools are a bit dated, because I had to use NIOS-1 (because of the older FPGA on the board that I was forced to ue) -- So I am using SOPC builder 2.7 on Quartus 4.1 My problems are so silly that I am sure it is a reflection of my errors, and not the compiler itself. Anyway, Here is my problem.. I have an ISR that runs a PID loop for controlling a motor. The P,I,D and Total_output values are global floating point var’s that are updated in the ISR (run by a timer at 20 loops per second) . I print the value of the terms in the “foreground” – in a big while(1) loop that runs my rs-232 based command parser. I initially set all 4 values to zero in main(), before the ISR starts to run. If I print the values in the command parser I get a result that looks like “P=0 I=0 D=0 Total_output=NaN” What is this “NaN”? -- in addition, I have a command that I can execute that assigned all 4 vars to zero in the command parser, and then things start to work.. My question is why? Is there some issue that is causing the compiler to not assign the values to zero in main()? I have added the zero-assignments to other sections of the code as well, and none work, until I hit the one in the command parser.. Also, I am using nios-build to compile my code. Is there any way to change the optimization level with a command line arg to nios-build? Thank you, ---Lou lou@faustini.com ps: a bit more info... I am using the nios-1 EVB, booting from flash, and running out of ram.