11.07.2015 Views

UNIVERSITI TEKNOLOGI MALAYSIA - FKE - UTM

UNIVERSITI TEKNOLOGI MALAYSIA - FKE - UTM

UNIVERSITI TEKNOLOGI MALAYSIA - FKE - UTM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

41// Add code hereelse if((Event_WriteBuf.EvParam.wEventID ==Temperature_Report_Ev) ||(Event_WriteBuf.EvParam.wEventID ==Temperature_Alert_Ev)){}Event_WriteBuf.Data[0] = ROM_NO[0];Event_WriteBuf.Data[1] = ROM_NO[1];Event_WriteBuf.Data[2] = ROM_NO[2];Event_WriteBuf.Data[3] = ROM_NO[3];Event_WriteBuf.Data[4] = wReadTemperature;#endifFigure 4.9 Writing the data into the memorySome code must also be added into the userTask.c file. This is the filewhich contains the software timers. Software times are clocked at the scheduleclock frequency, at approximately 10ms intervals. Both cyclic and one-shot (tmLoad = 0) timers can be created. InitTimer() is used to initialize timer values(with timer started state), AddTimer() adds the timer to timer service list, whileRemoveTimer() removes the timer from timer service list. StartTimer() andStopTimer() can be used to enable and disable timer counting while the timer isin the timer service list.The code below which will be added to userTask.c file is shown in Figure4.10.ReadTemperature_Routine()Temperature_NormReport_Routine()ReadHumidity_Routine()Humidity_NormReport_Routine()InitTimer(&timer, 100, 0, thisTask, ISYS_SIGF_TIMEOUT);Forbid();AddTimer(&timer);Permit();//while(1){register WORD wSignal;static WORD i=0;static WORD y= 60;// Force NAV ON for 1min// Wait for a signal: Either the 100 ms timer elapsesor a GPIO input pin state changes//wTemp = ISYS_WaitSig(ISYS_SIGF_TIMEOUT |ISYS_SIGF_GPIO);// Wait for a signal: Either the 100 ms timer elapses

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!