Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 11th December 2006, 06:42 AM   #1
Default PWm using 12F675

hi guys... i've read a lottt of posts on this site and its awesome!

i have a slight problem however.. i need to generate a PWM with 1KHz constant frequency and a duty cycle varying from 5-95% using a PIC12F675..

i cannot use a 12F683.. .. however i did try this using 555. although the duty cycle varies as desired, the frequency does too... any ideas on this would be welcome too...

i dont want a program.. please give me some suggestion on how to go abt it.. i'm new to PIc's and so far all i've done is flash an LED..

thanx in advance.. hoping something would come up..?
Divs is offline  
Old 11th December 2006, 07:02 AM   #2
Default

first obtain the delay code from piclist

now define two variables N(on time)

Set a Pin 1 (high)
delay N us
Set the Pin 0
delay 1000-N us
loop


vary N is you require
__________________
Gods own Country
Incredible !ndia

www.flickr.com/photos/_akg/

"Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime."
akg is offline  
Old 20th December 2006, 12:29 PM   #3
Default

thanx a lot.. i'll try that way
Divs is offline  
Old 20th December 2006, 01:21 PM   #4
Default

What kind of resolution do you want for your duty cycle? You stated a range of 5-95% but do you want to increment by 1%, 5%, 0.5%, etc.? If the resolution isn't too small, you can use Timer 0 and interrupts to free your PIC up for other processing.

It's too bad that you can't use the 12F683. Ignoring the fact that it has a PWM generator, it also has Timer 2 which has a period register and its internal oscillator can run at 8MHz giving you better resolution if you choose to implement a software PWM setup.
phalanx is offline  
Old 20th December 2006, 02:45 PM   #5
Default

hey! thanx so much for your reply...
a 0.5% resolution should do nicely i guess.. i know, but then my boss says no to 12F683.. or any IC which has a CCP module.. so here i am, struggling, cuz all i've managed to learn so far in assembly language programming is to blink an LED..
i've started writing a code tho.. just trial and error, will post it here and someone could lead me on from there...
Divs is offline  
Old 20th December 2006, 04:05 PM   #6
Default

Quote:
Originally Posted by Divs
hey! thanx so much for your reply...
a 0.5% resolution should do nicely i guess.. i know, but then my boss says no to 12F683.. or any IC which has a CCP module.. so here i am, struggling, cuz all i've managed to learn so far in assembly language programming is to blink an LED.
Blinking an LED is PWM - you just need to blink it faster!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 20th December 2006, 05:13 PM   #7
Default

Quote:
Originally Posted by Divs
my boss says no to 12F683.. or any IC which has a CCP module..
why would he say that ? is he deliberatley trying to make this as difficult as possible ?
SYE is offline  
Old 20th December 2006, 07:04 PM   #8
Default

Quote:
Originally Posted by SYE
why would he say that ? is he deliberatley trying to make this as difficult as possible ?
Sounds more like a school project!.
__________________
PIC programmer software, and PIC Tutorials at:
http://www.winpicprog.co.uk
Nigel Goodwin is offline  
Old 21st December 2006, 03:29 AM   #9
Default

Quote:
Sounds more like a school project!
Or his boss is really cheap and won't spring for an extra 5 cents for the 12F675. It could also be that the company already stocks the 12F675 and wants to minimize inventory. But most likely a school project, since their "engineer" is only flashing LEDs so far.
__________________
Inside every little problem, is a big problem trying to get out.
kchriste is offline  
Old 21st December 2006, 03:46 AM   #10
Default

wow!!! how encouraging!!
Divs is offline  
Reply

Tags
pwm

Thread Tools
Display Modes


Similar
Title Starter Forum Replies Latest
A/D with pic 12f675 ndspinney Micro Controllers 8 23rd December 2006 10:55 AM
12F675 GPIO.3 help. mramos1 Micro Controllers 8 5th September 2006 12:22 PM
Cannot read 12F675 with ICSP dprischak Micro Controllers 4 1st June 2006 03:37 AM
12F675 Problem brodin Micro Controllers 10 29th December 2003 10:40 PM
12F675 Calibration? brodin Micro Controllers 7 25th December 2003 06:26 PM



All times are GMT. The time now is 06:12 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker