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/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to