CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Error value in serial communication
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Tue Oct 17, 2017 9:28 am     Reply with quote

Thanks
I read somewhere the maximum size of an array that can be defined is limited to the amount of RAM in a bank.
If this is the case, then I've defined two arrays in the program, which is a lot more than that.

#define BUFFER_SIZE 300
char buffer[BUFFER_SIZE];

and

char recive[200];

But the compiler did not make a Error.



If the maximum amount of SRAM available to each bank from this microcontroller is equal to 96 bytes.
So, according to the description, it should not create an array of more than 96 bytes. Can this be a problem with the program?

In the meantime, if the address of the variable and the array is identical, one is in another bank.
So why the values of these variables are arranged in the array

Below are two parts of the datasheet of this microcontroller:





Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 1:04 am     Reply with quote

The CCS compiler is (now) able to handle arrays larger than a bank, on chips that support linear access (as this one does - a lot of older chips don't), _but_ the debugger can't...
It'll work, but the debugger 'loses the thread' when it happens. You will get the right actual results, and even the right values being shown in physical memory (with the hardware debugger), but if you try to look at the 'array' directly with the debugger, it'll show the wrong values. It can't cope with an array split across banks.
The same happens with things like structures split across banks.
You have to manually look at the bits of memory involved and do the calculations yourself.
This is why you need to understand the limitations of the tools....
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 2:49 am     Reply with quote

Should I write the program in the style I wrote, or EX_MXRAM.C example

Where do you think the program is wrong, since it sometimes reads out modem SMS messages and sometimes not?


Last edited by qwwe on Wed Oct 18, 2017 11:00 pm; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 3:37 am     Reply with quote

Your code is making assumptions about the message.
When you send an SMS, you can get success or error status returns. Similarly the index may not be 1.
If a second message or a part message arrives the index may be higher. You have to read all the messages. The message itself may also be multi-line.
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 3:53 am     Reply with quote

The problem is that sometimes the text of the message is stored in the smstext array, and sometimes not, for example, the text of the first message is found correctly, but not the second message
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 4:33 am     Reply with quote

Exactly.
You need to design your code to cope.
Are you sure that the message index was returned as '1'?.
You may well have multiple messages received, it is fairly common to get multiple copies, and only the last one is complete, as the network retries. The index number then to go up, and you have to retrieve them one by one to get the message...
temtronic



Joined: 01 Jul 2010
Posts: 9081
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 6:46 am     Reply with quote

I'd be capturing the data on a PC with terminal software. Not just a msg or two but say 5-10 minutes of transactions,maybe even an hour or so
THEN carefully look at what's going on...

Odds are real good there's 'some' data either you haven't thought of OR the module is not sending data as you think it should.
newguy



Joined: 24 Jun 2004
Posts: 1899

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 7:01 am     Reply with quote

A long time ago when I was developing an SMS-enabled product, my provider sent an ad to my cellular modem. That day my application suddenly became a lot more 'ruggedized'.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 7:19 am     Reply with quote

A huge amount depends on how the modem & SIM are setup.

You can specify that a SMS is 'forward and forget'. Sent just once. Then (the commonest) is 'best effort'. It may get through but may not. You can commonly add 'delivery reporting' to an SMS (you put 0# or N# in front of the message), but the actual report you get depends on your service, and may only mean the message is in the network, not that it has actually 'arrived'). Some servers reckon that up to 5% of SMS's are lost completely.....
The original SMS standard had no provision for acknowledgement. This was added to later GSM standards, but many towers still do not actually handle this.
It is quite common to get 'multiple delivery' of part of an SMS, with an entry on your phone saying you have an SMS, and nothing inside it, and then the real SMS arriving a moment later. I suspect this is what is being seen here....
qwwe



Joined: 17 Sep 2017
Posts: 59

View user's profile Send private message

PostPosted: Wed Oct 18, 2017 8:42 am     Reply with quote

Thank you.
So you believe the program has no problems.
I tested the app with a hyper terminal all the way and answer it.
But this is a problem when connected to the module.
Your answer is probably correct.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group