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
 
Thread Tools Display Modes
Old 23rd May 2008, 04:17 AM   (permalink)
Default Pic18f - Pwm

Hi Everyone,

I've been reading Nigel's tutorial and I now understand how to operate the hardware PWM in the PIC that I wish to use (18F2431).

My question is, once I set all the required registers for hardware PWM, does that continue to use processor cycles like a software pwm? ... I'm not sure I'm being very clear, but what I mean is, if I am reading a keypad and displaying to an LCD as well, will this disrupt the operation of the pwm?

I have a couple of days off before I start my university exam revision for the semester so I thought I'd "restart" the project again... As a result, I'm sure I'll have a few more questions, it might be relatively obvious but I've never used a PIC before... I don't know whether this was a good project to start with, I thought the hardware PWM would simplify my life, but it seems to have complicated it for the moment...

Thank you,
EroSennin.
__________________
What is a joule per second?
erosennin is offline  
Reply With Quote
Old 23rd May 2008, 07:01 AM   (permalink)
Default

Quote:
does that continue to use processor cycles like a software pwm?
The PWM uses dedicated hardware, you only need the processor to set it up. Once it is setup and running it does not use processor cycles because it is not executing code.
3v0 is offline  
Reply With Quote
Old 23rd May 2008, 07:31 AM   (permalink)
Default

Excellent, that's what I meant! Thanks.

Now it's time to start meshing together the various aspects...
__________________
What is a joule per second?
erosennin is offline  
Reply With Quote
Old 24th May 2008, 02:11 AM   (permalink)
Default

One thing I use extensivly with PWM, is the ability to change the PWM and duty cycle on the fly

The developer of Swordfish released a module called PWM.bas and allows the user to change PWM settings like so;

Code:
 // import PWM module...
Include "PWM.bas"

// local duty variable...
Dim Duty As Byte

// main program...
SetFreq(5000)
While true
   Duty = 0
   Repeat
      SetDutyPercent(Duty)
      Inc(Duty)
      DelayMS(10)
   Until Duty > 100
Wend
Handy! I've used it for control of motor speeds, LED brightness and simple DAC
__________________
Spency.

PIC Micro's - Your mind is the limit

PIC's and interfacing with other devices - a PIC Basic Guide @ digital-diy.net
gramo is offline  
Reply With Quote
Old 25th May 2008, 01:24 PM   (permalink)
Default

Hi Gramo,

I saw you reply to a post I had made about Colour Sensing, and clicked around the site you have in your signature.

It looks pretty nice, so I've joined it... I'm about to write a post haha, this doesn't mean ETO that I will ditch you... I promise.

Well basically, for what I want to do, there are 3 PWMs and the user will enter the required duty from 0 to 255, and each controls the brightness of a series of RGB leds...

Thank you for your advice.
__________________
What is a joule per second?
erosennin is offline  
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
PI controller using PIC18F elec123 Micro Controllers 17 3rd August 2008 09:45 AM
Error on AN0 PIC18F mikesmixes777 Micro Controllers 10 8th February 2008 06:28 AM
PIC18F & C Programming mikesmixes777 Micro Controllers 2 22nd November 2007 09:00 AM
PIC18F & Microchip C18 yngndrw Micro Controllers 7 24th August 2007 03:25 AM
PIC18F and GOTO $-6 yngndrw Micro Controllers 12 3rd August 2007 01:09 AM



All times are GMT. The time now is 11:14 PM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.