Hello, I have translate a I2C program thats working on the arduino. It is the 7segment display from Gravitech.us ===== ARDUINO ============================= #include <Wire.h> #define _7SEG (0x38) /* I2C address for 7-Segment */ const byte NumberLookup[16] = {0x3F,0x06,0x5B,0x4F,0x66, 0x6D,0x7D,0x07,0x7F,0x6F, 0x77,0x7C,0x39,0x5E,0x79,0x71}; void setup() { Wire.begin(); /* Join I2C bus */ delay(500); /* Allow system to stabilize */ } void loop() { /* Configure 7-Segment to 12mA segment output current, Dynamic mode, and Digits 1, 2, 3 AND 4 are NOT blanked */ Wire.beginTransmission(_7SEG); Wire.send(0); Wire.send(B01000111); Wire.endTransmission(); Send7SEG (1,NumberLookup[random(0, 9) ]); Send7SEG (2,NumberLookup[random(0, 9) ]); Send7SEG (3,NumberLookup[random(0, 9) ]); Send7SEG (4,NumberLookup[random(0, 9) ]); delay(500); }
/*************************************************************************** Function Name: Send7SEG Purpose: Send I2C commands to drive 7-segment display. ****************************************************************************/ void Send7SEG (byte Digit, byte Number) { Wire.beginTransmission(_7SEG); Wire.send(Digit); Wire.send(Number); Wire.endTransmission(); } ======= and this is my amForth program ==================== marker -7seg- $38 value twi.7seg \ 7segment adress : init-7seg twi.7seg twi.start \ begin transmission $00 twi.tx $47 twi.tx twi.stop ; : send-7seg ( digit byte ) swap twi.7seg twi.start \ begin transmission twi.tx \ send digit, is position twi.tx \ send byte twi.stop ; : test-7seg init-7seg \ init the i2c connection $01 $3f send-7seg \ digit-1 => 0 $02 $06 send-7seg \ digit-2 => 1 $03 $5b send-7seg \ digit-3 => 2 $04 $4f send-7seg \ digit-4 => 3 twi.stop ; It is not working. It seems to hang. Can continue with a hard reset! Could I get some help to solve this? Thanks in advance. Cheers, Jan Kromhout Hellevoetsluis-NL ------------------------------------------------------------------------------ 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