Search found 5 matches
- 16 Feb 2013, 13:35
- Forum: Mindstorms Software
- Topic: [NXC] Adressing I2C-Device
- Replies: 13
- Views: 11961
Re: [NXC] Adressing I2C-Device
1. Address For reasons that I have not looked up yet, the Wire library for Arduino uses the upper 7 bit of the 8 bit device address. So that makes 0x50 = 0101 0000 shifted right once to 0010 1000 = 0x28. 2. Control byte format The control byte has of 8 bits which are: start bit, 3 channel bits and ...
- 16 Feb 2013, 09:47
- Forum: Mindstorms Software
- Topic: [NXC] Adressing I2C-Device
- Replies: 13
- Views: 11961
Re: [NXC] Adressing I2C-Device
sure. byte Max127msg[] = {0x50, 0}; This is the message array for the I2C-device. First element ist the 8 bit device address. So I don't have to build the message array every time, I only set the following element(s) containing the actual message (initially 0). In my case it is just one control byte...
- 16 Feb 2013, 07:31
- Forum: Mindstorms Software
- Topic: [NXC] Adressing I2C-Device
- Replies: 13
- Views: 11961
Re: [NXC] Adressing I2C-Device
If it's just for the sake of shortening, one might do it this way: #define MAX127PORT S1 byte Max127msg[] = {0x50, 0}; // Message array for the adc int MAX127Value(byte channel) { byte count = 2; byte reply[]; // Control byte: start bit (7) + channel number bit-shifted into place Max127msg[1] = 0x80...
- 15 Feb 2013, 07:58
- Forum: Mindstorms Software
- Topic: [NXC] Adressing I2C-Device
- Replies: 13
- Views: 11961
Re: [NXC] Adressing I2C-Device
I tried the suggested solution and it works splendidly. Besides, it is not so much more. You just have to build the array and don't have a read-Method. The most significant difference compared to my efforts is the use of the 8-bit address (0x50) instead of the 7-bit version (0x28 = 0x50>>1) for ardu...
- 14 Feb 2013, 17:02
- Forum: Mindstorms Software
- Topic: [NXC] Adressing I2C-Device
- Replies: 13
- Views: 11961
[NXC] Adressing I2C-Device
Hello everyone. I made an I2C-8-Channel-ADC (MAX127) talk to an arduino board using the Wire library for I2C communication. No problem there: Wire.beginTransmission(0x28); // start talking to device 0x28 (7-bit-address) Wire.write(0x80); // send command byte: convert value at channel 0. Wire.endTran...