26 Eylül 2017 Salı

Setting DS1307

If we dont set DS1307 it will show computer clock where Proteus is running on. Instead we can set hour, minnutes,seconds etc any value on registers. Let's set everything to zero for example.




    unsigned char s1[10], s2[10];
    uint8_t readValue[7], writeValue[8]={0,0,0,0,0,0,0,0};
    I2C_MESSAGE_STATUS    I2C_status;
 
 
    I2C_MasterWrite( &writeValue, 7, 0b1101000, &I2C_status); //set pointer address zero and write 7 zero
    while (I2C_MESSAGE_PENDING  == I2C_status );

Time will start from 00:00:00 Similarly we can set only hours, minutes, seconds etc by adding some buttons to the circuit. If button pressed increase hours +1 mod 24 ...



 

Hiç yorum yok:

Yorum Gönder