Minute output not written properly

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.

Reply to
ssylee
Loading thread data ...

temp = register_data & 0x70;

Reply to
Arlet Ottens

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.