Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PWM generation using PIC

Status
Not open for further replies.
It's better if it's manually converted to C. However, it does depend a lot on how critical timing is and know the timing is. It can still be changed. Maybe if you post the code and it's simple and not too difficult, I can help.
The first step is to change the including header file and changing the processor definition. Then, change the configuration settings. Then, analyze the code to see where which module is used and how the module differs or is the same between the two PICs. In case of ADC, you need to change comparison values as ADC is 8-bit in 16F72 and 10-bit in 16F876.

Hope this helps.
Tahmid.
 

hmm true
have you got an example of how to change from 8 bits to 10 bits
 

First, set the output justification: right-justified or left-justified. ADC result in 16F72 will be in ADRES register. For 16F876, the result will be split to two registers: ADRESH and ADRESL.

You should go through the ADC section in the datasheets of both the PICs.

Hope this helps.
Tahmid.
 

hey can somebody give me a hex file or a complete source code for pwm generator using pic 16f876A?
 

Here is the code

Generates 75% duty pwm.

Code:
void main() {
     TRISC = 0x00;
     PORTC = 0x00;
     PWM1_Init(5000);
     PWM1_Start();
     PWM1_Set_Duty(192);
     
     while(1) {
     
     }
}
 

Attachments

  • pwm.jpg
    pwm.jpg
    196.6 KB · Views: 71

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top