Reading data from array
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-05-28 3:03 PM
Posted on May 29, 2015 at 00:03
Hi,
I'm developing application which include I2C communication, so I have implemented code from AN8231. So far it works fine and I got data from I2C peripheral in input_buf[]. Data are valid, and I can see them in watch window in the debugger session. But when I try to use data ie: Raw_X_L = input_buf[0]; it is always 0x00 which is not valid value (from watch window). Here is code: u8 input_buf[MAX_INPUT]; //receiving buffer u8 output_buf[MAX_OUTPUT]; //transmitting buffer ... ... void Read_M (void) { output_buf[0] = (OUT_X_L_M | 0x80); while (!I2C_WriteRegister(lsm9ds0_xm_addr,SEV_BIT_ADDRESS, STOP, 0x01, &output_buf[0])); while (!I2C_ReadRegister(lsm9ds0_xm_addr, SEV_BIT_ADDRESS, STOP, 0x06, &input_buf[0])); } ... ... Raw_X_L = input_buf[0]; How to assign data from input_buf[] to variable? At the same time I can assign value from output_buf[]. Compiler is COSMIC STM8 Best regards, Vojislav
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2015-06-01 12:46 PM
Posted on June 01, 2015 at 21:46
Solved!
