PIC12F675 PWM Code and Proteus Simulation

This post provides the PWM code for PIC12F675 microcontroller using timer0. There are many uses for PWM signal, e-g you can control dc motor speed using PWM. Timer0 is initialized in the start of the main function and using timer0 interrupts, PWM is generated.


This code is written in C language using MPLAB with HI-TECH C compiler. You can download this code from the ‘Downloads‘ section at the bottom of this page.

It is assumed that you know how to configure timer0 of PIC12F675 microcontroller. If you don’t then please read this page first, before proceeding with this article.

The result of simulating the code in Proteus is shown below.

Here PIC12F675 is running on 4MHz internal oscillator. A PWM wave of 1.8KHz frequency with 50% duty cycle is being generated as shown in the above figure. GP0 pin is being used as PWM_PIN, which you can easily change in the code. Also, you can change PWM duty cycle in the code at any time as well.

PIC12F675 PWM schematic


The code used to initialize PWM is shown below.


PWM code using PIC12F675 was compiled in MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10. To download code and Proteus simulation click here.


For more detail: PIC12F675 PWM Code and Proteus Simulation

Current Project / Post can also be found using:

  • pic12f675 pwm code
  • pwm in pic12f675
  • 12f675 pwm motor controller
  • c cofe for 12f675
READ  PIC12F675 Comparator Code and Proteus Simulation

Leave a Comment

= 4 + 5

Read previous post:
PIC12F675 based digital clock
PIC12F675 based digital clock using LCD display (Code + Proteus simulation)

This post provides a simple digital clock implementation using PIC12F675 microcontroller and an LCD display. This code is written in C...

Scroll to top