![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Hi All:
Is it possible to use a PIC to generate low frequency square waves variable between 5 and 50hz with a 50% duty cycle or better off to use a 555 timer. Thanks |
|
|
|
|
|
|
(permalink) |
|
at last, i can say it.....
yes it's trivial. it's very easy to output a square wave from a pic with full control over frequency and duty cycle... you just toggle the pin value when required by a preset delay. i used a spare 16f84 to do just this while debugging a zero cross iinterrupt routine on a 16f876a controlled dimmer. of course a 555 is easy too, but you have to hang more bits and bobs off it to get the same result [assuming you have a pic programmer]. if you've got a spare low end pic my choice would be to use that. |
|
|
|
|
|
|
(permalink) |
|
what kind of frequency is possible, 60 Hz, 100 Hz, higher?
__________________
Don't touch that wire........Um......are you ok? |
|
|
|
|
|
|
(permalink) |
|
low end pics will run at 20MHz, ie instructiions are executed at 5MHz. If you simply toggled in an endless loop you could achieve over 1.6MHz [quick reckoning]. you could add controls with interupting inputs and still acheive hundreds of KHz.
|
|
|
|
|
|
|
(permalink) |
|
Will you mess up the frequency output by servicing the interrupt request?
__________________
L.Chung |
|
|
|
|
|
|
(permalink) | |
|
Perhaps it was low frequency using PWM that was supposedly difficult using a PIC. Would you have any sample code from the 16f84 project you worked on that you could post to get me started? Thanks
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
i am talking about generating output dependant on a calculated delay loop based on a pair of variables [eg. on duration, off duration] a better alternative would be to use Timer to generate a pin toggle interrupt. keypad input could then be monitored in a main loop. this should give a more continuous output. when i did it i didn't implement any input to vary parameters, i incremented an eight bit port at a fixed rate, giving 50Hz on bit 0, 25Hz on 1, 12.5Hz on 3 etc. and manually selected the pin to suit my needs. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
I was hoping for a resolution of 0.5 hz and would like to control by the use of two pushbuttons. Up and down.
Quote:
|
||
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Variable capacitor circuits | walters | General Electronics Chat | 83 | 11th March 2008 02:58 PM |
| Frequency Generator | ParkingLotLust | Electronic Projects Design/Ideas/Reviews | 3 | 6th July 2006 04:09 AM |
| Low frequency Triangle generator | HarveyH42 | Electronic Projects Design/Ideas/Reviews | 14 | 12th June 2006 10:17 PM |
| Simple frequency generator | Chazz | General Electronics Chat | 5 | 25th July 2005 08:30 AM |
| frequency generator | cool-agent | Electronic Projects Design/Ideas/Reviews | 1 | 10th March 2004 12:26 PM |