I2C / RX8564

Gast #3496538
Lesenswert?

Hallo Freunde,

Ich versuche gerade meine RTC zu stellen und den gestellten Wert aus der 
RTC wieder aus zu lesen... Leider klappt das nicht...
Wo mache ich was falsch?! Hat jemand vill. eine Library für diese Uhr ?

************************************************************************ 
*****/
#include <avr/io.h>
#include "i2cmaster.h"


#define Dev24C02  0xA2


int main(void)
{
    unsigned char ret;


    DDRB  = 0xff;                              // use all pins on port B 
for output
    PORTB = 0xff;                              // (active low LED's )

    i2c_init();                                // init I2C interface


    ret = i2c_start(RX8564+I2C_WRITE); // set device address and write 
mode
    if ( ret ) {
        i2c_stop();

    }else {

        i2c_write(0x05);
        i2c_write(0x75);
        i2c_stop();

        /* write ok, read value back from eeprom address 0x05, wait 
until
           the device is no longer busy from the previous write 
operation */
        i2c_start_wait(RX8564+I2C_WRITE);     // set device address and 
write mode
        i2c_write(0x05);                        // write address = 5
        i2c_rep_start(RX8564+I2C_READ);       // set device address and 
read mode
        ret = i2c_readNak();                    // read one byte
        i2c_stop();

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren