This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Memory overflow problem

Hi all,

I'm using 89C52 controller in my application. I'm using a 90 byte buffer to store received message from UART. Based on this received message I'm controlling I/O ports. The same buffer I'm using for transmitting the application dependent internal status message.

To identify the message I'm using absolute address position for example, if(arr[59] == '*'){do something;}

every first message after reset this is working fine. After that the control hangs somewhere thus its giving undetermined behavior.

I set the memory model as Large: all variables in XDATA.

I hope some address overflow is happening here.

Can anyone help me to resolve this issue.

Thanks in Advance.

Regards,
Ramesh

Parents
  • It can work quite ok with a shared buffer, if the serial interrupt knows about framing characters in the received message, and can ignore reception of new characters until an answer has been sent, or until the main application has flagged that the received message is broken - in which case it might be good to design the protocol with a NACK message.

    To do it without any synchronization can lead to very hard-to-catch problems.

Reply
  • It can work quite ok with a shared buffer, if the serial interrupt knows about framing characters in the received message, and can ignore reception of new characters until an answer has been sent, or until the main application has flagged that the received message is broken - in which case it might be good to design the protocol with a NACK message.

    To do it without any synchronization can lead to very hard-to-catch problems.

Children
  • Thanks.

    Exactly,

    I'm not using any synch mechanism here. Whatever message comes in Im receiving it and processing the message. Note that its loop of 35 characters. Im interseted only first 35 characters. after processing the message i'm transmitting the status.

    I cant use any synch mechanism here because the message will vary every time its not in my control. I'm intersted in only first 35 chars in that i will searc for my command string is available or not with a encapsulation of special characters like @,#,$ etc.

    Please suggest.