I would ask some help/suggestion because I am new with PIC32MZ. I am developping a custom board with some inertial MEMS sensors. I am moving to MZ from DSPIC33EP. Now I am debugging the board but I am blocked for some inexpicable reason. The code is quite long but basically the program (after the initialization) jumps into a loop to let a led blinking. into the loop I have some procedures. In one of them I use a GOTO to jump to the end of procedure and see where the program do strange things.
Code that is working:
Code: Select all
'X
word_appo = accelerometer_x_word 'and %1000000000000000
goto fine_get_data_da_gyro 'jump to the end of procedure
if word_appo <= 32767 then
accelerometer_x = accelerometer_x_word / 1024.0
else
word_appo = not accelerometer_x_word
word_appo = word_appo + 1
accelerometer_x = word_appo / (-1024.0)
end if
Code that doesn't work
Code: Select all
'X
word_appo = accelerometer_x_word 'and %1000000000000000
if word_appo <= 32767 then
goto fine_get_data_da_gyro 'jump to the end of procedure
accelerometer_x = accelerometer_x_word / 1024.0
else
word_appo = not accelerometer_x_word
word_appo = word_appo + 1
accelerometer_x = word_appo / (-1024.0)
end if
basically when I force to execute the "IF", the program stop and the led stop to blink. I got the same problem if I introduce a floating point operation (example: accelerometer_x = accelerometer_x_word / 1024.0).
Any idea about why this line block the program? thanks very much