Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

AT commands over hyperterminal

Status
Not open for further replies.

fouwad

Full Member level 4
Joined
Nov 29, 2009
Messages
199
Helped
19
Reputation
38
Reaction score
17
Trophy points
1,298
Location
Pakistan
Activity points
2,466
hi all im doing a project for which i need to send AT commands to SIM300z from my atmega32 microcontroller,
i tested my code on hyperterminal by sending "atd03335566962;\r"
atd and the number goes fine but ';' and '\r' r not displayed on hyperterminal
plz tel me what could be the problem
regards
 

I think u'r code doesn't the exact array size.. U just post the coding lines it will be better..
 

// ***********************************************************
// Project: SMS Controller
//
// ***********************************************************
#include <avr\io.h> // Most basic include files
#include <avr\interrupt.h> // Add the necessary ones
#include <avr\signal.h> // here
#define F_CPU 1000000UL
#include<util\delay.h>
#include <math.h>

//*******************************LCD FUNCTIONS******************
//display 4-bit data






// ********************************URAT***************************
void USART_Init( unsigned int); //prototype for Intialization function
void USART_Transmit( unsigned char); //prototype for data Transmitting
// function with one input argument
// unsigned char USART_Receive( void ); //prototype for data Recieving function
// with one output argument


// ***********************************************************
int main(void) //calling main function
{
int baud=12; //loading 12 in UBBR i.e baudrate=9600
//intializing variables
// unsigned char device;
int j=0;
// unsigned char ok[20];
//unsigned char M;
//AT Instruction


unsigned char Einst1[3]={'A','T','\r'};
unsigned char Einst2[6]={'A','T','E','0','\r'};
unsigned char Einst3[16]={'A','T','D','0','3','3','3','5','5','6','6','9','6','2',';','\r'};


USART_Init(baud); //calling Intialization function



//************************************
DDRA=0xFF; //Setting Data Direction






//while(1) // Infinite loop;
//{
//}

_delay_ms(3000);

for (j=0; j<=2; j++) //sending AT
{
USART_Transmit(Einst1[j]);
// _delay_ms(10);


}
_delay_ms(500);

for (j=0; j<=3; j++) //SENDING ECHO 0
{
USART_Transmit(Einst2[j]);
_delay_ms(100);
}

_delay_ms(500);

for (j=0; j<=15; j++) //DIALING COMMANDS
{
USART_Transmit(Einst3[j]);
// _delay_ms(10);
}

PORTA=0XFF;



}

// ***********************************************************

void USART_Init( unsigned int baud ) //defining intialization function
{
UBRRL = baud; //sending value in UBRRL i.e
UCSRA |= (1<<U2X); // Setting baud rate=9600
UCSRB |= (1<<RXEN)|(1<<TXEN); // Enabling receiver and transmitter bits
UCSRC |= (1<<URSEL)|(0<<USBS)|(3<<UCSZ0)|(0<<UPM0);
//Setting frame format
//8data bits, 1stop bits, no parity

}
// ***********************************************************
void USART_Transmit( unsigned char data ) //defining data transmitting function
{
while (( UCSRA & (1<<UDRE))==0 ) ;//Wait until the transmitter buffer gets
//empty
UDR = data; //Putting data into buffer, sending the
// data
}
// *******************************************

Added after 58 seconds:

this is my code but its not working properly
plz help me with any idea how to make it right
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top