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

Email with GPRS, or how to create a .txt file?

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



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

Email with GPRS, or how to create a .txt file?
PostPosted: Mon Jun 22, 2009 3:19 am     Reply with quote

Hi, does anyone know if there is some max size of an email when using GPRS? I'm using an Telit module and can only send about 1000 bytes at a time?? or do I have something wrong in my code.
I have tried several ways, now using an global buffer of 3000 chars Shocked but it's always only about 800 bytes that comes through.
In my program I can see that all is transmitted to the module, but it isn't then in the email, very confusing.
Code:

void send_gprs_mail(){
char my_str[21]="", OK=0;
int32 i=0, j=0, x=0;
const int CZ=0x1A;

   for(i=0;i<20;i++)
         my_str[i]=0;
   
   //disable_interrupts(GLOBAL);
   //disable_interrupts(int_TIMER0);
   output_low(PIN_B2);// DTR On     
   //output_low(PIN_B5);//debug   
 
   fprintf(GPRS,"AT#EMAILD=%s,%s,0\r",EMAIL_ADDRESS,UNIT_ID); 
   for(i=0;i<20;i++){
         my_str[i]=my_timed_getc();         
         if(my_str[i]=='>'){ i=20;OK=1;}
         }
   my_str[i+1]=0;     
   fprintf(rs232,"%s\r\n",my_str);
   
   if(OK){
   fprintf(GPRS,"%s\r\n%02u-%02u-%02u;%02u:%02u\r\n",UNIT_ID,T_YEAR,T_MONTH,T_DAY, T_HOUR,T_MIN); 
   get_email_body();
   fprintf(GPRS,"%s",E_MAIL_BODY);
   
   delay_ms(2000);
   fprintf(GPRS,"%c\r",CZ);
      for(i=0;i<20;i++){
         my_str[i]=my_timed_getc();         
         if(my_str[i]=='K') i=20;
         }
   my_str[i+1]=0;     
   fprintf(rs232,"%s\r\n",my_str);
   delay_ms(5000);
   }
   else fprintf(rs232,"No >!\r\n");
   output_high(PIN_B2);// DTR Off
   //enable_interrupts(GLOBAL);
   //enable_interrupts(int_TIMER0);
   
}
// get saved from ext flash /////////////////////////////////
//////////////////////////////////////////////////////////////////
void get_email_body(){
int32 i=0, j=0, x=0;
int8 my_i=0, my_page_count=0;
BYTE temp_buffer[100];

   //disable_interrupts(GLOBAL);   
 
   j=0;       
 
     if(PAGE_COUNTER>30){my_page_count=PAGE_COUNTER-30;j=ADDRESS_COUNTER-3000;}
     else{my_page_count=PAGE_COUNTER; j=DATA_ADDRESS;}
     x=0;
     
     
      for(i=j;i<ADDRESS_COUNTER;i++){//från address och 100 fram
         flashReadBlock(i,&E_MAIL_BODY[x],1);
         if((E_MAIL_BODY[x] != 0x0) && (E_MAIL_BODY[x] != '!') && (E_MAIL_BODY[x] != 0x1A) && (E_MAIL_BODY[x] != 0x03)&& (E_MAIL_BODY[x] != 0x02))
            x++; }     
   
     E_MAIL_BODY[x]=0x0;
     
   
    fprintf(RS232,"%s\r\n", E_MAIL_BODY);     
    //enable_interrupts(GLOBAL);
   
}

I'm using a PIC18F97J60.


Last edited by Tagge on Mon Jun 22, 2009 9:30 am; edited 1 time in total
Tagge



Joined: 23 Aug 2005
Posts: 93

View user's profile Send private message Visit poster's website

Ascii buffer to .txt?
PostPosted: Mon Jun 22, 2009 7:22 am     Reply with quote

Just figured it out, the Telit module cant take larger e-mail bodys than about 1kB. But an attached file can be much larger,
that raises the question, how can I make a ascii buffer to an .txt file?
to be sent with the e-mail.
It dont have to have the .txt end, I suppose it would work with any ending as long it only containes ascii chars?
sri
Guest







data transfer with gprs modem
PostPosted: Mon Jun 29, 2009 1:48 am     Reply with quote

hi,

did u finished the programm..i am into the project few days unable to communicate with the gprs module at commands can u please help me with the code.expecting a good response...

thanks in advance
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