I MAKE A TEST WITH THIS CODE:
Code:
void EscreveDisplay (unsigned char *pMensagem, unsigned int pDelaySec){
unsigned char cDispPacote [52];
int iComDisplay = 2;
unsigned int iLims;
unsigned int iLenMsg, iLenCont, iContIndex;
int iBcc;
iDisplaySend = 1;
if (pDelaySec > 0)
Delay(pDelaySec * 1000);
iLims = 46;
cDispPacote [0] = 129;
cDispPacote [1] = 126;
cDispPacote [2] = iLims % 256;
cDispPacote [3] = iLims / 256;
cDispPacote [4] = 1 % 256;
cDispPacote [5] = 1 / 256;
cDispPacote [6] = 0 % 256;
cDispPacote [7] = 0 / 256;
cDispPacote [8] = 76;
cDispPacote [9] = 202;
iLenMsg = strlen (pMensagem);
for (iLenCont=10; iLenCont<=49; iLenCont++)
cDispPacote [iLenCont] = '.';
for(iLenCont=0; iLenCont<iLenMsg; iLenCont++){
iContIndex = iLenCont + 10;
cDispPacote [iContIndex] = pMensagem [iLenCont];
}
iBcc = cDispPacote [4];
cDispPacote [50] = iBcc;
cDispPacote [51] = '\0';
for(iContIndex=0; iContIndex<=51; iContIndex++){
ToCom (iComDisplay, cDispPacote[iContIndex]);
DelayMs (2);
}
iDisplaySend=0;
}
and call this:
Code:
void UserCount(void)
{
if (iDisplaySend == 0){
VerificaBotoes ();
if (iVazia)
RecebeSerial ();
if (iPesaItem)
RecebeSerial ();
if (iStepTimer >= 1 && iStepTimer < 10)
iStepTimer++;
}
}
void UserInit(void)
{
unsigned char *MsgDisplay;
InitLib();
PortUser = 5050; // Habilita porta 5050 para Controle do Usuário (Aplicação Objeto de Comunicação (Listener))
// Transforma os Int em Char (ASCII)
cSTX = 2;
cCR = 13;
cLF = 10;
cTab = 9;
IniciaSerial ();
IniciaMemoria();
strcpy (MsgDisplay, "LENKE AUTOMACAO 1");
EscreveDisplay (MsgDisplay, 2);
strcpy (MsgDisplay, "LENKE AUTOMACAO 2");
EscreveDisplay (MsgDisplay, 2);
strcpy (MsgDisplay, "LENKE AUTOMACAO 3");
EscreveDisplay (MsgDisplay, 2);
AddUserTimerFunction(UserCount, 200); // Adiciona Timer para Chamar Função UserCount a cada 200 ms
}
and the resul is ok:
LENKE AUTOMACAO 1................................
LENKE AUTOMACAO 2................................
LENKE AUTOMACAO 3................................
BUT, AFTER THE SYSTEM HAS STOPPPED :\\\\\\\