Other Parts Discussed in Thread: HALCOGEN
Hi guys.
i want to make LED Blink for using RTI function.
first, i've made LED for using "for" function
========================================
static int j=0;
void delay(void);
void delay(void)
{
for (j=0; j<10000000; j++);
}
int main(void)
{
gioInit();
rtiInit();
do{
gioSetBit(gioPORTB, 6, 1);
delay();
gioSetBit(gioPORTB, 6, 0);
delay();
}while(1);
}
but i want to make LED blink using RTI function for exact timing
i activated RTI function through Halcogen.
so i want to LED blink per 500ms.
COMPARE0 is 1ms setting.
how to make main code?
===========================HL_notification.c=================
void rtiNotification(rtiBASE_t *rtiREG, uint32 notification)
{
if(rtiNOTIFICATION_COMPARE0 == notification)
{
bspInit();
}
}
==========================================================
==========================main.c==========================
int time_count = 0;
void bspInit(void);
void bspInit(void)
{
if (++time_count > 500)
{
if(time_count > 1000)
{
if(++time_count > 1500)
{
time_count = 0;
}
else
{
gioSetBit(gioPORTB, 6, 1);
}
}
else
{
gioSetBit(gioPORTB, 6, 0);
}
}
}
int main(void)
{
gioInit();
rtiInit();
bspInit();
}
====================================================