Dennis F.

Alarm timer problems with MCF52234

Discussion created by Dennis F. on Jul 16, 2008
Latest reply on Jul 17, 2008 by Dennis F.
Hi folks,

I want to use the Alarm timer in the MCF52234.
Setting up the minutes and seconds is possible.
But I can't set the hour register.

Perhaps I can set all values correcty and the reading command is wrong.
Setting and reading of minutes and seconds is correctly, The hour-value is always 0.

I added the Code for you : :smileyhappy:

Code:
//********** Set Timer*********************************************************////  Sets the Timer of the RTC//  Firstbyte:  0xAE // ////***************************************************************************** int set_timer(u_char* pBuffer){ int hour, minute, second;   pBuffer++; hour = (u_char)*pBuffer;   pBuffer++; minute = (u_char)*pBuffer;  pBuffer++; second = (u_char)*pBuffer;            MCF_RTC_IER|= MCF_RTC_IER_ALM;  // ENABLE INTERRUPT FOR ALARM      MCF_RTC_ALRM_HM = MCF_RTC_ALRM_HM_HOURS(hour) | MCF_RTC_ALRM_HM_MINUTES(minute);   MCF_RTC_ALRM_SEC = MCF_RTC_ALRM_SEC_SECONDS(second); } //********** Read Timer*********************************************************////  Reads the Timer of the RTC//  Firstbyte:  0xAF // ////***************************************************************************** int read_timer(){ int hour, minute, second;   second =  ((MCF_RTC_ALRM_SEC));   minute =  ((MCF_RTC_ALRM_HM & 0x0000003F)<<0); hour   =  ((MCF_RTC_ALRM_HM & 0x0000001F)<<8); //hour =   ((MCF_RTC_ALRM_HM & 0x0000001F)>>8);  buffer[0]= 0xFF; buffer[1]= minute; buffer[2]= hour; buffer[3]= second; m_send( emg_tcp_communication_socket, (char*)&buffer[0], 4 );}

Perhaps someone can have look on it and give me some hints.
Thank you very much. :smileyhappy:

Best regards.

BlackIP



Message Edited by BlackIP on 2008-07-16 02:46 PM

Outcomes