Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include<htc.h>
#define _XTAL_FREQ 4000000
__CONFIG(0x31C4);
int OnPulse = 217;
int OffPulse = 38;
char TOG = 0;
int i = 0;
void interrupt Interrupt_Service_Subroutine(void)
{
T0IF = 0;
i += 1;
TOG = ~TOG;
if(i>=8000) // two seconds
{
i=0;
}
if(i<=4000) // First second 85%
{
if(TOG)
{
RA5 = 1;
TMR0 = 217;
}
else
{
RA5 = 0;
TMR0 = 38;
}
}
if(i>4000) // Second second 5%
{
if(TOG)
{
RA5 = 1;
TMR0 = 13;
}
else
{
RA5 = 0;
TMR0 = 242;
}
}
}
void main()
{
int pulse;
TRISCbits.TRISC3 = 0;
TRISCbits.TRISC0 = 1;
TRISAbits.TRISA5 = 0;
CMCON = 7;
TMR0 = OnPulse;
ANSEL = 0x10;
OPTION_REG = 0;
T0IE = 1;
GIE = 1;
RC3=1;
while(1)
{
}
}
Roman!! The chip doesn't have a CCP module... It was a software implementation..
...
But can u tell me why the same code failed with MPLABX and XC8 compiler...
You'd think microchip products would be better than 3rd party...