This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Question on ez430rf2500

Other Parts Discussed in Thread: CC2500, MSP430F2274, SIMPLICITI

sir,

       I'm learning basics about ez430rf2500, aware of temperature sensor monitor demo program.  I am trying to connect analog  output (0-4.9v) at End point and send it   wirelessly  to the access point.  My need to view that transmitted analog signal  in digital form. My output on Hyper terminal as follows

original temperature sensor monitor demo output:

$HUB0,109.7F,3.5,000,N#
$0001, 94.1F,2.5,052,N#
$HUB0,109.0F,3.5,000,N#
$0001, 94.1F,2.5,051,N#
$HUB0,110.4F,3.5,000,N#
$HUB0,109.7F,3.5,000,N#
$0001, 94.8F,2.5,050,N#
$HUB0,109.0F,3.5,000,N#
$0001, 94.1F,2.5,050,N#
$HUB0,109.7F,3.5,000,N#
$0001, 94.8F,2.5,051,N#
$HUB0,109.7F,3.5,000,N#
$HUB0,109.7F,3.5,000,N#
$0001, 94.1F,2.5,050,N#
$HUB0,110.4F,3.5,000,N#
$0001, 94.1F,2.5,050,N#
$HUB0,109.7F,3.5,000,N#
$0001, 94.8F,2.5,050,N#
$HUB0,109.7F,3.5,000,N#
$HUB0,109.7F,3.5,000,N#

After connecting the external analog output to channel 3 of ADC10CTL. the output as follows:

$HUB0,110.4F,3.5,000,N#         (Access point output)
$0001,-71.6F,2.5,040,N#           (End point output)
$HUB0,110.4F,3.5,000,N#
$0001,288.8F,2.6,041,N#
$HUB0,111.2F,3.5,000,N#
$HUB0,111.2F,3.5,000,N#
$0001,-71.6F,0.0,038,N#
$HUB0,110.4F,3.5,000,N#
$0001,288.8F,2.5,037,N#
$HUB0,110.4F,3.5,000,N#
$0001,288.8F,2.5,039,N#
$HUB0,110.4F,3.5,000,N#
$HUB0,111.2F,3.5,000,N#
$0001,-71.6F,0.0,039,N#
$HUB0,110.4F,3.5,000,N#
$0001,288.8F,2.6,037,N#
$HUB0,110.4F,3.5,000,N#
$0001,-71.6F,0.0,038,N#
$HUB0,110.4F,3.5,000,N#
$HUB0,110.4F,3.5,000,N#
$0001,288.8F,2.5,036,N#
$HUB0,110.4F,3.5,000,N#
$0001,288.8F,2.5,035,N#
$HUB0,111.2F,3.5,000,N#

Is the Boldered Number indicate the output of transmitted analog signal in digital form?

I need an output like this

$HUB0,110.4F,3.5,000,N#
$HUB0,110.4F,3.5,000,N#
$0001,-4V,2.5,036,N#
$HUB0,110.4F,3.5,000,N#
$0001.-2V,2.5,035,N#

$HUB0,110.4F,3.5,000,N#
$0001,2V,2.5,035,N#
$HUB0,111.2F,3.5,000,N#

$0001, 4V,2.5,035,N#

