thebenman
Newbie level 4
- Joined
- Mar 27, 2014
- Messages
- 7
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 48
Hey,
I wanted to trigger mosfets using PWM from PIC 16F877A .The PWM is supposed to oscillate at 50Khz with the duty cycle of about 50 %.I want to draw four PWM signals from the PIC MCU that are apart from each other by 10 micro seconds.But i am unable to achieve the required duty cycle and frequency of operation.I am attaching the code below
I wanted to trigger mosfets using PWM from PIC 16F877A .The PWM is supposed to oscillate at 50Khz with the duty cycle of about 50 %.I want to draw four PWM signals from the PIC MCU that are apart from each other by 10 micro seconds.But i am unable to achieve the required duty cycle and frequency of operation.I am attaching the code below
Code:
void main() {
TRISA = 0xFF;
PORTA = 0x00;
TRISB = 0x00;
PORTB = 0x00;
TRISC = 0x80;
PORTC = 0x00;
TRISD = 0x00;
PORTD = 0x00;
while(1) {
PORTD = 0x0A;
Delay_us(10);
PORTD = 0x00;
Delay_us(2);
PORTD = 0x05;
Delay_us(10);
PORTD = 0x00;
Delay_us(2);
}
}