Hi, I'm new to using the SCTimer module but I've got three events set up, one on a rising edge event, one on a falling edge event and one on a match event only. However if i set them all up to capture the value and then print them out, i get values of 1,2 and 3, i.e. each event is triggering as soon as it can after the timer is started. Any ideas on what might cause thi? I'm using the sctimer drivers included in the LPC824 SDK.
sctimer_config_t sctimerInfo;
uint32_t riseEvent;
uint32_t fallEvent;
uint32_t timeoutEvent;
/* Enable clock of sct. */
CLOCK_EnableClock(kCLOCK_Sct);
//sctimerClock = CLOCK_GetFreq(kCLOCK_MainClk);
sctimerClock = CLOCK_GetFreq(kCLOCK_Irc);
SCTIMER_GetDefaultConfig(&sctimerInfo);
uint32_t timeoutMillis = MSEC_TO_COUNT(5000u,sctimerClock);
/* Initialize SCTimer module */
SCTIMER_Init(SCT0, &sctimerInfo);
/*create events for pin rise, fall and timeout conditions*/
SCTIMER_CreateAndScheduleEvent(SCT0, kSCTIMER_InputRiseEvent, 0u, ASICREPLY_PIN, kSCTIMER_Counter_L, &riseEvent); //creates event on data input pin L->H transition
SCTIMER_CreateAndScheduleEvent(SCT0, kSCTIMER_InputFallEvent, 0u, ASICREPLY_PIN, kSCTIMER_Counter_L, &fallEvent); //creates event on data input pin transition
SCTIMER_CreateAndScheduleEvent(SCT0, kSCTIMER_MatchEventOnly, timeoutMillis, 0, kSCTIMER_Counter_L, &timeoutEvent);
/*setup capture actions on pin rise and fall*/
SCTIMER_SetupCaptureAction(SCT0, kSCTIMER_Counter_L, &riseCaptureReg, riseEvent); //captures input on pin rise transition event
SCTIMER_SetupCaptureAction(SCT0, kSCTIMER_Counter_L, &fallCaptureReg, fallEvent); //captures input on pin fall transition event
SCTIMER_SetupCaptureAction(SCT0, kSCTIMER_Counter_L, &timeoutCaptureReg, timeoutEvent);
/*setup counter reset on timeout or falling edge*/
SCTIMER_SetupCounterLimitAction(SCT0,kSCTIMER_Counter_L,fallEvent);
SCTIMER_SetupCounterLimitAction(SCT0,kSCTIMER_Counter_L,timeoutEvent);
/*setup halt on timeout*/
SCTIMER_SetupCounterHaltAction(SCT0,kSCTIMER_Counter_L, timeoutEvent);
pinMode(INHIBIT_PIN2,0);
SCTIMER_StartTimer(SCT0, kSCTIMER_Counter_L);
Hope this is just me being silly cause I haven't used the module before.