Is it possible?

  • The output onto the console port is generated by the application code running on the Access Point.  You should review the software of both the AP and ED to get a better understanding of the structure.  Keep in mind, the End Device does need to send all of the ASCII characters to the Access Point associated with "$0001,288.8F,2.5,035,N#".  In fact, if memory serves me, the End Device only sends a few bytes of information, its own supply voltage and the ADC results of the on chip temperature sensor.  It is the AP that parses this information and converts it into a more readible ASCII string format.

    To answer your question about "Is it possible" to convert these results into a form that prints out a voltage rather than a temperature, yes, it is possible.  Again, take a look at the application code for the Access Point and End Device to see how they interact.  I'm not talking about the wireless communications stack code, but the small application code that ties it all together.

    Interestingly, I seem to recall a flurry of posts similar to this "connect an Analog signal to eZ430-RF2500 and transmit wirelessly" about this time last year.  Perhaps you might perform a series of searches in the Low Power RF forums as well as this one for some key words and I'm sure you will see similar ideas.

  • thanks for your reply. we have seen output in digital form. my next Aim is to view that transmitted analog signal at any one of  external pins of target board ( Access point. ). from the CC2500 data Sheet i know  that Ez430rf2500 has no DAC but only has ADC.  how to Retrieve original  analog signal?. My point is Connecting external DAC with CC2500 . Is it correct? if  Yes what are the modifications to be needed in Access point program?

  • It appears your requirements are evolving in this discussion.  If I understanding correctly, you want to convert an analog signal at the End Device, transmit this information wirelessly to another device and reconstruct the analog signal at the Access Point.

    The MSP430F2274 microcontroller used on the eZ430-RF2500 has a 10-bit ADC on chip.  You are correct, there is no DAC.  The CC2500 is simply a 2.4GHz radio transceiver (aka transmitter / receiver).  If you need the reconstruct the analog signal on one of the nodes of the wireless network, you need to either use a PWM output through a low pass filter network to mimic DAC-like functionality, or connect an external DAC device to the MSP430F2274.  There are application notes for the MSP430 family that can be used to help with the PWM DAC function.  Otherwise look for application notes on connecting an external DAC.

     

    Another approach would be to use the Purepath Wireless Audio solution for this purpose.  Just something to consider.

  • Sir, You mentioned that PWM output through a low pass filter to get an original signal. But from the CC2500 data sheet , it supports the OOK, 2-FSK, GFSK, and MSK Modulation Techniques . from where i get PWM output to demodulate it?

  • I apologize if I was not clear.  I mixed talking about the CC2500 and the MSP430F2274 in the same paragraph.

    My comments about a PWM output is from the MSP430F2274.

  • Sir,

     Thanks for the Reply. We got a sample program for PWM generation using Timer A from the MSP430rf2274 (msp430x22x4_ta_16.c).  It works well. how can i Interlink with the Access point Program. How to prove myself that the transmitted Signal are in the form of Pulse Modulated signal in msp430rf2274 at access point ?

  • My suggestion would be for you to start with an existing example from the eZ430-RF2500 software that represents your network topology and integrate the additional functionality from the code example you cited to tailor to your end application goals.

  • Sir,

      i went through some basic example to get the PWM signal.  in order to get the PWM signal , need to move the digital value to capture/ compare control register of timer . I changed the Access point program with the Bolder-ed one.

    Access point demo:


    #include "bsp.h"
    #include "mrfi.h"
    #include "bsp_leds.h"
    #include "bsp_buttons.h"
    #include "nwk_types.h"
    #include "nwk_api.h"
    #include "nwk_frame.h"
    #include "nwk.h"

    #include "msp430x22x4.h"
    #include "vlo_rand.h"

    #define MESSAGE_LENGTH 3
    void TXString( char* string, int length );
    void MCU_Init(void);
    void transmitData(int addr, signed char rssi,  char msg[MESSAGE_LENGTH] );
    void transmitDataString(char addr[4],char rssi[3], char msg[MESSAGE_LENGTH]);
    void createRandomAddress();

    //data for terminal output
    const char splash[] = {"\r\n--------------------------------------------------\r\n     ****\r\n     ****           eZ430-RF2500\r\n     ******o****    Temperature Sensor Network\r\n********_///_****   Copyright 2007\r\n ******/_//_/*****  Texas Instruments Incorporated\r\n  ** ***(__/*****   All rights reserved.\r\n      *********     Version 1.02\r\n       *****\r\n        ***\r\n--------------------------------------------------\r\n"};

    __no_init volatile int tempOffset @ 0x10F4; // Temperature offset set at production
    __no_init volatile char Flash_Addr[4] @ 0x10F0; // Flash address set randomly

    // reserve space for the maximum possible peer Link IDs
    static linkID_t sLID[NUM_CONNECTIONS];
    static uint8_t  sNumCurrentPeers;

    // callback handler
    static uint8_t sCB(linkID_t);

    // work loop semaphores
    static uint8_t sPeerFrameSem;
    static uint8_t sJoinSem;
    static uint8_t sSelfMeasureSem;

    // mode data verbose = default, deg F = default
    char verboseMode = 1;
    char degCMode = 0;

    void main (void)
    {
      addr_t lAddr;
      bspIState_t intState;

      WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
      {
      // delay loop to ensure proper startup before SimpliciTI increases DCO
      // This is typically tailored to the power supply used, and in this case
      // is overkill for safety due to wide distribution.
        volatile int i;
        for(i = 0; i < 0xFFFF; i++){}
      }
      if( CALBC1_8MHZ == 0xFF )                 // Do not run if cal values are erased
      {
        volatile int i;
        P1DIR |= 0x03;
        BSP_TURN_ON_LED1();
        BSP_TURN_OFF_LED2();
        while(1)
        {
          for(i = 0; i < 0x5FFF; i++){}
          BSP_TOGGLE_LED2();
          BSP_TOGGLE_LED1();
        }
      }
        
      BSP_Init();
     
      if( Flash_Addr[0] == 0xFF &&
          Flash_Addr[1] == 0xFF &&
          Flash_Addr[2] == 0xFF &&
          Flash_Addr[3] == 0xFF )
      {
        createRandomAddress();                  // set Random device address at initial startup
      }
      lAddr.addr[0]=Flash_Addr[0];
      lAddr.addr[1]=Flash_Addr[1];
      lAddr.addr[2]=Flash_Addr[2];
      lAddr.addr[3]=Flash_Addr[3];
      SMPL_Ioctl(IOCTL_OBJ_ADDR, IOCTL_ACT_SET, &lAddr);
     
      MCU_Init();
      //Transmit splash screen and network init notification
      TXString( (char*)splash, sizeof splash);
      TXString( "\r\nInitializing Network....", 26 );

      SMPL_Init(sCB);
     
      // network initialized
      TXString( "Done\r\n", 6);

      // main work loop
      while (1)
      {
        // Wait for the Join semaphore to be set by the receipt of a Join frame from a
        // device that supports and End Device.
        
        if (sJoinSem && (sNumCurrentPeers < NUM_CONNECTIONS))
        {
          // listen for a new connection
          SMPL_LinkListen(&sLID[sNumCurrentPeers]);
          sNumCurrentPeers++;
          BSP_ENTER_CRITICAL_SECTION(intState);
          if (sJoinSem)
          {
            sJoinSem--;
          }
          BSP_EXIT_CRITICAL_SECTION(intState);
        }
        
        // if it is time to measure our own temperature...
        if(sSelfMeasureSem)
        {
          char msg [6];
          char addr[] = {"HUB0"};
          char rssi[] = {"000"};
          int degC, volt;
          volatile long temp;
          int results[2];
          
          ADC10CTL1 = INCH_10 + ADC10DIV_4;     // Temp Sensor ADC10CLK/5
          ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE + ADC10SR;
          for( degC = 240; degC > 0; degC-- );  // delay to allow reference to settle
          ADC10CTL0 |= ENC + ADC10SC;           // Sampling and conversion start
          __bis_SR_register(CPUOFF + GIE);      // LPM0 with interrupts enabled
          results[0] = ADC10MEM;
        
          ADC10CTL0 &= ~ENC;
        
          ADC10CTL1 = INCH_11;                  // AVcc/2
          ADC10CTL0 = SREF_1 + ADC10SHT_2 + REFON + ADC10ON + ADC10IE + REF2_5V;
          for( degC = 240; degC > 0; degC-- );  // delay to allow reference to settle
          ADC10CTL0 |= ENC + ADC10SC;           // Sampling and conversion start
          __bis_SR_register(CPUOFF + GIE);      // LPM0 with interrupts enabled
          results[1] = ADC10MEM;
          ADC10CTL0 &= ~ENC;
          ADC10CTL0 &= ~(REFON + ADC10ON);      // turn off A/D to save power
          
          // oC = ((A10/1024)*1500mV)-986mV)*1/3.55mV = A10*423/1024 - 278
          // the temperature is transmitted as an integer where 32.1 = 321
          // hence 4230 instead of 423
          temp = results[0];
          degC = (((temp - 673) * 4230) / 1024);
          if( tempOffset != 0xFFFF )
          {
            degC += tempOffset;
          }
          
          temp = results[1];
          volt = (temp*25)/512;
          
          msg[0] = degC&0xFF;
          msg[1] = (degC>>8)&0xFF;
          msg[2] = volt;
          transmitDataString(addr, rssi, msg );
          BSP_TOGGLE_LED1();
          sSelfMeasureSem = 0;
        }
        P4DIR |=0x10;                                                        // to view the pulse modulated signal at target pin 10
        CCTL0=CCIE;
        CCTL1=CCIE;
       // CCRO=256;                                                         
        CCR1=  msg[0];                                                    // moving the digital value to capture/ compare control register
        TACTL=TASSEL_2 + MC_1 +TAIE+TACLR;
       _BIS_SR(LPM0_bits + GIE);
        
        // Have we received a frame on one of the ED connections?
        // No critical section -- it doesn't really matter much if we miss a poll
        if (sPeerFrameSem)
        {
          uint8_t     msg[MAX_APP_PAYLOAD], len, i;

          // process all frames waiting
          for (i=0; i<sNumCurrentPeers; ++i)
          {
            if (SMPL_Receive(sLID[i], msg, &len) == SMPL_SUCCESS)
            {
              ioctlRadioSiginfo_t sigInfo;
              sigInfo.lid = sLID[i];
              SMPL_Ioctl(IOCTL_OBJ_RADIO, IOCTL_ACT_RADIO_SIGINFO, (void *)&sigInfo);
              transmitData( i, (signed char)sigInfo.sigInfo[0], (signed char*)msg );
              BSP_TOGGLE_LED2();
              BSP_ENTER_CRITICAL_SECTION(intState);
              sPeerFrameSem--;
              BSP_EXIT_CRITICAL_SECTION(intState);
            }
          }
        }
      }
    }

    /*------------------------------------------------------------------------------
    *
    ------------------------------------------------------------------------------*/
    void createRandomAddress()
    {
      unsigned int rand, rand2;
      do
      {
        rand = TI_getRandomIntegerFromVLO();    // first byte can not be 0x00 of 0xFF
      }
      while( (rand & 0xFF00)==0xFF00 || (rand & 0xFF00)==0x0000 );
      rand2 = TI_getRandomIntegerFromVLO();
     
      BCSCTL1 = CALBC1_1MHZ;                    // Set DCO to 1MHz
      DCOCTL = CALDCO_1MHZ;
      FCTL2 = FWKEY + FSSEL0 + FN1;             // MCLK/3 for Flash Timing Generator
      FCTL3 = FWKEY + LOCKA;                    // Clear LOCK & LOCKA bits
      FCTL1 = FWKEY + WRT;                      // Set WRT bit for write operation
     
      Flash_Addr[0]=(rand>>8) & 0xFF;
      Flash_Addr[1]=rand & 0xFF;
      Flash_Addr[2]=(rand2>>8) & 0xFF;
      Flash_Addr[3]=rand2 & 0xFF;
     
      FCTL1 = FWKEY;                            // Clear WRT bit
      FCTL3 = FWKEY + LOCKA + LOCK;             // Set LOCK & LOCKA bit
    }

    /*------------------------------------------------------------------------------
    *
    ------------------------------------------------------------------------------*/
    void transmitData(int addr, signed char rssi,  char msg[MESSAGE_LENGTH] )
    {
      char addrString[4];
      char rssiString[3];
      volatile signed int rssi_int;

      addrString[0] = '0';
      addrString[1] = '0';
      addrString[2] = '0'+(((addr+1)/10)%10);
      addrString[3] = '0'+((addr+1)%10);
      rssi_int = (signed int) rssi;
      rssi_int = rssi_int+128;
      rssi_int = (rssi_int*100)/256;
      rssiString[0] = '0'+(rssi_int%10);
      rssiString[1] = '0'+((rssi_int/10)%10);
      rssiString[2] = '0'+((rssi_int/100)%10);

      transmitDataString( addrString, rssiString, msg );
    }

    /*------------------------------------------------------------------------------
    *
    ------------------------------------------------------------------------------*/
    void transmitDataString(char addr[4],char rssi[3], char msg[MESSAGE_LENGTH] )
    {
      char temp_string[] = {" XX.XC"};
      int temp = msg[0] + (msg[1]<<8);

      if( !degCMode )
      {
        temp = (((float)temp)*1.8)+320;
        temp_string[5] = 'F';
      }
      if( temp < 0 )
      {
        temp_string[0] = '-';
        temp = temp * -1;
      }
      else if( ((temp/1000)%10) != 0 )
      {
        temp_string[0] = '0'+((temp/1000)%10);
      }
      temp_string[4] = '0'+(temp%10);
      temp_string[2] = '0'+((temp/10)%10);
      temp_string[1] = '0'+((temp/100)%10);
     
      if( verboseMode )
      {
        char output_verbose[] = {"\r\nNode:XXXX,Temp:-XX.XC,Battery:X.XV,Strength:XXX%,RE:no "};

        output_verbose[46] = rssi[2];
        output_verbose[47] = rssi[1];
        output_verbose[48] = rssi[0];
        
        output_verbose[17] = temp_string[0];
        output_verbose[18] = temp_string[1];
        output_verbose[19] = temp_string[2];
        output_verbose[20] = temp_string[3];
        output_verbose[21] = temp_string[4];
        output_verbose[22] = temp_string[5];
        
        output_verbose[32] = '0'+(msg[2]/10)%10;
        output_verbose[34] = '0'+(msg[2]%10);
        output_verbose[7] = addr[0];
        output_verbose[8] = addr[1];
        output_verbose[9] = addr[2];
        output_verbose[10] = addr[3];
        TXString(output_verbose, sizeof output_verbose );
      }
      else
      {
        char output_short[] = {"\r\n$ADDR,-XX.XC,V.C,RSI,N#"};

        output_short[19] = rssi[2];
        output_short[20] = rssi[1];
        output_short[21] = rssi[0];
        
        
        output_short[8] = temp_string[0];
        output_short[9] = temp_string[1];
        output_short[10] = temp_string[2];
        output_short[11] = temp_string[3];
        output_short[12] = temp_string[4];
        output_short[13] = temp_string[5];
       
        output_short[15] = '0'+(msg[2]/10)%10;
        output_short[17] = '0'+(msg[2]%10);
        output_short[3] = addr[0];
        output_short[4] = addr[1];
        output_short[5] = addr[2];
        output_short[6] = addr[3];
        TXString(output_short, sizeof output_short );
      }
    }

    /*------------------------------------------------------------------------------
    *
    ------------------------------------------------------------------------------*/
    void TXString( char* string, int length )
    {
      int pointer;
      for( pointer = 0; pointer < length; pointer++)
      {
        volatile int i;
        UCA0TXBUF = string[pointer];
        while (!(IFG2&UCA0TXIFG));              // USCI_A0 TX buffer ready?
      }
    }

    /*------------------------------------------------------------------------------
    *
    ------------------------------------------------------------------------------*/
    void MCU_Init()
    {
      BCSCTL1 = CALBC1_8MHZ;                    // Set DCO
      DCOCTL = CALDCO_8MHZ;
     
      BCSCTL3 |= LFXT1S_2;                      // LFXT1 = VLO
      TACCTL0 = CCIE;                           // TACCR0 interrupt enabled
      TACCR0 = 12000;                           // ~1 second
      TACTL = TASSEL_1 + MC_1;                  // ACLK, upmode
     
      P3SEL |= 0x30;                            // P3.4,5 = USCI_A0 TXD/RXD
      UCA0CTL1 = UCSSEL_2;                      // SMCLK
      UCA0BR0 = 0x41;                           // 9600 from 8Mhz
      UCA0BR1 = 0x3;
      UCA0MCTL = UCBRS_2;                       
      UCA0CTL1 &= ~UCSWRST;                     // **Initialize USCI state machine**
      IE2 |= UCA0RXIE;                          // Enable USCI_A0 RX interrupt
      __enable_interrupt();
    }
    /*------------------------------------------------------------------------------
    * Runs in ISR context. Reading the frame should be done in the
    * application thread not in the ISR thread.
    ------------------------------------------------------------------------------*/
    static uint8_t sCB(linkID_t lid)
    {
      if (lid)
      {
        sPeerFrameSem++;
      }
      else
      {
        sJoinSem++;
      }
      // leave frame to be read by application.
      return 0;
    }

    /*------------------------------------------------------------------------------
    * ADC10 interrupt service routine
    ------------------------------------------------------------------------------*/
    #pragma vector=ADC10_VECTOR
    __interrupt void ADC10_ISR(void)
    {
      __bic_SR_register_on_exit(CPUOFF);        // Clear CPUOFF bit from 0(SR)
    }

    /*------------------------------------------------------------------------------
    * Timer A0 interrupt service routine
    ------------------------------------------------------------------------------*/
    #pragma vector=TIMERA0_VECTOR
    __interrupt void Timer_A (void)
    {
      sSelfMeasureSem = 1;
    }

    /*------------------------------------------------------------------------------
    * USCIA interrupt service routine
    ------------------------------------------------------------------------------*/
    #pragma vector=USCIAB0RX_VECTOR
    __interrupt void USCI0RX_ISR(void)
    {
      char rx = UCA0RXBUF;
      if ( rx == 'V' || rx == 'v' )
      {
        verboseMode = 1;
      }
      else if ( rx == 'M' || rx == 'm' )
      {
        verboseMode = 0;
      }
      else if ( rx == 'F' || rx == 'f' )
      {
        degCMode = 0;
      }
      else if ( rx == 'C' || rx == 'c' )
      {
        degCMode = 1;
      }
    }

    #pragma vector=TIMERA0_VECTOR
    __interrupt void TIMERA0_ISR(void)
    {
      P4OUT|= 0x10;
      CCR1= msg[0];
    }

    #pragma vector=TIMERA1_VECTOR
    __interrupt void TIMERA1_ISR(void)
    {
      switch(TAIV)
      {
      case 2:
        P4OUT &= ~0x10; // Clear P4.5 to determine duty cycle.
        break;
      default:
        break;
      }
    }


    after compiling i got the errors

    Building configuration: Access Point - Debug
    Updating build tree...
     
    10  file(s) deleted.
    Updating build tree...
    bsp.c  
    demo_AP.c  
    Error[Pe020]: identifier "msg" is undefined C:\Documents and Settings\scad\Desktop\johnson kennady\watteyne_ezwsn_sourcecode\source_code\ti_demo\demo_AP.c 246
    Warning[Pe167]: argument of type "signed char *" is incompatible with parameter of type "char *" C:\Documents and Settings\scad\Desktop\johnson kennady\watteyne_ezwsn_sourcecode\source_code\ti_demo\demo_AP.c 264
    Warning[Pa093]: implicit conversion from floating point to integer C:\Documents and Settings\scad\Desktop\johnson kennady\watteyne_ezwsn_sourcecode\source_code\ti_demo\demo_AP.c 336
    Error[Pe020]: identifier "msg" is undefined C:\Documents and Settings\scad\Desktop\johnson kennady\watteyne_ezwsn_sourcecode\source_code\ti_demo\demo_AP.c 502
    Error while running C/C++ compiler
    mrfi.c  
    nwk_globals.c  
    vlo_rand.s43
     
    Total number of errors: 2
    Total number of warnings: 2

     i know CCTL1 is 16 bit register and the Resultant Digital value (msg[0]) is 8 bit value. thats why i troubled with Errors. how can i leave from the Errors?


  • The error is generated because the char msg [6]; is not defined with global context, yet it is being used by the interrupt service routine TIMERA0_ISR().

    You need to move the definition of msg[] such that it can be "seen" by main() and TIMERA0_ISR().  This is a generic C issue.

  • Sir,

    i compiled the following program

    End point:

    #include "bsp.h"

    #include "mrfi.h"

    #include "radios/family1/mrfi_spi.h"

     

    void sleep(unsigned int count);

    #define RED_SEND_LED                               0x01 //Red

     

    //Read from an Analog input

    int analogRead(int channel)

    {

                    int result;

                    ADC10CTL0 = SREF_1 + ADC10SHT_3 + REFON + ADC10ON + ADC10IE + REF2_5V;

                    TACCR0 = 30;                                                                                                                      // Delay to allow Ref to settle

                    TACCTL0 |= CCIE;                             // Compare-mode interrupt

                    TACTL = TASSEL_2 + MC_1;                          // Clock Setup

                    __bis_SR_register(CPUOFF + GIE);                          // LPM0, TA0_ISR allowed

                    TACCTL0 &= ~CCIE;                         // Disable timer Interrupt

                   

                    // P2.3 -> analog input - A3

    if (channel == 3)

                    {

                                    ADC10CTL0 |= REF2_5V;                                                                               // 2.5V Reference

                                    ADC10CTL1 = INCH_3 + ADC10DIV_3;                      // Input Selct and Clock Div

                                    P2SEL = 0x08;                                                                                                     // Pin Select

                                    ADC10AE0 = 0x08;                                                                                            // ADC Low Bit (A3)

                                    ADC10AE1 = 0x00;                                                                                            // ADC High Bit

                    }

     

                    ADC10CTL0 |= ENC + ADC10SC;                                                                  // Start to sample

                    __bis_SR_register(CPUOFF + GIE);          // LPM0 w/ int

                    result = ADC10MEM;                                                                                                      // Store Result

                    if (result < 0) result = 0;                                                                 // Correct for potential Weirdness

     

                    ADC10AE0 = 0;                                                                                                                   // Reset Selection Bits

                    ADC10AE1 = 0;

                    return result;                                                                                                                     // Return Result

    }

     

    // Converts a positive integer to a string for transmission

    // Str = null-terminated string.

    // *str = array that can hold the number of digits in limit + 1.

    void itoa(unsigned int val, char *str, unsigned int limit)

    {

                    int temploc = 0;

                    int digit = 0;

                    int strloc = 0;

                    char tempstr[5]; //16-bit number can't be more than 5 digits

     

                    if(val>limit) val %= limit;

     

                    do

                    {

                                    digit = val % 10;

                                    tempstr[temploc++] = digit + '0'; //Use the '0' Ascii char to do some clever conversion

                                    val /= 10;

                    }

                    while (val > 0);

     

                    // Put the computed digits in the output string

                    while(temploc>0)

                                    str[strloc++] = tempstr[--temploc];

                    str[strloc]=0;

    }

     

    //Main Execution of the program

    main()

    {

                   

                    int analoginput;

                    char c[4];

                   

                   

                    mrfiPacket_t      packet;

                    unsigned char msg[9];

                   

                    BSP_Init();

                   

                    MRFI_Init();

                    MRFI_WakeUp();

                   

                    //Disable Watchdog Timer

                    WDTCTL = WDTPW + WDTHOLD;

                   

                    //Red LED P1.1

                    P1DIR |= 0x01;

                    P1OUT |= 0x00;

                   

                    //Analog Input Setup

                   

                    //P2.3 = A3  = Pin 6          = analog input

                   

                    P2DIR &= ~0x08; // P2.3 is Input

                   

                    //Global Interrupt Enable

                    __bis_SR_register(GIE);

                   

                    //Read Analog Sensors Forever!

                    while(1)

                    {

                                   

                                    //Read analog input

                                    analoginput = analogRead(3);

                                    analoginput = (int) (((((analoginput /1023.0)*2.5)-.45)*100.0)/1.5); //Derived from Datasheet Info

                                    sleep(60000);

                                   

                                   

                                    itoa(analoginput, c, 999);

                                    if (analoginput < 10)

                                    {

                                                    msg[3] = '0';

                                                    msg[4] = '0';

                                                    msg[5] = c[0];

                                    }

                                    else if (analoginput < 100)

                                    {

                                                    msg[3] = '0';

                                                    msg[4] = c[0];

                                                    msg[5] = c[1];

                                    }

                                    else

                                    {

                                                    msg[3] = c[0];

                                                    msg[4] = c[1];

                                                    msg[5] = c[2];

                                    }

                                   

                                   

                                   

                                    //Copy message into the packet.

                                    strcpy( &packet.frame[9] , msg );

                                   

                                    /** Enter source and destination addresses  **/

                                    //Source address here is useless, as this is a send-only application.

                                    memset( &packet.frame[1], 0x20, 4);

                                    memset( &packet.frame[5], 0x10, 4);

                                   

                                    // Enter length of packet.

                                    packet.frame[0] = 8 + strlen(msg); // 8-byte header, 20-byte payload.

                                   

                                    //Transmit

                                    MRFI_Transmit(&packet , MRFI_TX_TYPE_FORCED);

                                   

                                    //Toggle led.

                                    P1OUT ^= RED_SEND_LED;

                                   

                                    //sleep.

                                    sleep(60000);

                                    sleep(60000);

                                    sleep(60000);

                                    sleep(60000);

                                    sleep(60000);

                    }

                   

    }

     

    void MRFI_RxCompleteISR(void)

    {

                    //Dummy function for a SEND-only application;

                    //still needs to be defined for the project to compile properly.

    }

     

     

    //A simple delay

    void sleep(unsigned int count)

    {

                    int i;

                   

                    for (i = 0; i < 10; i++)

                    {

                                    while(count > 0)

                                    {

                                                    count--;

                                                   

                                                    __no_operation();

                                                    __no_operation();

                                                    __no_operation();

                                    }

                    }

    }

     

     

    // ADC10 interrupt service routine

    #pragma vector=ADC10_VECTOR

    __interrupt void ADC10_ISR(void)

    {

      __bic_SR_register_on_exit(CPUOFF);        // Clear CPUOFF bit from 0(SR)

    }

     

    #pragma vector=TIMERA0_VECTOR

    __interrupt void TA0_ISR(void)

    {

      TACTL = 0;                                // Clear Timer_A control registers

      __bic_SR_register_on_exit(CPUOFF);        // Clear CPUOFF bit from 0(SR)

    }

    after compilation it  shown the error  could not open the source file "radios/family1/mrfi_spi.h".  i included the source file under the components gorup but it shows the similar error. how can i rectify it sir?

    Building configuration: End Device - Debug
    Updating build tree...
     
    9  file(s) deleted.
    Updating build tree...
    bsp.c  
    demo_ED.c  
    Fatal Error[Pe005]: could not open source file "radios/family1/mrfi_spi.h" C:\Documents and Settings\scad\Desktop\source_code\ti_demo\demo_ED.c 4
                searched: "C:\Documents and Settings\scad\Desktop\source_code\ti_demo\"
                searched: "C:\Documents and Settings\scad\Desktop\source_code\ti_demo\Components\bsp\"
                searched: "C:\Documents and Settings\scad\Desktop\source_code\ti_demo\Components\bsp\mcus\"
                searched: "C:\Documents and Settings\scad\Desktop\source_code\ti_demo\Components\bsp\drivers\"
                searched: "C:\Documents and Settings\scad\Desktop\source_code\ti_demo\Components\bsp\boards\EZ430RF\
    "
                searched: "C:\Documents and Settings\scad\Desktop\source_code\ti_demo\Components\mrfi\"
                searched: "C:\Documents and Settings\scad\Desktop\source_code\ti_demo\Components\SimpliciTI\nwk\"
                searched: "C:\Documents and Settings\scad\Desktop\source_code\ti_demo\Components\SimpliciTI\Network  
    applications\"
                searched: "C:\Documents and Settings\scad\Desktop\source_code\drivers\mrfi\radios\family1\"
                searched: "C:\Program Files\IAR Systems\Embedded Workbench 5.4 Kickstart\430\INC\"
                searched: "C:\Program Files\IAR Systems\Embedded Workbench 5.4 Kickstart\430\INC\CLIB\"
    Error while running C/C++ compiler
    mrfi.c  
    nwk_globals.c  
    vlo_rand.s43
     
    Total number of errors: 1
    Total number of warnings: 0

     

     

  • What IDE are you using, just for my reference?

    You likely need to describe to the IDE's C Compiler the following include paths:

    <PATH_TO>\Components\bsp
    <PATH_TO>\Components\bsp\drivers
    <PATH_TO>\Components\bsp\boards\EZ430RF
    <PATH_TO>\Components\mrfi
    <PATH_TO>\Components\SimpliciTI\nwk
    <PATH_TO>\Components\SimpliciTI\nwk_applications

  • sir,

    i am using IAR workbenck 5.4 kickstart for my application.

    8204.pic.docx

    i included your mentioned paths but still has similar error.

  • Based on your attachment, do you actually have directories and paths from your project directory referenced by $PROJ_DIR$ to the following locations:

    $PROJ_DIR$\Components\bsp
    $PROJ_DIR$\Components\mrfi
    $PROJ_DIR$\Components\bsp\drivers
    etc.

    In comparison, the existing examples available show the following for me.

    $PROJ_DIR$\..\..\..\..\..\Components\bsp
    $PROJ_DIR$\..\..\..\..\..\Components\mrfi
    $PROJ_DIR$\..\..\..\..\..\Components\bsp\drivers
    etc.

    I used the <PATH_TO> as a generic reference, making no assumptions about your machine's directory organization.

  • Sir,

     In the analog signal transmission, i transmit the sine wave signal with a frequency of 320 Hz at End Point and i receive the signal like the following attached image at access point.

    signal specifications:

     input sine signal at End Point:-

                    time= 6ms

                    Voltage= 0.14V

                    Frequency= 319.83 Hz

    Output PWM signal at Access Point:-

                    time= 34ms

                    voltage= 0.06 V

    Is my output correct Sir?

**Attention** This is a public forum