Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

UART for MSP430 not working can some one please give me some suggesting??!!

$
0
0

Dear Sir/Madam,

 

I am trying to use MSP430 to talk with a wifi module using UART, technically, the msp430G2553 does not need to know the ip address for the wifi module, so the wifi module can be considered as another mcu. 

 

I have done the hardware and the calculation of voltage received and also converted to a string value. I can also read the values using hardware UART on serial monitor, but I now wants to send the results to the wifi module and check if the wifi module receives it on socket tools. 

 

My code are as below:

 

#include <SoftwareSerial.h>

 
// to the pins used:
const int analogInPin = P1_4; //Analog input pin that the output from the current sensor is attached to
 
const int txPin = P1_1;// TXD
const int rxPin = P1_2;//RXD
 
 
SoftwareSerial mySerial(P1_2,P1_1); // I defined a new serial using 
 
.....//some definitions here :( cut that for your easier to read and hopefully help !!
 
void setup()
{
  
  //initialize serial communications at 9600bps:
  
  Serial.begin(9600);
  mySerial.begin(57600);
  pinMode(analogInPin,INPUT);
  
}
 
void loop()
{
  // put your main code here, to run repeatedly:
  
  //read the analog in value: 
   
............... something here to read and calculate 
  
 
//convert to String 
 
//char str[5];
//sprintf(str, "%.2d", current); 
char curr[6];
itoa(int((current*10+5)/10),curr,10);
//int dec = (current - (int)current)*100;
//itoa(abs (dec) , buffer, 10);
 
 
char pow[6];
itoa((power*10+5)/10,pow,10);
 
Serial.println(curr);
if (Serial.available())
{
  mySerial.write(Serial.read());
}
}
 
 
Thank you so much if you can help!
 
 
 

Viewing all articles
Browse latest Browse all 2077

Trending Articles