avr-chat
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-chat] gsm modem stk500


From: David Breeze
Subject: Re: [avr-chat] gsm modem stk500
Date: Tue, 20 May 2008 14:42:39 +0100

I have not studied your code but the first obvious thing to stand out is that 
at 115200 Baud you will have an error of over 8% with a 4MHz clock.  The 
maximum allowable for good communications is 2%.

HTH

David

>>> agnostos <address@hidden> 17 May 2008 20:25 >>>

hello i have to make a project until this Monday and i have a big problem
i can send at commands to gsm modem but i can't get the answers and i don't
know why.
the code is
Code:
/*****************************************************
This program was produced by the
CodeWizardAVR V1.25.9 Professional
Automatic Program Generator
© Copyright 1998-2008 Pavel Haiduc, HP InfoTech s.r.l.
http://www.hpinfotech.com 

Project :
Version :
Date    : 16/5/2008
Author  : ditoskas                       
Company : ditoskas                       
Comments:


Chip type           : ATmega8515L
Program type        : Application
Clock frequency     : 4,000000 MHz
Memory model        : Small
External SRAM size  : 0
Data Stack size     : 128
*****************************************************/

#include <mega8515.h>

//TA CR KAI LF XRISIMOPOIOUNTAI GIA TIN APOSTOLI TOY ENTER.
#define CR 0x0D
#define LF 0x0A

//DEKAEKSADIKI TIMI TOY CTRL-Z EINAI I 0x1A.
#define CTRLZ 0x1A
#include <delay.h>
// Standard Input/Output functions
#include <stdio.h>
// Declare your global variables here
//char msg[127];                 
 char myData[127];
 void GetData(void)
 {                                   
        int i;   
        PORTB.1 = 1;
        delay_ms(100);
        PORTB.1 = 0;
        for (i = 0;i<10;i++)   
        {                             
                PORTB.1 = 1;
                myData[i] = getchar();               
              //  delay_ms(100);
                PORTB.1 = 0;
               // if (myData[i]=='\0')
                 //       break;
        }
 }
void SendSms(void)
{                     
        printf("at+cmgs=6938699188"); 
        putchar( CR ); //CR
        putchar( LF ); //LF 
        delay_ms(100);         
        printf("%s","TEST");
        putchar(CTRLZ);   
      //  putchar( LF ); //LF 
};

void main(void)
{
// Declare your local variables here
 
// Input/Output Ports initialization
// Port A initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTA=0x00;
DDRA=0x00;

// Port B initialization
// Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out
Func0=Out
// State7=0 State6=0 State5=0 State4=0 State3=0 State2=0 State1=0 State0=0
PORTB=0x00;
DDRB=0xFF;

// Port C initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=Out Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=1 State0=T
PORTC=0x02;
DDRC=0x02;

// Port D initialization
// Func7=In Func6=In Func5=In Func4=In Func3=In Func2=In Func1=In Func0=In
// State7=T State6=T State5=T State4=T State3=T State2=T State1=T State0=T
PORTD=0x00;
DDRD=0x00;

// Port E initialization
// Func2=In Func1=In Func0=In
// State2=T State1=T State0=T
PORTE=0x00;
DDRE=0x00;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: Timer 0 Stopped
// Mode: Normal top=FFh
// OC0 output: Disconnected
TCCR0=0x00;
TCNT0=0x00;
OCR0=0x00;

// Timer/Counter 1 initialization
// Clock source: System Clock
// Clock value: Timer 1 Stopped
// Mode: Normal top=FFFFh
// OC1A output: Discon.
// OC1B output: Discon.
// Noise Canceler: Off
// Input Capture on Falling Edge
// Timer 1 Overflow Interrupt: Off
// Input Capture Interrupt: Off
// Compare A Match Interrupt: Off
// Compare B Match Interrupt: Off
TCCR1A=0x00;
TCCR1B=0x00;
TCNT1H=0x00;
TCNT1L=0x00;
ICR1H=0x00;
ICR1L=0x00;
OCR1AH=0x00;
OCR1AL=0x00;
OCR1BH=0x00;
OCR1BL=0x00;

// External Interrupt(s) initialization
// INT0: Off
// INT1: Off
// INT2: Off
MCUCR=0x00;
EMCUCR=0x00;

// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x00;

// USART initialization
// Communication Parameters: 8 Data, 1 Stop, No Parity
// USART Receiver: On
// USART Transmitter: On
// USART Mode: Asynchronous
// USART Baud Rate: 115200
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=4000000/16/115200-1;

// Analog Comparator initialization
// Analog Comparator: Off
// Analog Comparator Input Capture by Timer/Counter 1: Off
ACSR=0x80;
PORTB.0 = 0;
PORTB.1 = 0;
//printf("ATE0\r\n");
while(1)
{
printf("AT \r\n");

PORTB.0 = 1;
scanf("%s", myData);
//GetData();
printf("at+cmgs=6938699188\r\n");

printf("%s",myData);
putchar(CTRLZ);
delay_ms(1000);
// if (myData[0] == 'O')
PORTB.0 = 0;
break;
}
}


when i use the scanf command i get the same information that i send (the AT
command) if use the GetData() the program crash out. why??? what must i
change to read a message from gsm???
(the connection between gsm and stk is why null modem cable (2 females) and
i connect the 2,3,5 pins from cable to 3,2,5 on avr the same connection is
on modem)

please help me because time pressure me and i don't know what to do...

i hope to your answer...
-- 
View this message in context: 
http://www.nabble.com/gsm-modem-stk500-tp17295380p17295380.html 
Sent from the AVR - General mailing list archive at Nabble.com.



_______________________________________________
AVR-chat mailing list
address@hidden 
http://lists.nongnu.org/mailman/listinfo/avr-chat 

This email and any files transmitted with it are confidential and intended 
solely for the use of the individual or entity to whom they are addressed.  If 
an addressing or transmission error has misdirected
this e-mail, please notify the author by replying to this e-mail.  If you are 
not the intended recipient you must not use, disclose, copy, print or rely on 
this e-mail.

Joy Mining Machinery Limited/P&H Minepro Services aims to prevent the 
propagation of viruses, but cannot guarantee that this email is virus free.  
You are advised to scan all attachments and open them at your own risk.

Joy Mining Machinery Limited/P&H Minepro Services may monitor outgoing and 
incoming e-mails and other telecommunications on its e-mail and 
telecommunication systems.
-Privacy - UK-




reply via email to

[Prev in Thread] Current Thread [Next in Thread]