i2c help please!
ksrenterprises1
Posts: 8
I need help with i2c. I am trying to communicate with a winbond chipcorder 5116. I have a stamp bs2pe. I have two pull up 4.7k resistors on the i2c lines. One on the sda and one on the scl. my sda line is on pin 8 and scl line is on pin 9. You can·see the manual here:·········································· ······························· http://www.winbond-usa.com/products/isd_products/chipcorder/datasheets/5100/ISD5100g.pdf
the command codes are as follows(all hex);(see pg 18 in manual)
power up· 80
analog record· 90
here is the code im trying: i2cout 8, $80, [noparse][[/noparse]$80, $90]
'the first $80 is my adress. (both the a0 and a1 pins are grounded on the chipcorder)
' the second $80 is my power up command
'the $90 is my analog record command.
Is this right? if so why doesn't it work? If not then how do i do this?
Sorry if i seem stupid but this is my very first project with a microcontroller. I only program ladder logic plc.
the command codes are as follows(all hex);(see pg 18 in manual)
power up· 80
analog record· 90
here is the code im trying: i2cout 8, $80, [noparse][[/noparse]$80, $90]
'the first $80 is my adress. (both the a0 and a1 pins are grounded on the chipcorder)
' the second $80 is my power up command
'the $90 is my analog record command.
Is this right? if so why doesn't it work? If not then how do i do this?
Sorry if i seem stupid but this is my very first project with a microcontroller. I only program ladder logic plc.
Comments
I2COUT·8, $80, [noparse][[/noparse]$80]
I2COUT·8, $80, [noparse][[/noparse]$90]
Post Edit -- I see there are uses of arrays (STR), but no specific instance of one value succeeded by another as output data in the same argument.
Post Edited (PJ Allen) : 3/23/2008 6:17:40 AM GMT
Multiple bytes are allowed, but they have specific purposes. One I2COUT statement is a single transaction with an I2C start sequence at the beginning, then the device code and any address bytes, then the data bytes followed by a stop sequence. For EEPROMs, as an example, this causes a paged write to be performed. There are restrictions on how much data can be supplied with a paged write and the amount of data and starting EEPROM address is important or you can write the data to the wrong locations in the EEPROM. Different devices handle multiple data bytes in different ways. Different devices may only require one address byte or no address bytes. The device datasheets usually show detailed diagrams of what's expected.
Looking at the Winbond documentation, what they call the slave address is the I2C device select code in the I2C statements and there is no address information. Everything else is considered data. The default slave address is $80. You're absolutely correct that the command bytes ($80 and $90) need to be sent as separate I2COUT statements because they're separate transactions.
Post Edited (Mike Green) : 3/23/2008 6:44:45 AM GMT
·
I believe that you are correct. You can find more information·from within·the Stamp Editor, if you type and highlight the word I2COUT and press F1 you will get a help screen.
·
Basically you have ...
·
(START)(Slave ID)(ACK)(Address)(ACK)(Data)(ACK)(STOP)
·
... in the line:
i2cout 8, $80, [noparse][[/noparse]$80, $90]
·
.... $90 is viewed as being 'Data' and not an Address (or Command)
·
According to the pdf datasheet ( top of page 15 ) there is nothing that should be after the command byte, so ...
·
I2COUT·8, $80, [noparse][[/noparse]$80]
I2COUT·8, $80, [noparse][[/noparse]$90]
·
...looks to be the correct way to send data in this case.
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Any address select pins on the chipcorder need to be connected to ground through pulldown resistors unless the datasheet says you can ground them directly (in order to use the zero device address. As with anything like this, read the datasheet thoroughly for information on how to control it, what command sequences are needed, and what kind of initialization is required.
The multimeter should be fine for measuring the voltage, but if the voltage is too high to start, then you will probably get readings that are higher than you may expect.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Involvement and committment can be best understood by looking at a plate of ham and eggs. The chicken was involved, but the pig was committed. ANON
Damn! I guess i will call winbond and see if there is a way to check if i hurt the chipcorder or not. I also noticed that at the beginning of the chipcorder data sheet it says pin 1 and 3 are the i2c pins but at the end of the data sheet it says they are pin 1 and 2. thanks for the help and i will get back with you guys after i get word from winbond.