using variable value in between string of uart.

General discussion on mikroC.
Post Reply
Author
Message
ajumt
Posts: 9
Joined: 28 Nov 2011 07:44

using variable value in between string of uart.

#1 Post by ajumt » 24 Apr 2012 11:27

I am on a simple project that reads a message from a gsm modem(sim900) and makes the
pic to turn on and off some devices connected to it.
i need to transmit the temperature read from adc0 to gsm modem, in between some predefined strings.
and also i need to use the string value in 'switch'. How could i do that.
Please help on this.
thanks in advance.

Code: Select all

   
do
   {
    if(uart1_data_ready()==1)
    read_message();                           /*read message from gsm modem*/
    switch(message)
     {
      case 'ON' :relay(1);                    /*relay is a function that turn on/off a relay connected to pic*/
      case 'OFF':relay(0);
     }
   }while(1)
in uart i need to transmit a string as message body for gsm modem.
Eg:"TEMPERATURE =32degree celsius"

Code: Select all

uart1_write_text("Temperature="+txt+ " degree celsius"); /* txt is a character array */

Post Reply

Return to “mikroC General”