Hello
In my program I have to write in 10 registers having addresses 138 (decimal) and above, which more than 7 bit. How to resolve this problem?
I saw one example of SRFxx Sonic Range Finder Reader in the arduino website. In this they are using 112 address instead of 224.
Thank you
I am not personally seeing the issue?
The SRF08 Sonic Range finders here? SRF08 Ultra sonic range finder
They have a 7bit address with a bit on that as a "read/write" command.
This is the protocol. Bytes are always sent...collections of 8bits.
So usually you send the first byte in the form "7bit address" + "0" to write to the module. This is usually then sent with a "command" after. The commands seem to range from DEC(80) to DEC(170) which easily fit in the 256 available in one byte.
Reading this:
http://coecsl.ece.illinois.edu/ge423/DevantechSRF08UltraSonicRanger.pdf
"Location 0 is the command register and is used to start a
ranging session."
"DEC 81" - HEX 0x51 would tell the SRF08 to take a measurement and store it as a 16bit value over 2 registers at locations 2 and 3. One holding the "high" btye and one the "low" byte.
Maybe read this?
http://i2c.info/i2c-bus-specification
So on this module, to get it to take a measurement, youd send the following:
- A start byte.
- An Address + 0 byte (to write).
- A register address (0 in this case).
- The "start reading command": 0x51 (DEC 81)
- Stop Byte
Wait 65ms.
Then you would read the data in the registers 2 and 3:
- Start byte
- Device address + 1 (Read)
- Register Address (2)
- Register Address (3)
- End Byte
There are some "ACK" bits to throw in as well...but you may get the gist?
PS> I may be wrong on the receive byte bit.
Thank you
I was talking about SRF08 Sonic Range finders just for example, because I saw this in arduino website.
Actually I am interfacing AD5933 IC (http://www.analog.com/media/en/technical-documentation/evaluation-documentation/537700023EVAL_AD5933EB.pdf)
In the pdf I have given the link, you see the page no 17. Following is written in the program. They are using hexadecimal 84, 83 and 82 address of register to write the starting frequency.
WritetToPart &H84, StartFrequencybyte0 '84 hex lsb
WritetToPart &H83, StartFrequencybyte1 '83 hex
WritetToPart &H82, StartFrequencybyte2 '82 hex
This whole program is in Visual basic 6.
Please help me, how this 82,83 and 84 (hex) will be read by arduino microcontroller.
82(hex)=130(dec)
83(hex)=131(dec)
And this has 8bit also.
If I write Wire.beginTransmission(130), Wire.beginTransmission(131) like this, will this transmit to exact address 82(hex) and 83(hex)?
Please instruct me.
Thank you
This is what WritetToPart does.
Private Sub WritetToPart(RegisterAddress As Long, RegisterData As Long)
PortWrite &HD, RegisterAddress, RegisterData
‘parameters = device address register address register data
End Sub
It does not write to I2C address 0x84 or so. It writes (very basicv interpretation) the data specified in RegisterAddress (e.g. &H84) and RegisterData (StartFrequencybyte0 ) to to the device with the I2C address &HD.
'Write in data to Start frequency register
WritetToPart &H84, StartFrequencybyte0 '84 hex lsb
WritetToPart &H83, StartFrequencybyte1 '83 hex
WritetToPart &H82, StartFrequencybyte2 '82 hex
So you do a beginTransmission for the address of the device (not of the register) and next basically write N bytes representing the registeraddress and registerdata. I say 'basiccally' because you might have to add a length to indicate how many bytes you are sending and possibly other stuff.
The exact data to be send can be found in the datasheet of the device itself. http://www.analog.com/media/en/technical-documentation/data-sheets/AD5933.pdf; I think page 28 would be a start.