Another Maths Problem

General discussion on mikroBasic for dsPIC30/33 and PIC24.
Post Reply
Author
Message
tomreeves84
Posts: 41
Joined: 05 Dec 2005 16:26

Another Maths Problem

#1 Post by tomreeves84 » 19 Jan 2006 16:45

I think i found another bug! I tested this on a easydsPIC2 board.

Code: Select all


Dim t1 as float

t1 = 2 * cos(pi) ' this should be -2

Main:
TRISB = $0000
TRISF = $0000
if t1 < -1.9 then LATB = $0001
end if
If t1 > -2.1 then LATF = $0001 
end if

end.

both LED's should be on but on one of them lights

I tried splitting it up as shown below which made it work

Code: Select all


Dim t1 as float
Dim temp as float

temp = cos(pi)
t1 = 2 * temp ' this should be -2

Main:
TRISB = $0000
TRISF = $0000
if t1 < -1.9 then LATB = $0001
end if
If t1 > -2.1 then LATF = $0001 
end if

end.

According to the debugger both methods worked but only the second actually worked on the chip. A problem that i got when i used the second method throughout my main program was that it didnt start, or it just kept on making the program reset. Any ideas what could cause this as my code ran through fine on my chip before i fixed all the cosine and sine's in it, but it just produced the wrong answer. Unfortunetly i cant put to much of my source code on here as it is for work. Any help will be very appreciated

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: Another Maths Problem

#2 Post by zristic » 19 Jan 2006 17:29

Will be checked/repaired. Thanks.

tomreeves84
Posts: 41
Joined: 05 Dec 2005 16:26

#3 Post by tomreeves84 » 20 Jan 2006 11:29

Do you know how long it will take to check/ fix this problem? Unfortunetly it has become a matter of urgency for me as i need to complete some work which this problem effects fairly quickly. Also Have you got any idea on what may be causing my chip to reset when i try and fix this problem? I can email you some of my source code if it will help.

Thanks in advance

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#4 Post by zristic » 20 Jan 2006 14:01

It will take some time, at least 30 days.

You are free to email me the code (zristic@mikroe.com).

Post Reply

Return to “mikroBasic for dsPIC30/33 and PIC24 General”