Download User manual
Transcript
This message is generated when the user tries to change the ID
range base using the SET_BASEID command to a value outside
the allowed range from 0xFF800000 to 0xFFFFFFFF.
APPENDIX B
Example Code for Arduino To Read EnOcean Devices
This code has been written in 'C' for the Arduino controller board, and is a simple reader for the TCM120.
// EnOcean reader
// Simple code to read an EnOcean telegram - does not check ID of transmitter at this stage, so will operate from ANY
switch
int ledPin=13;
int packet[14]; //used as a rotational buffer
int j=0;
void setup()
{
Serial.begin(9600);
pinMode(ledPin,OUTPUT);
digitalWrite(ledPin,HIGH);
delay(250);
digitalWrite(ledPin,LOW);
Serial.println("EnOcean TCM120 reader");
//send_packet(0xAB,0x48,0,0,0,0,0,0,0,0);
}
void loop()
{
while (Serial.available())
{
// Serial.print(packet[j],HEX); Serial.print(" ");
packet[j++]=Serial.read();
j=j % 14;
if((roly(j)==0xA5) && (roly(j+1)==0x5A))
{
print_packet(j);
if(roly(j+2)==0x0B) //now we have sync bytes for receive packet
{
if((roly(j+3)==5) && (roly(j+4)==80)) digitalWrite(ledPin,HIGH); //switch is pressed ON
if((roly(j+3)==5) && (roly(j+4)==0 )) digitalWrite(ledPin,LOW ); //switch released
}
}
}
}
void print_packet(int j)
{
int i,ch=0;
Serial.print("ORG:"); Serial.print(roly(j+3),HEX);
Serial.print(" Data:"); for(i=j+4;i<=j+7;i++) { Serial.print(roly(i),HEX); Serial.print(" "); }
Serial.print("ID:"); for(i=j+8;i<=j+11;i++) { Serial.print(roly(i),HEX); Serial.print(" "); }
Serial.print("ST:"); Serial.print(roly(j+12),HEX);
Serial.print(" Chk:"); Serial.print(roly(j+13),HEX);
for(i=2;i<13;i++) ch=ch+roly(j+i);
www.exesense.com
Представитель в России – ATLAS Group, Москва, Дмитровское шоссе 100 стр. 2 phone +7 (495) 64-335-65
e-mail: info@atlasgroup.ru, sale@atlasgroup.ru
www.atlasgroup.ru