Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Pic18f - Pwm

Status
Not open for further replies.

erosennin

New Member
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.
 
Excellent, that's what I meant! Thanks.

Now it's time to start meshing together the various aspects...
 
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 **broken link removed** 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
 
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.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top