Nick Mulder Posted April 13, 2007 Report Share Posted April 13, 2007 Hi,I would like to build an device that provides a %50 cycle 0-5v square wave (easy!) - that has a range of frequencies that can be directly inputted from 100.0 Hz to 10,000.0 Hz (harder!) - I would like the 0.1 increments if possible ...I've played around with a microcontroller called the ooPIC but that always works in terms of setting the cycle period - because of this the frequency is always at the mercy of the resolution of the cycle period and I cannot achieve specification I outlined above...The device here:http://www.duallcamera.com/store/items/SpeedControls/MilliframeController.shtml is what I am attempting to emmulate...It has a decimal rotary wheel 'thingy' on the front where the user simply enters the Hz required and then away it goes... How is this done ?I was thinking that something like a Voltage to Frequency chip would be the go like the LM331 URL=http://cache.national.com/ds/LM/LM231.pdf - and maybe an array of adjustable vRegs that switches would add or remove resistance to achieve the voltage required (probably some nicrome wire involved) - there would be one Vreg and ten resistors per decimal point if you get what I mean ? all connected in series (or not, depending on the switch state)Bulky!I would/could also have the option of putting on a Adj Vreg that could sweep all the speeds required and some sort of feedback as to what speed it was set at via a microcontroller (like the ooPIC which I have here working) and an LCD - so the ooPIC would just be reading the freq as opposed to setting it (which I've had issues with in terms of resolution) - I'm still yet to figure out if it can read things with the res I need - I hope it can as I dont want to walk around with a scope! :PIf I did this I would probably have a course adj Vreg and a fine adj Vreg so I'm not having to nudge the pot with ever so delicate fingers... Any suggestions appreciated ! I'm open to a totally different system if you have one in mind as I'm sure there many ways to do this ... ;)[shadow=red,left]Nick[/shadow] Quote Link to comment Share on other sites More sharing options...
AN920 Posted April 14, 2007 Report Share Posted April 14, 2007 One way to do it is make a frequency synth with a range 1000 - 100000 Hz that can be incremented 1 Hz. Then divide the output by 10 to give a range of 100.0 - 10000This can be under uP control or BCD thumbwheel switchesLook at the CD4059 it may just what you are looking forhttp://www.ee.washington.edu/stores/DataSheets/cd4000/cd4059.pdf Quote Link to comment Share on other sites More sharing options...
Nick Mulder Posted April 14, 2007 Author Report Share Posted April 14, 2007 Okidoki - I've found some BCD thumbwheels locally: http://www.jaycar.co.nz/productView.asp?ID=SR1250&CATID=&keywords=bcd+switch&SPECIAL=&form=KEYWORD&ProdCodeOnly=&Keyword1=&Keyword2=&pageNumber=&priceMin=&priceMax=&SUBCATID=So each digit is represented in a 4 bit nibble (the unused reserved for Hex I'm assuming) - I have a couple of the little style hex ones you use a screwdriver on here to play with already until I want to buy the more expensive thumbwheel dec versions ...So, I have a nibble representing each of my desired decimal factors for instance:150.2Hz0000 0000 0001 0101 0000 0010(which is 001502, or 1,502 which would be divided by ten at the end)I'm not up to scratch with the 4059 but have used things like the 4024 and 4060 before (So I understand the divide by 10 section, with the 4024)So what exactly do I do with these 6 BCD values ?I could restrict my range from 100 Hz to 9999 Hz and then I'd only have four BCD values if that helps - but 100.0 to 9999.0 HZ would be preferred (5 BCD values, instead of my original 6)Doesn't the 4059 require the divided by number ? not the number that will result at the other end ?Say I want 300Hz and I've got 1MHz going in I'd need to enter into the 4059 'divide by 3333' - which will give me 300.03HzYet say if I wanted 9999Hz : 1,000,000 / 9999 = 100.0100010001...with the 5 BCD resolution I get the following:1,000,000 / 0100.0 (hundred)= 10000 which aint 9999Still - I find myself stuck working with dividing periods instead of entering frequencies directly...confused - I probably got something wrong with your suggestion...any help appreciated,nick Quote Link to comment Share on other sites More sharing options...
Nick Mulder Posted April 14, 2007 Author Report Share Posted April 14, 2007 Just read your last reply - I'm understanding the 4059 a bit more now and should note that I meant the 4017 when i referred to the 4024 in my last post ...Like I said tho I'm still stuck with dividing periods rather than working directly with Hz - I want the value entered on the thumbwheel to be the frequency and not the frequency divisor.I'm getting an idea of how it works but this gear need to be used by other people who don't have the time to figure out the division, yes I know it only takes two secs... but the thing is I know that gear has been made that doesn't require it (just like that first linked to in the original thread) and that is the goal that I wish to achieve here ...So far I get the picture that there isn't an accurate way of deriving Hz directly - its always a division of a higher frequency with the remainders thrown into a +/- value postscript ? ...and if you need Hz on the user interface its always a convoluted method (I'm yet to understand) to translate this into the divisions ?thanks so far! hopefully Im not being a painnick Quote Link to comment Share on other sites More sharing options...
AN920 Posted April 14, 2007 Report Share Posted April 14, 2007 I removed the last post after I realized that as you divide by a lower count you will be stepping in larger increments of course!The math can be easily solved with a uP. I will give it a bit more thought and post something that looks workable. Quote Link to comment Share on other sites More sharing options...
Nick Mulder Posted April 14, 2007 Author Report Share Posted April 14, 2007 I removed the last post after I realized that as you divide by a lower count you will be stepping in larger increments of course!I was thinking yes I could enter Hz values into a uP and have a nifty LCD and telephone pad interface and let it do the math for me - but I'm still stuck with the same problem all along ... ok at one end in terms of resolution but then it all gets out of whack a the other end of the spectrum...Its because of the range I need, a factor of 10,000 (5 BCD values) - I'm hoping for 10,000 but maybe 1,000 is what I am stuck with because of pin counts on whatever I useIt was suggested I look at this chip also http://www.st.com/stonline/books/pdf/docs/2086.pdf - which is neat in some respects but I'm still unsure how to 'cascade' it for want of a better term:I can see how to get 800Hz from a 1kHz input by simply inputting 8 in BCD (1000) via a thumbwheel BCD switch - but how do I get say 1238Hz from 10kHz ?maybe thinking like this:0.1x10000 + 0.2x1000 + 0.3x100 + 0.8x10 = 1238I can get the 0.1x,0.2x,0.3x etc.. factors individually from say four 4527 chips but how do I achieve the '+' ? '+' isn't quite the right way to think about it as we are dealing with frequency as opposed to discrete period of time - I hope I'm making sense and its a way forward ...On page 5 of the spec sheet though - it does some funky things with the duty cycle that will need to be smoothed out somehow!yikes, :P+ :DNick Quote Link to comment Share on other sites More sharing options...
AN920 Posted April 14, 2007 Report Share Posted April 14, 2007 Are you ok with steps of 0.1Hz from 100 Hz to 999.9 Hz and then 1 Hz steps from 1000 to 9999 Hz? Quote Link to comment Share on other sites More sharing options...
Nick Mulder Posted April 14, 2007 Author Report Share Posted April 14, 2007 Are you ok with steps of 0.1Hz from 100 Hz to 999.9 Hz and then 1 Hz steps from 1000 to 9999 Hz?Yep, thats definitely a start!What do you have in mind ?btw - the bottom limit off 100Hz is only because of the mechanical limits in the system thats its going to be finally impaled upon - it could go down to zero if need be, although the parts might not like that ! the odd frequencies I need i can sort the analog way using that voltage-freq chip I'll use for the ramping - hopefully a bit of nichrome wire will get things accurate enough with a adj Vreg and It'll stay that way with temperature etc... I'll have to see Quote Link to comment Share on other sites More sharing options...
AN920 Posted April 14, 2007 Report Share Posted April 14, 2007 Maybe to do something with rate multipliers. I have done something in the past and must just remember how I did it and find the diagrams.Look at this alsohttp://www.linear.com/pc/downloadDocument.do?id=5084 Quote Link to comment Share on other sites More sharing options...
AN920 Posted April 16, 2007 Report Share Posted April 16, 2007 Nick this may work.SW1 gives 2 modes. With SW1 closed you can set the output frequency from(2 MHz/9999)/2 =100.01Hz to (2 MHz/999)/2 = 1001 HzWith SW1 open the output will start at 1000.1 Hz to 10010 Hz (range above multiplied by 10). You can get a much higher frequencies with the switch settings lower than 999I have used a hardware digital x 10 pulse multiplier instead of a typical VCO type because it does not need special adjustments and operate over a much wider range. U7 will provide the 50% duty cycle you required. You can make the switch selection easy by driving that lines with your uP which can do all the calculations for you.DSW1 will be your MSD and DSW4 your LSD. RP1,2 is respacks with 8 x 100k pull-up resistors. VDD should be 10-15VI have not simulated the whole design as I don't have a model for U6. It is up to you to try. I have included the way the multiplier works. Each edge generates 5 pulses Quote Link to comment Share on other sites More sharing options...
Nick Mulder Posted April 16, 2007 Author Report Share Posted April 16, 2007 I'd like to check it out but clicking on the pic or the text link below it pops up a window saying:You are not allowed to access this sectionIs there a paid subscriber function here ?I hope I'm not being rude asking if you could post the schematic elsewhere ? :-Xthanks for your help!Nick Quote Link to comment Share on other sites More sharing options...
AN920 Posted April 16, 2007 Report Share Posted April 16, 2007 Maybe it is just a glitch in the system. As long as you are logged in you should be able to view the files. Quote Link to comment Share on other sites More sharing options...
Nick Mulder Posted April 16, 2007 Author Report Share Posted April 16, 2007 working now :) - So there is also a bit of work to do on the uP programming but I understand what is required (I'll need a 16bit I/O expander as well) - hmmm, so what are all those NOR gates doing like that ? I am yet to understand them ... Quote Link to comment Share on other sites More sharing options...
AN920 Posted April 16, 2007 Report Share Posted April 16, 2007 All those XNOR's form the pulse multiplier. I will post a version with a VCO multiplier as well but the multiplying range will be limited. You can pick the one that looks more simple and suit your purpose. If you make R4 adjustable you can trim it for the range you want Quote Link to comment Share on other sites More sharing options...
Ldanielrosa Posted April 16, 2007 Report Share Posted April 16, 2007 I guess I should have replied earlier, but here goes.If the gizmo doesn't need to do anything else when it's putting out the frequency of choice, then what I've been working on may be of some value. On a mothballed project that I will call a guitar tuner, I have some arithmetic subroutines that convert chosen frequency into a scaler value which is repetitively added to a 24 bit sum. The top eight bits are then used to fetch a value from a table, which is fed to an output port. An input pin is checked to determine if the halt button has been pressed, and failing that the cycle repeats at adding the scaler to the sum.At a clock speed of 4MHz I can get just over 10kHz output, but not by much. The DAC (R2R ladder) is external to the uC. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.