sandhyaram
Newbie level 6
- Joined
- Aug 12, 2010
- Messages
- 13
- Helped
- 1
- Reputation
- 2
- Reaction score
- 1
- Trophy points
- 1,283
- Location
- coimbatore
- Activity points
- 1,365
//Program to generate 40kHz output at RC2(CCP1) pin
//Microcontroller: Microchip PIC18452
//Language: C
//Compiler: mikroC v8.20
//Programmer: Tahmid
void main (void){
TRISC = 0;
PORTC = 0;
ADCON1 = 7;
T2CON = 0;
TMR2 = 0;
PWM1_Init(40000); //40kHz
PWM1_Change_Duty(128); //50% duty cycle
// Choose Duty cycle as such:
// PWM_Change_Duty(x);
// x = ( (Duty Cycle in %) / 100) * 255
PWM1_Start(); //Start PWM
while (1){ //Loop forever
// Whatever else might be needed to be done while PWM is running
}
}
I think he wants a very basic (small and simple) code for mikroC compiler.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?