Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Possible bug?

Status
Not open for further replies.

SwingeyP

Member
Whilst working on my DDS digital VFO I have been trying to get the AD9850 working (see other posts).

I have the formula working now and delivering what I expect each time. I checked the variable value in the watch window. However when I select display hex values in that window I get a very weird result. Is this a Bug?

Cheers - Paul
 

Attachments

  • Bug.png
    Bug.png
    26.1 KB · Views: 341
hi Paul,
Dont forget your Fout is Dimmed as Single Value

The Hex value
9A68A71D == 2590549789 decimal
Are your two screen shots taken for the same sim run conditions.?

I would suggest you put a known Hex dummy value in Fout just after the actual Fout has been calculated by the program.
Then use Watch in Hex and then Decimal, see if its what you expected

Eric
 
Last edited:
hi Paul,
The Watch seems to miss some values.???
I have put some dummy values in fout followed by a Break, look at the Watch value I get.?
E
 

Attachments

  • AAesp03.gif
    AAesp03.gif
    18.1 KB · Views: 341
ericgibbs and SwingeyP I do not get this... The long data variable isn't big enough to do the calculation..

I know you are using a single for fout, but the calculation 7Mhz + 10khz + 6hz * 125mhz cannot be calculated this way.. as the containers for the calculation are longs... Or am I missing something!!!
 
Hello Ian,

Yes sorry about that. The calculation was all wrong as pointed out by another forum member.
It's now like this .....

ad9850_freq = ad9850_mhz + ad9850_khz + hz
fout = ad9850_freq * 34.3597383 '7 - I left the 7 off as it's too long.

Cheers - Paul
 
hi Paul,
In your program I changed fout to LONG
and then changed this bit of code.
Try it and use Watch, run it and lets see if you get the same as me,, no fout increment

Code:
ad9850_freq1 = ad9850_mhz + ad9850_khz + hz
ad9850_freq2 = ad9850_freq1 * 125000000
''fout = ad9850_freq2 / 4294967295  '-1 OR 32BIT OVERFLOW!!
fout = fout + 1000
 
SwingeyP said:
Yes sorry about that. The calculation was all wrong as pointed out by another forum member.
It's now like this .....

Yes it was me in the other thread... Glad it sorted.. I'll watch from a distance as Eric seems to have this in hand!!!
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top