Subsections
Sent one byte in 0x0N hexadecimal format where N is the number of input followed by a second byte with value 0x00 for disable or 0x01 for enable.
Example to turn on the input 2:
Serial_write(0x02);
Serial_write(0x01);
Sent one byte in 0x1N hexadecimal format where N is the number of output and read one byte. The byte readed have value 0x00 for disable or 0x01 for enable.
Example to read output 3:
Serial_write(0x13);
valor=Serial_read(0);
Sent one byte in 0x2N hexadecimal format where N is the number of input followed by two bytes with the 16 bits value.
Example to write the value 230 on analog input 1:
Serial_write(0x21);
valor=230;
Serial_write((valor&0xFF00)>>8);
Serial_write(valor&0x00FF);
Sent one byte in 0x3N hexadecimal format where N is the number of output and read two bytes to form the 16 bits value.
Example to read analog output 2:
Serial_write(0x32);
valorh=Serial_read(0);
valorl=Serial_read(0);
valor=(valorh<<8)|valorl;
def:espmsim