Cheetos
Member level 3
I'm having a problem with mikroC PRO
i am using PIC16F877a and 8MHz xtal
This is my code and i always get Undeclared identifier on all PWM related codes.. please help me
void InitMain() {
PORTB = 0; // set PORTB to 0
TRISB = 0xF0; // designate PORTB pins as output
PORTC = 0; // set PORTC to 0
TRISC = 0xFF; // designate PORTC pins as output
Pwm1_Init(5000); // Initialize PWM1 module at 5KHz
PWM2_Init(5000); // Initialize PWM2 module at 5KHz
}
void main(){
InitMain();
PWM1_start();
PWM2_start();
while (1) {
if(PORTB==0x80)
{
PORTB=0x01;
}
if(PORTB==0x40)
{
PORTB=0x00;
Pwm1_Change_Duty(30);
}
if(PORTB==0x20)
{
PORTB=0x00;
Pwm1_Change_Duty(15);
}
if(PORTB==0x10)
{
PORTB=0x00;
Pwm1_Change_Duty(0);
}
}
}
i am using PIC16F877a and 8MHz xtal
This is my code and i always get Undeclared identifier on all PWM related codes.. please help me
void InitMain() {
PORTB = 0; // set PORTB to 0
TRISB = 0xF0; // designate PORTB pins as output
PORTC = 0; // set PORTC to 0
TRISC = 0xFF; // designate PORTC pins as output
Pwm1_Init(5000); // Initialize PWM1 module at 5KHz
PWM2_Init(5000); // Initialize PWM2 module at 5KHz
}
void main(){
InitMain();
PWM1_start();
PWM2_start();
while (1) {
if(PORTB==0x80)
{
PORTB=0x01;
}
if(PORTB==0x40)
{
PORTB=0x00;
Pwm1_Change_Duty(30);
}
if(PORTB==0x20)
{
PORTB=0x00;
Pwm1_Change_Duty(15);
}
if(PORTB==0x10)
{
PORTB=0x00;
Pwm1_Change_Duty(0);
}
}
}