Minute output not written properly

Jan 07, 2008 1 Replies

I have set my minute value in the register on my RTC (DS1302) to be 45 using this code:



// This function sets the amount of minutes on the RTC void set_minutes(unsigned char minutes) { unsigned char minute_ones; unsigned char minute_tens; unsigned char minute_write = 0;



// Obtain the tens digit of minutes into minute_tens minute_tens = minutes / 10;



// Write the tens digit of minutes into minute_write minute_write = minute_write | (minute_tens > 4) * 10;



// return the return value to the place called return return_minutes; }



I have no idea of what is wrong with my set_minute function or access_minutes function because of the weird number that I'm getting and I have checked the datasheet for the register byte configuration to make sure that I anded and ored the bits properly.


temp = register_data & 0x70;

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required