texas5
Newbie level 6
hi.i want to command the 120khz carrier that have been generate by the pin rc3/ccp1 of pic16f877a to transmit the signal according to zero crossing detector that create by pin rb0/int of pic16f877a.
this is the coding for the zero crossing interruption:
and here the coding for generate the 120khz:
i hope somebody can help me...
this is the coding for the zero crossing interruption:
void interrupt()
{
PORTA = PORTA - 1; //decrement the value on PORTA
INTCON.INTF = 0; //enable new RB0/INT interrupts
OPTION_REG=0;
}
void main()
{
OPTION_REG.INTEDG=1;
TRISA = 0x00; //set all PORTA pins as outputs
PORTA = 0xff; //make all PORTA pins high
INTCON.INTE = 1; //enable RB0/INT interrupts
INTCON.GIE = 1; //enable all un-masked interrupts
}
and here the coding for generate the 120khz:
void main()
{
TRISC = 0 ;
/*
* PWM registers configuration
* Fosc = 8000000 Hz
* Fpwm = 117647.06 Hz (Requested : 120000 Hz)
* Resolution is 6 bits
* Prescaler is 1
* Ensure that your PWM pin is configured as digital output
* see more details on https://www.micro-examples.com/
* this source code is provided 'as is',
* use it at your own risks
*/
PR2 = 0b00010000 ;
T2CON = 0b00000100 ;
CCPR1L = 0b00001000 ;
CCP1CON = 0b00011100 ;
}
i hope somebody can help me...