last code: http://pastebin.com/m796dc78a
I continue execute a program by a loop,
when next loop is call, the program crash.
I have eliminated various global variables strings, and tried your tips, but some not function perfectly with my equipment.
last code: http://pastebin.com/m796dc78a
I continue execute a program by a loop,
when next loop is call, the program crash.
I have eliminated various global variables strings, and tried your tips, but some not function perfectly with my equipment.
Any chance you could post a few samples of input?
I would rewrite the serial comms to read from a file.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
This is a Code of Serial packets, with value weights captureds:
http://www.4shared.com/file/80304658...edoSample.html
This is a Log of my Socket Client, with all packets receiveds and send, this log is a loop complete of my program.
http://www.4shared.com/file/80304999...172161520.html
I Suspect a problem with function EscreveDisplay,
because I make a test,
I StartProgram, and next connected with my client socket app,
the my program call a function PortUserStart
then, I send to pc the number iUserSocket through EnviaPedidoPC
And my client socket has received only ...........
The function EscreveDisplay complete a text with ... to c omplete 40 chars.
Code:void PortUserStart(int skt) { iUserSocket = skt; } void EnviaPedidoPC (unsigned char *pChar, int pTamanho){ unsigned char *cMsgFinal; int iLen; Delay (200); pTamanho += 4; cMsgFinal = malloc (pTamanho); if (cMsgFinal == NULL) VcomSendSocket(iUserSocket, "1-ERRO DE ALOCAÇÃO DE MEMÓRIA", 29); if (iUserSocket){ sprintf(cMsgFinal, "%c%s%c%c", cSTX, pChar, cCR, cLF); // Formata Pacote iLen = strlen (cMsgFinal); VcomSendSocket(iUserSocket, cMsgFinal, iLen); } free (cMsgFinal); }
I know I often write a lot in my posts. And some of it may be rubbish. However:
[quote="Me"]
You are going to the 52nd element of a 51 element array - not good.
Then Me:Originally Posted by You
Yes.
You appear to not have made this change... It will definitely not help.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
sorry, i has change this code, but then the display dont show the message,
i was reported to, at some post back...
now i has changed again,
without display
but send, .......... continues
I suspect this part, is several to program.Code:unsigned char *pMensagem if (iLenMsg < 40){ for(iLenCont=iLenMsg; iLenCont<40; iLenCont++) strcat (pMensagem, "."); }
Last edited by sergioms; 01-12-2009 at 03:36 PM.
Changed this:
to this:Code:unsigned char *cFuncao; unsigned char *cSubFuncao;
The program Crash here:Code:unsigned char cFuncao[4]; unsigned char cSubFuncao[32];
in some part of this code :SCode:else if (strcmp (cFuncao, "OK") == 0){ // Tratamento de Confirmações substring(&cPacote[2], cSubFuncao, 2); if (strcmp (cSubFuncao, "OP") == 0) { // Recebe Confirmação de Ordem de Pesagem EnviaPedidoPC ("OISL", 4); }
I don't see anything wrong in that code. However, it is possible that it crashes because of something else that went on BEFORE that.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.