free 8051 Microcontroller Projects AVR PIC Microcontroller Projects Tutorials Ebooks Libraries, interfacing tutorials, lcd tutorial, stepper motor, dc motor 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems

 
8051 microcontroller 8051 microcontroller
Forums

Moderators: Ajay, Junied , abbas1707, Arun Kumar V, pdi33, Shailesh NAYAK, ۞ TPS ۞, shyam, sashijoseph
Author Post
PRK
Fri Jun 06 2008, 12:43AM
 User Offline
Registered Member #8280
Joined: Fri Jun 06 2008, 12:34AM

Posts: 1
Thanked 0 times in 0 post
Hi, I'm a student working on a GSM modem that receives SMS messages through AT commands from a PIC microcontroller. I have been able to get the modem to communicate with my PC and I have also been able to have the PIC communicate with my PC. However, I am to have the two communicate with each other. My code compiles and executes however no message is sent. My code is below:

#include <p30fxxxx.h>
#include "system.h"
#include "uart.h"


//Declaration to Link External Functions & Variables:
extern Delay5ms (int);

//Functions and Variables with Global Scope:
void INTx_IO_Init(void);
unsigned char *LCDCharPtr;


void InitUART1(void)
{
unsigned int U1MODEvalue;
unsigned int U1STAvalue;
unsigned int baudvalue = 23; // ((FCY[MIPS]/16)/BAUDRATE) -1 -> 8 = 230400 baud
// 17 = 115200 baud

CloseUART1();
IFS0bits.U1RXIF=0;
IFS0bits.U1TXIF=0;

ConfigIntUART1(UART_RX_INT_DIS & UART_RX_INT_PR6 & UART_TX_INT_DIS &
UART_TX_INT_PR2);
U1MODEvalue = UART_EN & UART_IDLE_CON & UART_DIS_WAKE & UART_DIS_LOOPBACK &
UART_EN_ABAUD & UART_NO_PAR_8BIT & UART_1STOPBIT;
U1STAvalue = UART_INT_TX_BUF_EMPTY & UART_TX_PIN_NORMAL & UART_TX_ENABLE
&UART_INT_RX_3_4_FUL & UART_ADR_DETECT_DIS & UART_RX_OVERRUN_CLEAR ;
OpenUART1(U1MODEvalue,U1STAvalue,baudvalue);
}


int main(void)
{

InitUART1();
INTx_IO_Init();
while(1)
{

putsUART1((unsigned int*)"AT\r");
while(BusyUART1());
Delay5ms(1000);

putsUART1((unsigned int*)"AT+CSQ\r");
while(BusyUART1());
Delay5ms(1000);


putsUART1((unsigned int*)"AT+CMGF=1\r");
while(BusyUART1());
Delay5ms(1000);

putsUART1((unsigned int*)"AT+CMGS = 3014556841\r");
while(BusyUART1());
Delay5ms(1000);

putsUART1((unsigned int*)"Hello Pooya");
while(BusyUART1());
Delay5ms(1000);
WriteUART1(0x1A);
while(BusyUART1());
WriteUART1('\r');
while(BusyUART1());
Delay5ms(1000);



}
return 0;
}

Thank you for your time.

Back to top


 

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System

8051 Microcontroller Projects 8051 AVR tutorials PIC microcontroller, 8051 assembly language programming electronics and communication ECE CSE pdf ebooks library BE final year project ideas Embedded systems