Hello folks,

i despair of i2c_smbus_write_block_data. I try to send this few bytes:

 5D W 11 02 33 44

but my attached example code sends always:

 5D W 11 03 33

I'm perfectly happy if somebody can help me! :-)

King Regards,

Nick


      __________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <linux/i2c-dev.h>

int main()
{
        int fd;
        int adapter_nr = 3; /* probably dynamically determined */
        unsigned long addr = 0x5d; /* The I2C address */
        char filename[20] = {0};
        unsigned int size;
        char buf[5] = {0};
        int res;
        int reg;
        unsigned char values[3];
	
        sprintf(filename,"/dev/i2c-%d",adapter_nr);
        printf("device file: %s\n",filename);
        printf("i2c device Address: 0x%x\n",addr);

        fd = open(filename,O_RDWR);
        res = ioctl(fd,I2C_SLAVE,addr);

	reg = 0x11;
	values[0] = 0x33;
	values[1] = 0x44;

        if ( i2c_smbus_write_block_data(fd, reg, 2, values) < 0) {
                perror("Error: ");
        }

        close(filename);
        return 0;
}
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

Reply via email to