From: Jan K. <kro...@ho...> - 2012-06-03 20:48:12
|
Dear Matthias, Thanks for this. I have now a complete working I2C connection with my 7seg display and my arduino. Now I working on the tmp75 temperature controller (i2c) When this working I will publish the code for other newbies as I am! Thanks to all they helped me in the last time, this is a great forum!!! Cheers, Jan kromhout Sacharovlaan 3 3223HM Hellevoetsluis-NL Op 3 jun. 2012 om 19:39 heeft Matthias Trute <mt...@we...> het volgende geschreven: > Hi Jan, > > I'm not an expert for TWI, some I've spend some time with EEPROM > modules (dont use the code in the lib directory, its broken). > >> Dear Erich, I have done what you wrote, seems to work.But when I look >> to te code of twi.frt I see some strange thing, or missing >> sommething. When I look into the code never is sending the address in >> twi.start > > That is absolutly ok. The TWI/I2C bus has some unique characteristics, > one is that it can be considered stateful. The master has to send a > start condition (some special combinations of voltages of the affected > lines) and only after successfully aquiring the bus the master can continue. > > When the master has finished its job, it has to send a stop condition > (some special voltage combination again) to release the bus for others > (I2C is multi-master capable). > > Usually the first thing a master has to do after getting the bus is to > select a device to communicate with by sending one byte (In your > case the 0x38). If the devices answers with an ACK (see TWI status), > everything works fine and the next bytes may be transmitted. > Things can get more complicated if the device has to send > data back to the master (EEPROMs)... > > Thus I suspect the arduino code sequence (I do not know the > arduino language) > > Wire.beginTransaction(_7SEG) > ... > Wire.endTransaction(_7SEG) > > should be written as > > 0x38 constant _7SEG > twi.start \ aquire bus > _7SEG twi.tx \ select device > .... > twi.stop \ release bus, maybe reset the device state as well > > You may want to check the Atmel Appnote AVR315 for more information > Its only 11 pages... > > HTH > Matthias > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > Amforth-devel mailing list for http://amforth.sf.net/ > Amf...@li... > https://lists.sourceforge.net/lists/listinfo/amforth-devel > |