PIC programming help

Thread Starter

bathini

Joined Jan 25, 2009
8
Hello

I am having issues programming my PIC16F627. The deal is its a 4 bit PWM which needs to be simulated on a mplab simulator(will build later the circuit). I am simply getting a 50% duty cycle. I want to vary the duty cycle either through the simulator or maybe changing the values of the switch input.I have attached the code. Thanks

Bathini
 

Attachments

mik3

Joined Feb 4, 2008
4,843
If you read the datasheet of the PIC at the part about PWM it says exactly you do you need to vary to set the PWM duty cycle.
 

Thread Starter

bathini

Joined Jan 25, 2009
8
Alberto
Thanks for your reply. My pic is running at 50KHz. I will revise your code and include it to see whether it will work for me.

Bathini
 

Thread Starter

bathini

Joined Jan 25, 2009
8
Hi Mik3

Well, my application is decoder controller. The motor I am trying to control is a model train control which is a small control. Here is the circuit I have built http://home.cogeco.ca/~rpaisley4/HBridge.html - The last comparator circuit Motor/Decoder

It works but now I have to control it with 4 digital input for speed and probably also direction.That will be the 5th bit and later.

Thanks

Bathini
 
Top