Hi Alexandar.
Still I've the problem on a integer between subctraction of 2 words. Still sometime (sic!) I obtain 65535 instead of -1 (what normally happen)
now, I've got also another mathematical problem
Code: Select all
sub function Ars_Update (dim byref filtredata as Filtred, dim byref angle_m as float) as float
dim y as float
dim bypass0, bypass1, bypass2 as longint
y = angle_m - filtredata.Xangle
S = float(filtredata.P_00 + filtredata.Rangle)
if S = 0 then
LATF.7 = 1
end if
'bypass2 = longint(S*1000000)
'bypass0 = longint(filtredata.P_00 * 1000000)
'bypass1 = longint(filtredata.P_10 * 1000000)
' Divider0 = Divide(filtredata.P_00,S)
'Divider1 = Divide(filtredata.P_10,S)
'Divider0 = bypass0/bypass2
'Divider1 = bypass1/bypass2
'Divider1 = float(filtredata.P_10 / S)
Divider0 = float(filtredata.P_00 / S)
Divider1 = float(filtredata.P_10 / S)
'Divider0 = 1 'filtredata.P_00 / S
' Divider1 = 1 'filtredata.P_10 / S
' K0 = filtredata.P_00 / S
' K1 = filtredata.P_10 / S
filtredata.XAngle = filtredata.Xangle + (Divider0*y)
filtredata.XBias = filtredata.XBias + (Divider1*y)
filtredata.P_00 = filtredata.P_00 - (Divider0 * filtredata.P_00)
filtredata.P_01 = filtredata.P_00 - (Divider0 * filtredata.P_01)
filtredata.P_10 = filtredata.P_10 - (Divider1 * filtredata.P_00)
filtredata.P_11 = filtredata.P_11 - (Divider1 * filtredata.P_01)
result = filtredata.XAngle
end sub
in this division
Code: Select all
Divider0 = float(filtredata.P_00 / S)
I obtain, basically a NaN.
Now... the first logical approach was.... S=0 than NaN but the other division are done rergulary.
second. The bit LATF.7 (LV24/33 dsPic 33FJ128MC710, 10 MHz crystal x8 PLL) NEVER is set to 1
third, I'm a damned bulldog with the problems. than I've add that :
Code: Select all
sub procedure MathError org $0C
LATA.1 = 1
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
if INTCON1.14 then
end if
end sub
and LATA.1 NEVER go on.....
than my first impressione is
a) that isnn't a division by zero
b) isn't a processor mathematical error (the error trap don't work)
c) than or is a my bloody error (but seems to dont see a pink elephant) or will bhe a compiler error..
Thanks in advance for your kind help