Problems using chVTSetI()
Posted: Wed Mar 19, 2014 8:20 pm
Hi,
I encountered some problems with using the chVTSetI() Method.
Here is my code:
When using this Code, the MCU got stuck in the unhandled exeption loop.
I am doing something wrong?
Best regards
Stomper
I encountered some problems with using the chVTSetI() Method.
Here is my code:
Code: Select all
/* EVENT TIMER STRUCT */
static VirtualTimer vt;
.
.
.
/*
* Normal main() thread activity, check the time here and set relais if necessary
*/
while (TRUE)
{
/* Query Time */
rtcGetTimeTm(&RTCD1, &thetime);
/* Query all alarms if one fits the actual time */
for (i=0; i<8; i++)
{
if (alarmlist[i].hour == thetime.tm_hour &&
alarmlist[i].minute == thetime.tm_min &&
thetime.tm_sec <= 1)
{
/* check if duration of alarm not 0 */
if (alarmlist[i].durationSec != 0)
{
/* Set the Water ON */
SetWaterON();
/* Schedule to switch off after duration time of alarm - later use: S2ST(alarmlist[i].durationSec) */
chVTSetI(&vt, 5000, SetWaterOFF, 0);
/* exit for, cause there should be only one alarm at one time in the list */
break;
}
}
}
chThdSleepMilliseconds(1000);
}
.
.
.
void SetWaterOFF(void *arg)
{
valve1 = 0;
valve2 = 0;
pump = 0;
}
When using this Code, the MCU got stuck in the unhandled exeption loop.
I am doing something wrong?
Best regards
Stomper