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.
Any good PIC compiler will let you test or set register bits directly.
In MikroC you can use
if(PORTB.F1)
and
PORTA.F3 = 0
to access bits.
#ifdef __C18 // these are not the actual compiler ID's
#define STATUS_LED PORTBbits.RB0
#endif
#ifdef __MIKROC
#define STATUS_LED PORTBbits.RB0
#endif
...
STATUS_LED = 1;
// compiler specific defines/macros
#define PORTD_BIT(x) PORTDbits.PORTDx
#define PORTC_BIT(x) PORTCbits.PORTCx
for(i=0; i<_TOTAL_LIGHTS; i++)
{
if (PORTD_BIT(i) == 1) // when i is 3 this expands to "if (PORTDbits.PORTD3 == 1) "
{
PORTC_BIT(i) = 1;
}
else
{
PORTC_BIT(i) = 0;
}
}
or
for(i=0; i<_TOTAL_LIGHTS; i++)
{
PORTC_BIT(i) = PORTD_BIT(i);
}
#define _TOTAL_LIGHTS 5
while(1)
{
i = TOTAL_LIGHTS;
PORTC.F0 = PORTD.F0;
i--;
if(!i) break;
PORTC.F1 = PORTD.F1;
i--;
if(!i) break;
PORTC.F2 = PORTD.F2;
i--;
if(!i) break;
PORTC.F3 = PORTD.F3;
i--;
if(!i) break;
PORTC.F4 = PORTD.F4;
i--;
if(!i) break;
PORTC.F5 = PORTD.F5;
i--;
if(!i) break;
PORTC.F6 = PORTD.F6;
i--;
if(!i) break;
PORTC.F7 = PORTD.F7;
break;
}