Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

prgram code for interfacing of sim300 gsm modem with msp430f5529

$
0
0

Sir i m not getting results wen i try to interface sim300 gsm modem with msp430f5529 rather wen i debug my program i get error message in register of uart i.e unable to read

however dere is no error while building up program wat could be d reason for dat..

following is my code plz reply asap

#include <msp430f5529.h>
void UART_putChar (char c);
void UART_write (unsigned char serial_data);
char UART_getChar ();
char UART_getCharIsReady ();
void gsm_cmd( char *string);
void delay(int i);


void main(void)
{
P4SEL = BIT5+BIT4;
P4DIR |= BIT4; // port direction for TXD0
P4DIR &= ~BIT5; // port direction for RXD0
P1DIR=0x01;
UCA1CTL1 |= UCSWRST; // **Put state machine in reset**
UCA1CTL1 |= UCSSEL_1; // CLK = ACLK
UCA1BR0 = 0xD8; // 9600 (see User's Guide)
UCA1BR1 = 0x00; //
UCA1MCTL |= UCBRS_6+UCBRF_0; // Modulation UCBRSx=6, UCBRFx=0
UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA1IE |= UCRXIE; // Enable USCI_A1 RX interrupt

__bis_SR_register( GIE); // interrupts enabled
gsm_cmd("AT\r\n");
delay(100);
gsm_cmd("AT+CMGF=1\r\n");
delay(100);
gsm_cmd("AT+CMGS=\"+919815942820\"\r\n");
 delay(100);
gsm_cmd("hello");
UART_write(0x1a);
delay(100);
}
void UART_putChar (char c) // UART1 Transmit Subroutine
{
while ((UCA1IFG&UCTXIFG) == 0); // Wait for ready U1TXBUF
{
UCA1TXBUF = c;
P1OUT=0x01;// send data

//UCA1IFG &=0xfd;
}
}
void UART_write (unsigned char serial_data)
{

UART_putChar (serial_data);
}

char UART_getCharIsReady ()
{
return (UCA1IFG & UCRXIFG) != 0;
}
char UART_getChar ()
{
while (!UART_getCharIsReady ());
return UCA1RXBUF;
}

void gsm_cmd( char *string)
{
int i=0;
while(string[i]!='\0')
{
if(string[i]==0x5C) // Not to send '\' cahracter
i++;

UART_write(string[i]);
i++;
}
//UCA1IFG &=0xfd;
}
//void delay(int i)
{
 int j;
 for(j=1;j<i;j++)
 {
}

 


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>