- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to pass an integer through multiple conversions.
i placed an integer counter (mone) of 0 to 9 Which i control with a push button(that act as a clock_in). i basically need every time that i get a new integer(0 to 9) lets say 3 for example to multiply by 0.000305(same as 61/200000). and then convert the result integer to std_logic_vector 16bit. it eventually will go to an D/A the has a resolution of 2^15. the code is fine if i run compilation. but don't see the result in the simulation waveform. or in the leds in my cyclone 2. you can see the code and the simulation waveform in the photos attached . hlap me please.Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
when you say result <= temp2 * (61/200000): do you know what it settles to? or rather if you do it by hand what is 3 * 61/200000? is'nt it < 1
so how to expect <1 to go on 15bit bus? in short you need to scale up the value 0.000305 to your 15 bit resolution.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you you are right
i originally wrote it like this 3/0.000305 and the result is >0 but quartus does not let me write it like this so i did it like this 3/(61/200000). i think i forgot to place "/" between them/ do you think that it might fix it? so do you have any other suggestions?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
61/200000 = 0.000305
I think 3/0.000305 is not same as 3*.000305 so which way you want to go?- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Let go with
3/(61/200000) The result is bigger the 0- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok then you have range 0~9 from counter (in fact your code is 0~8 for calculation logic)
now 1/0.000305 = 3279 so multiply each count value by 3279 and you will get 0~26232 or if 0~9 will need 0~29511 so you are lucky now since 15 bits covers 0~32767- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want an alternative you can avoid the mult and now use:
count <= count + 3279 then pass it to the DAC- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks man I'll try it and write here if it worked

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page