%Comunicações
BAUD        = 19200;
DATABITS    = 8;
STOPBITS    = 2;
PARITY      = 'none';
HANDSHAKE   = 'none';
PORT        = 'COM1';
TX_LENGTH   = 5;
RX_LENGTH   = 2;        

STARTBYTE   = hex2dec('80');
PULLUP5     = 0;
PULLUP6     = 0;

%Caracteristicas
ANGLE_MIN       = -90;
VAL_ANGLE_MIN   = 600;
ANGLE_MAX       = 90;
VAL_ANGLE_MAX   = 2400;
SPEED_MIN       = 1;
SPEED_MAX       = 100;

%Campo "Command"
READ_EEPROM         = hex2dec('E1');
WRITE_EEPROM        = hex2dec('E2');
READ_MEM            = hex2dec('E3');
WRITE_MEM           = hex2dec('E4');
READ_POS            = hex2dec('E5');
SET_POS_ALL         = hex2dec('E6');
READ_VERSION_ID     = hex2dec('E7');
READ_PW_V           = hex2dec('E8');
SET_SPEED_READ_POS  = hex2dec('E9');
CTRL_PARAM_SET      = hex2dec('EA');
GO_STOP             = hex2dec('EB');
RELEASE             = hex2dec('EF');

%Máscaras
MASK_HIGH = hex2dec('FF00');
MASK_LOW  = hex2dec('00FF');

%Endereços EEPROM
ID_ADDR    = hex2dec('29');
CS_ADDR    = hex2dec('2C');
SPEED_ADDR =      6;

%Endereços Memória
CUR_TRAJ_LOW_MEMADDR  = 6;
CUR_TRAJ_HIGH_MEMADDR = 7;

%Parâmetros Controlo 1

%Resolução da Tensão
V_RESOLUTION = 0.03522;

%Erros
OK                      = 0;
ERR_READ_EEPROM         = 1;
ERR_WRITE_EEPROM        = 2;
ERR_READ_MEM            = 3;
ERR_WRITE_MEM           = 4;
ERR_READ_POS            = 5;
ERR_SET_POS_ID          = 6;
ERR_SET_POS_ALL         = 7;
ERR_READ_VERSION_ID     = 8;
ERR_READ_PW_V           = 9;
ERR_SET_SPEED_READ_POS  = 10;
ERR_CTRL_PARAM_SET      = 11;
ERR_GO_STOP             = 12;
ERR_RELEASE             = 13;
ERR_RX_MSG              = 14;

