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 CCS Technical Support

Read to EEPROM from RS232 at 19200 baud rate?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Levett Prins
Guest







Read to EEPROM from RS232 at 19200 baud rate?
PostPosted: Sat Jun 21, 2003 6:23 am     Reply with quote

I am using a Siemens TC35 GSM modem that operates stable at 19200 baud rate and I want to read the modem output to a PIC16F877 EEPROM.

Is this technically possible and does anyone perhaps have code for this?

Thank you

Levett
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515440
Tomi
Guest







Re: Read to EEPROM from RS232 at 19200 baud rate?
PostPosted: Sat Jun 21, 2003 9:48 am     Reply with quote

WHY do you want to save TC35's answers?

:=I am using a Siemens TC35 GSM modem that operates stable at 19200 baud rate and I want to read the modem output to a PIC16F877 EEPROM.
:=
:=Is this technically possible and does anyone perhaps have code for this?
:=
:=Thank you
:=
:=Levett
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515441
Levett Prins
Guest







Re: Read to EEPROM from RS232 at 19200 baud rate?
PostPosted: Sun Jun 22, 2003 1:50 am     Reply with quote

I am saving IO parameters on the TC35 sim (e.g. analog min & max limits, port description, unit of measure etc.) and need to write it to EEPROM for use in the program.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515445
Tomi
Guest







Re: Read to EEPROM from RS232 at 19200 baud rate?
PostPosted: Sun Jun 22, 2003 3:29 am     Reply with quote

<font face="Courier New" size=-1>Then you don't have to save any incoming byte stream into the EEPROM Smile.
Just define the record structure and write functions like SaveToSIM() (if the record is changed call this function to save the modified content to SIM) and RestoreFromSIM() (call it from early main() after reset). These function could have a RAM buffer for serial comm.

:=I am saving IO parameters on the TC35 sim (e.g. analog min & max limits, port description, unit of measure etc.) and need to write it to EEPROM for use in the program.</font>
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515447
Levett Prins
Guest







Re: Read to EEPROM from RS232 at 19200 baud rate?
PostPosted: Mon Jun 23, 2003 11:49 pm     Reply with quote

I than need a RAM buffer for a 150 (max SMS length) character string. This is what I am trying to prevent!
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515503
Tomi
Guest







Re: Read to EEPROM from RS232 at 19200 baud rate?
PostPosted: Tue Jun 24, 2003 2:02 am     Reply with quote

At first, the SMS length is never limited to 150 characters. The maximum SMS bit length is 1120 bits what means 140 characters in 8-bit mode and 160 characters in 7-bit mode.
Next, if you use HW UART then you have 520 usec time between bytes what means cca. 1 msec for byte pairs. This time is long enough to receive a character pair and to convert it to binary (if you store it as characters).

If I strongly understand your concept you want to use the SIM memory based on "AT+CMGW" commands. In this case the big buffer is not necessary for write; you could have even 1 second between bytes.
The storage method: I would avoid to use pure string-based storage like "printf("\%d",myvar);". You can use "print quotable" method as described in some Internet RFC documents.
So the big buffer is not necessary for read.

All in all, I would use something like this (as I really do in 100+ TC35 Terminal based installations):

To send (save) an array:
printf("AT+CMGW=\"+36..........\"\r\n"); // init write
.....// wait for prompt
printf("[format_header]",[parameter list]);
char i,upper,lower;
for (i=0;i<ARRAYLENGTH;i++) {
lower = upper = MYARRAY[i];
lower &= 0x0F; // lower nibble
lower += '0'; // be sure it is a legal character
upper >>= 4;
upper += '0';
putch(lower);
putch(upper);
}
putch(0x1A); // Ctrl+Z for terminate writing
...........// wait for a good status

To retrieve a stored byte, ask the stored SMS, read in the header, then when your 2-byte buffer (not too big, isn't it ?) is full:

MYARRAY[actIdx++] = buffer[0] - '0' + ((buffer[1] - '0') << 4);

:=I than need a RAM buffer for a 150 (max SMS length) character string. This is what I am trying to prevent!
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515508
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
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