interfacing with EG8010 problems

hi all , im really struggling with interfacing with the EG8010, it has serial communication and i think im following the protocol but it isn't responding... hardware wise i have tried all conceivable combinations....

i get all zeros on the reply...and the commands do nothing, it would be greatly appreciated if someone more knowing could help..

#include <SoftwareSerial.h>

int incomingByte = 0;
int incomingByte2 [4];
int feedback = 0;
SoftwareSerial mySerial(10, 11); // RX, TX

void setup() {
  Serial.begin (57600);
  mySerial.begin(2400);
  pinMode (11, OUTPUT);
  pinMode (10, INPUT);





  \
}

void ON () {
  mySerial.write (0X81);
  mySerial.write (0X55);
  if (mySerial.available() > 3) {
    for (byte i; i > 4; i++) {
      incomingByte2 [i] = mySerial.read();
    }
  }
  Serial.print("I received2: ");
  Serial.println(incomingByte2 [0], HEX);
  Serial.println(incomingByte2 [1], HEX);
  Serial.println(incomingByte2 [2], HEX);
  Serial.println(incomingByte2 [3], HEX);
  if (incomingByte2 [0] ==  0X55 ) {
    digitalWrite (7, HIGH);
  } else {
    error ();
  }
}
void OFF () {
  mySerial.write (0X81);
  mySerial.write (0xAA);
  if (mySerial.available() > 3) {
    for (byte i; i > 4; i++) {
      incomingByte2 [i] = mySerial.read();
    }
  }
  Serial.print("I received2: ");
  Serial.println(incomingByte2 [0], HEX);
  Serial.println(incomingByte2 [1], HEX);
  Serial.println(incomingByte2 [2], HEX);
  Serial.println(incomingByte2 [3], HEX);
  if (incomingByte2 [0] == 0X55) {
    digitalWrite (7, LOW);
  }
  else {
    error ();
  }

}

void sethz () {
  mySerial.write (0X82);
  mySerial.write (0xAC);

  if (mySerial.available() > 3) {
    for (byte i; i > 4; i++) {
      incomingByte2 [i] = mySerial.read();
    }
  }
  Serial.print("I received2: ");
  Serial.println(incomingByte2 [0], HEX);
  Serial.println(incomingByte2 [1], HEX);
  Serial.println(incomingByte2 [2], HEX);
  Serial.println(incomingByte2 [3], HEX);
  if (incomingByte2 [0] == 0X82) {
    digitalWrite (8, HIGH);
  }
  else {
    error ();
  }
}


void error () {
  digitalWrite (13, HIGH);
}


void loop() {
  if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = mySerial.read();
    Serial.print("I received: ");
    Serial.println(incomingByte, DEC);
  }

  if (incomingByte == 49) {
    ON ();
  }
  else if (incomingByte == 50 ) {
    OFF ();
  }
  else if (incomingByte == 51) {
    sethz ();
  }
}

EG8010_datasheet_en.pdf (835 KB)

Anyone? ??

Did you find any tip ?

I'm searching too about this and didn't find any help while googling a lot of time!

Sorry for your "old" topic but it's rare to have somebody talking about the EG8010!

Thanks for an answer.

Dominique

Hi all,

i managed to get in contact with the EG8010, but i did it with assembler.

The serial connection to the EG8010 works the following: You send two bytes and the device answers immediately sending 4 bytes. But it does it very slowly. As long as the device is sending data, it cannot receive anything.

You can either wait for the 4 Bytes to receive by a while-loop (which means the controller is blocked for that time) or let an interrupt check the numer of incoming bytes and do then the next writing (if it is intended).

This is a simplified example in assembler for the reading interrupt. It is invoked repeatedly until 4 bytes have been received. It does not lose any time by waiting. More than 2 Bytes cannot be in the receive buffer (ATMGA 1284P).

RxComplete:
	in	SBuf,SREG          ;save SREG
RxInt10:
	lds	TempD1, UDR0         ;received byte
	inc	Rxn                      ;increase number of received bytes
	lds	Temp,UCSR0A
	sbrs	Temp,7	           ;still unread date in receive buffer?
	rjmp	RxInt80                ;no
RxInt60:
	lds	TempD2, UDR0        ;another byte exists
	inc	Rxn
RxInt80:
	out	SREG,SBuf
	reti

Maybe it helps ...

georg-x

Late response but I would be interested in your experience.

§8.9.3 of the datasheet states :
"MOD sets the control mode: “0”= by external I/O; “1”=by internal register "
Have you set the control mode to "1" before anything else ?
Otherwise, I guess it would never take your command into account and the EG8010 / EGS002 will keep working the way the external I/O are configured.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.