but that still leaves the signal to feed into it...
Quotebut that still leaves the signal to feed into it...
You sure can feed it something but don't need to: the micro can run on either its internal rc oscillator, or an external crystal (+internal oscillator). It can generate a 100Hz signal stand-alone, with the right code: all it needs is to count 1000000/100/2 = 5000 pulses from its interal 4Mhz oscillator, and then flip a pin.
Fairly simple code.
so your saying that with a 12f675, and NOTHING ELSE, i can get a stable accurate signal? this would be perfect.
so your saying that with a 12f675, and NOTHING ELSE, i can get a stable accurate signal? this would be perfect.
You will get about 1% accuracy from a PIC12F675 internal RC oscillator. More like 2% with temperature and supply voltage spread.
The chip can be used with an external crystal or ceramic resonator if you need better.
I would be surprised if you could find exactly the code you need.
an oscillator that would stay between 98 and 102Hz indefinitely would be fine for my purposes. with my r/c trials i was deviating beyond that after less than a minute of operation.
by chance what capacitor where you using? if its a ceramic or electrolytic i can see it drifting like mad,
try a film cap, if you pick a capacitor with a good enough temp and voltage tolerance i could see reaching 0.1% easily,
so your saying that with a 12f675, and NOTHING ELSE, i can get a stable accurate signal? this would be perfect.
You will get about 1% accuracy from a PIC12F675 internal RC oscillator. More like 2% with temperature and supply voltage spread.
The chip can be used with an external crystal or ceramic resonator if you need better.
I would be surprised if you could find exactly the code you need.
by chance what capacitor where you using? if its a ceramic or electrolytic i can see it drifting like mad,I remember Dave saying in one of his videos that certain types of caps have NTC and other PTC behaviour. Conecting the two in parallel woulc compensate the cap drift.
try a film cap, if you pick a capacitor with a good enough temp and voltage tolerance i could see reaching 0.1% easily,
I agree, what you are doing wrong is to use a bipolar 555 and not a Cmos 555. (TLC555 for example.)an oscillator that would stay between 98 and 102Hz indefinitely would be fine for my purposes. with my r/c trials i was deviating beyond that after less than a minute of operation.
You were doing something wrong. You should be able to get 1% stability from a 555 timer oscillator if you use a stable capacitor type. If you are not going to use a crystal a 555 would be a simpler solution than a PIC, however, you would learn less.
with a 12f675, and NOTHING ELSE, i can get a stable accurate signal?
nearly finished with my current project. only thing missing is... well, the most important part. i need a time base for my .01sec timer to trigger on (100Hz triggered on the falling edge)
ive tried various types of r/c circuits, but none have had any kind of reasonable accuracy. i dont think im asking for much, but the best ive managed to build, id tune to 100Hz, and within 5 min was already out by over 10%. i tried letting it run for an hour to "stabilize" and then calibrated it, but the results were practically the same.
ive tried going the crystal route, but any simple, low part xtal osc ive tried i cannot get to work, and any ive got to work have been far too large, especially considering all of the extra circuitry id need to divide the signal down to 100Hz afterwards.
ive got both +9vdc battery and a regulated 5vdc power available as power sources. itd be super to get it to fit on a piece of perfboard 10 holes x 10 holes, but i can go slightly larger and still fit in the enclosure.
im open to ideas.
eg A crystal at 1MHz can be divided down to 100Hz with 4 x 4017 daisy chained. >:D That might be a high ic count though
ive tried various types of r/c circuits, but none have had any kind of reasonable accuracy. i dont think im asking for much, but the best ive managed to build, id tune to 100Hz, and within 5 min was already out by over 10%. i tried letting it run for an hour to "stabilize" and then calibrated it, but the results were practically the same.
so your saying that with a 12f675, and NOTHING ELSE, i can get a stable accurate signal? this would be perfect.
You will get about 1% accuracy from a PIC12F675 internal RC oscillator. More like 2% with temperature and supply voltage spread.
The chip can be used with an external crystal or ceramic resonator if you need better.
I would be surprised if you could find exactly the code you need.
I would use a PIC10F200... it's less than 0.60 USD and also has a ±1% accurate internal RC oscillator.
A 555 is generally cheaper, at less than 0.40 to 0.50, but when you consider you need to add a stable cap to it, it is a solution with more components and maybe now exceeds the area and price of a standalone PIC10F200.
Using a pic for making a simple 100 Hz oscillator ? |O
You are kidding :-DD
Here is a simple 100Hz oscillator as stable as a Xtal.
NB: TLC555 = Cmos version of the 555.
C1 : low temperature coefficient condensator.
For highest stability, trimpot R2 (22K) may be substituted by adjusted resistor. (ajusted for 100 Hz)
More components?Using a pic for making a simple 100 Hz oscillator ? |O
You are kidding :-DD
Here is a simple 100Hz oscillator as stable as a Xtal.
NB: TLC555 = Cmos version of the 555.
C1 : low temperature coefficient condensator.
For highest stability, trimpot R2 (22K) may be substituted by adjusted resistor. (ajusted for 100 Hz)
Why not? The circuit you showed uses many more components and is less accurate. I don't see how a single 8-pin micro by itself is a bad idea?
More components?Yes more components. A PIC needs no other components except a supply decoupling capacitor if you don't already have some.
01 x TLC555 or equivalent
01 x 4049B
01 x 0.1µF condensator (c2 is not essential)
03 x resistors (if trimpot is not used and replace with ajusted resistors)
Link to the datasheet: http://www.linear.com/product/LTC6991 (http://www.linear.com/product/LTC6991)$3 100 off from Digikey is the problem with that suggestion and it is barely more accurate than a PIC10F200 which is also in SOT-23 and costs $0.34 100 off from Digikey.
Using a pic for making a simple 100 Hz oscillator ? |O
More components?PIC:
01 x TLC555 or equivalent
01 x 4049B
01 x 0.1µF condensator (c2 is not essential)
03 x resistors (if trimpot is not used and replace with ajusted resistors)
You could use a watch crystal---less division.
You could use a watch crystal---less division.
Dividing by 327.68 to get 100Hz isn't so simple.
[RE: LTC6991 - nice part, but $3.80???
...because OP has them on hand, they have a built-in, factory-trimmed RC oscillator stable to 1%, and OP already tried to use a 555 (albeit not the TLC555) and it was unstable, again using the parts OP had on hand.
Yes, your solution uses more parts and requires quality caps, and even then may not be better than a few percent accurate. And it won't be as stable as a crystal, like you claim. Plus an analog input of the PIC can be used to make a temperature compensated oscillator, if needed.
ok, so about the xtal, afa i know, to get my 12f675 to mate to an xtal, it needs a driver circuit for it.
Watch out for feature creep with a microcontroller.Yes, though I think the 74HC4060 would be better as it has a built-on oscillator.
My favorite fit&forget solution would be 3.2768MHz xtal driving (and driven by) a 74HC4020, then feeding the output from this into another 74HC4020.
You need a 15 stage divider for 3.2768MHz, so you can play with the different taps (7 stage feeding an 8 stage, 9 stage feeding a 6 stage etc...)
The 74HC4020 is very cheap and using two doesn't complicate the BOM - no programming also. There is also a schematic of the xtal oscillator rigging in the NXP datasheet.
Watch out for feature creep with a microcontroller.Yes, though I think the 74HC4060 would be better as it has a built-on oscillator.
My favorite fit&forget solution would be 3.2768MHz xtal driving (and driven by) a 74HC4020, then feeding the output from this into another 74HC4020.
You need a 15 stage divider for 3.2768MHz, so you can play with the different taps (7 stage feeding an 8 stage, 9 stage feeding a 6 stage etc...)
The 74HC4020 is very cheap and using two doesn't complicate the BOM - no programming also. There is also a schematic of the xtal oscillator rigging in the NXP datasheet.
...The OP now has a number of well thought-out options with most of the pros/cons discussed - a most satisfying thread I think.
is the xtal really not that necessary?
:020000002C28AA
:10000800A00003088301AA000B1101308312A30783
:100018002302F43003192202031C26280130850626
:100028000C30A2070318A30AFE30A307A60B262844
:10003800023085060A30A600A70B2628043085065C
:100048006430A70083122A088300A00E200E09003E
:1000580021308400263040200030A9006130A800FB
:1000680026308400283045208316FF239000830122
:10007800052904068001840A0406031D3D2864003E
:100088000034DC0050208000840A04085C06031950
:10009800003446288312A800A91B592829088A0079
:1000A8002808A80A0319A90A8200831329188317A4
:1000B8002808A80A8400000808000A346434831257
:1000C800A4008A28F3309F0583169F111F119F10E3
:1000D8001F14A3281F08F33904389F0083169F11A3
:1000E8001F119F1487281F08F33908389F008316AB
:1000F8009F111F1586281F08F3390C389F00831697
:100108009F151F119F101F10A328892883122408E8
:100118000C39DE00DF019E285E08003A03196628C4
:10012800043A03196E280C3A03197728043A03197C
:100138007F2889285F08003A031990288928000039
:1001480000000000000000000000000083129F145F
:100158009F18AC281E08DD00DC0183161E08DC048D
:1001680083120800831224088312FE202508A400A5
:10017800A501C028FF30FE2024080319A503A40305
:10018800240A0319250A03190800BE28D028C830F4
:10019800A400A5018312B620831224080319A5031D
:1001A800A403240A0319250A03190800CB28831677
:1001B8001F139F161F1683129F111F119F171F13BE
:1001C8000C1383160C1383121F140800F8308312C3
:1001D80085058316850581128115831281010B110E
:1001E8008B16080007308312990083169F0181132C
:1001F800831208008312A4008312A403240F002989
:0C02080008008312F620EA208B17092959
:02400E00843FED
:00000001FF
which needs an external crystal and two small capacitors.
I put this together quickly but it will generate 3 frequencies, 1khz/100hz/1hz, on a 12F675's 7/6/5 pins, respectively. In addition to the pic, no other part is required, though a decoupling cap (.1uf) + 3 resistors (220ohm each on the output, for protection) would be nice.Nice, I just did the same, but only 100 Hz output:
I will implement enable/disable + voltage tuning of the output later on.Another interesting idea would be to implement a calibration function. The PIC12F675 has an EEPROM, which can be used to store the OSCCAL value and this can be trimmed with two external switches.
very nice. i cant thank you enough, guys. especially danny and frank for helping with the code!! :-+
Yes, I used timer 0: used it to generate 1Khz, and then divided it down from there to get 100hz and then divided that down to 1hz. 13 lines of code to generate those outputs. All in, flash is 25% utilized.Nice, that's short. And depending on the application, the jitter is no problem for the 100 Hz signal, would be only a few us.
My pleasure. Another nice usage for cheap PICs, even without a DAC, is to create analog signals,...Well it's always nice to see non-uC solution, but it's not a surprise that people won't do it :P the price of those microcontrolers is just crazy, as some are cheaper than basic passive parts, can't even buy one small beer for that price (and I am tallking here, in CZ where the beer is cheaper than water)...
the jitter is no problem for the 100 Hz signal, would be only a few us.
But looks like the factory calibration is already very stable. I can measure 99.6 Hz and even with freezer spray it is still 99.3 Hz and it goes to 100 Hz when heating it with a soldering iron. I guess the 555 circuit is not that precise.Schematic I have proposed is designed to not depend of the supply voltage ( the 4049B ensures that the voltages for charging and discharging the capacitor are exactly 0V and the voltage of the power supply) , nor influenced by the impedance of the 555 input . ( this is the reason for choosing the cmos 555 version) .
very nice. i cant thank you enough, guys. especially danny and frank for helping with the code!! :-+
My pleasure. Another nice usage for cheap PICs, even without a DAC, is to create analog signals, for example a low frequency sine wave:
http://www.frank-buss.de/blinker/index.html (http://www.frank-buss.de/blinker/index.html)
You should try to code in PIC assembler. PICs are byzantine, sometimes the registers are not intuitive and not easy to use (e.g. for your microcontroller, if you want to use the other GPIOs, don't forget to disable the analog function, see the ANSEL register), the assembler instruction set is a nightmare, compared to e.g. a nice 68k CPU, but they are still very useful for such simple tasks, and it is some kind of geeky fun to wrap your head around it. And you can get the chips forever, even the old ones, unlike some other vendors like Atmel, who sometimes discontinue chips or where it is difficult to get some chips.
I found strange behavioral. The OSCAL value does not affect the frequency and switching on and off can change the frequency ( tested with Pickit2 and two brand new 12F675 )That's interesting. Maybe it is related to the _BODEN_OFF setting and slow falling/rising supply voltage and then some registers are not initialized correctly? I can turn it on and off as often as I want and it is always 99.6 Hz, but it is a PIC12F509. I will buy a PIC12F675 with my next order for my DIY bitcoin miner and then test it again.
Manytimes the output frequency is set to 92.05.. but after several on/off cycles frequency is changes to 122Hz or other frequency which is quiet odd.
very nice. i cant thank you enough, guys. especially danny and frank for helping with the code!! :-+
My pleasure. Another nice usage for cheap PICs, even without a DAC, is to create analog signals, for example a low frequency sine wave:
http://www.frank-buss.de/blinker/index.html (http://www.frank-buss.de/blinker/index.html)
You should try to code in PIC assembler. PICs are byzantine, sometimes the registers are not intuitive and not easy to use (e.g. for your microcontroller, if you want to use the other GPIOs, don't forget to disable the analog function, see the ANSEL register), the assembler instruction set is a nightmare, compared to e.g. a nice 68k CPU, but they are still very useful for such simple tasks, and it is some kind of geeky fun to wrap your head around it. And you can get the chips forever, even the old ones, unlike some other vendors like Atmel, who sometimes discontinue chips or where it is difficult to get some chips.
I found strange behavioral. The OSCAL value does not affect the frequency and switching on and off can change the frequency ( tested with Pickit2 and two brand new 12F675 )
Manytimes the output frequency is set to 92.05.. but after several on/off cycles frequency is changes to 122Hz or other frequency which is quiet odd.