Dobry den,
hraju si ted se sbernici i2c v Pythonu a mam urcite trable s porozumenim fungovani.
Mam real-time clock i2c modul pripojeny k Raspbery Pi. Komunikace mi funguje, pouzivam modul smbus.
import smbus
bus = smbus.SMBus(0)
# 0x83 zapina 1Hz frekvenci na pinu CLK OUT
bus.write_byte_data(0x51, 0x0D, 0x83)
# nacti obsah registru 0x01 do returndata
returndata = bus.read_byte_data(0x51, 0x01)
Ty data jsou v registrech ulozena ve formatu BCD, takze se musi prepocitat abych dostal decimalni reprezentaci.
Kde mam ale problem s porozumenim je, jak zjistim treba obsah 3.bitu v registru XYZ. A jak ho zmenim. Nasel jsem si jedno [url?http://tronixstuff.com/2013/08/13/tutorial-arduino-and-pcf8563-real-time-clock-ic/]how-to[/url] k tomuto modulu, to je ale pro Arduino.
Checking if the alarm has occurred can be done with two methods – software and hardware. Using software you check bit 3 of the register at 0x01 (the “AF” alarm flag bit). If it’s 1 – it’s alarm time! Then you can turn the alarm off by setting that bit to zero. Using hardware, first set bit 1 of register 0x01 to 1 – then whenever an alarm occurs, current can flow into pin 3 of the PCF8563.
Za nejake vysvetleni bych byl moc vdecny.