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.

Using AT commands in C

Status
Not open for further replies.

micro sem

Newbie level 5
Joined
Mar 25, 2007
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,341
hi
can someone show me how to write AT commands in C. i m using 8051. does the command have to be in string format. Plz give a couple of examples
also i need help regarding text format of sms. how to interpret it and extract the actual message....plz help
 

now.if you wanna know At commands.I can help you
 

to send an AT command you can use a string variable and use the stdio.h standart function to help.

#include <stdio.h>

unsigned char AT[]="AT";
putchar (AT);
putchar (0x0D);

above is an simple example to send "AT" in MCU, you can try it
 

thanx BeTZ.....but i m confused.......will the putchar automatically direct the command to serial port of my 8051 or will i have to modify the stdio.h for this direction....plz help........this is urgent
 

I'm sorry, I'm wrong..........

but you can use puts ("string") instead of putchar, because puts is a procedure, in stdio.h, which it's used to send a string in serial and putchar is a send character procedure.

#include <AT89x52.h>
#include <stdio.h>

void InitUART(void)
{
TMOD=0x20;//Timer 1,Mode 2
TH1 = -3;// 9600 baud rate at 11.059 MHz
TR1=1; // Start Timer1
SCON=0x52;// 8-bit UART mode 1
}

void main (void)
{
unsigned char AT[] = "AT";
InitUART();
puts(AT);// or //puts("AT");
putchar(0x0D);
}
 

    micro sem

    Points: 2
    Helpful Answer Positive Rating
thanx BeTZ, that was of great help........just clear this plz.....what is AT89x52.h>.....i m using 8051 with keil compiler........do i need to necessarily include it or will including reg52.h do.......
 

As far as i know, it has same purpose when you included AT89x52.h or reg52.h files.

You can open and compare it (keil>>C51>>INC>>ATMEL).

Hope it can help you.....
 

Hi

See Atmel site they have project for using Cell modem with AT command all code written in C language

All the best

Bobi
 

Could you please post a link? i cant find it :-(
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top