I want to transmit data from keyfob to pc..
i have attached my code here..
i modified keyfob demo example with uart application ..
can u tell me how to transmit data to PC..?...
i set the port1.4 &1.5 for tx and rx enable to connect pc using rs232 to usb cable
P1SEL = 0x30; // Configure Port 1 as GPIO, except P1.4 and 1.5for peripheral function for UART
P1DIR = 0xFF; // All port 1 pins (P1.0-P1.7) as output
P1 = 0; // All pins on port 1 to low
// initialize the ADC for battery reads
HalUARTInit();
//Initialize ADC with internal 1.25V set as reference
HalAdcSetReference( HAL_ADC_REF_125V );
// Read the ADC
adc_read = HalAdcRead( HAL_ADC_CHANNEL_VDD, HAL_ADC_RESOLUTION_10 );
/*****************************************************************************
*
* the ADC takes in one-third of VDD as its input and has a 1.25V reference
* An adc_read value of 0 corresponds to 0V at the ADC input, and a value
* of 511 corresponds to 1.25V at the ADC input (with 10 bit resolution).
*
* The CC2540 requires 2.0V at VDD to operate according to the specification.
* Therefore, we will define 2.0V as 0% battery level, and 3.0V as 100% battery
* level. Therefore the simple formula for battery percentage is:
*
* (Battery Percentage) = ((Battery Voltage) - 2.0) * 100
*
* From a software standpoint, the following calculation can be used to get the
* battery percentage:
*
* With a 3V battery, we can approximate percentage by multiplying the ADC result
* by 375, dividing by 511, and subtracting that result by 200. The value will not
* be exact, due to the rounding of integer values, but should be within one percent.
*
* For example, if the battery voltage is 2.7V, the battery percentage should
* be 70% ((2.7-2.0)*100 = 70). The ADC input will be one-third of the input (0.9V).
* This will result in an adc_read value of 367 (0.9/1.25 * 511 = 367). If we apply
* the calculation used by the software:
*
* ( (367 * 375) / 511 ) - 200 = 69
*
* This is within one percent of the actual value of 70%.
*
*/
adc_read_times_375 = (uint32)adc_read * (uint32)(375);
batteryLevel_current_read = (uint8) ( (adc_read_times_375 / (uint32)(511)) - (uint32)(200) );
/*****************************************************************************
*
* in a discharging battery state, the battery level can still fluctuate up
* and down slightly over time, so we only want to change the battery level attribute
* if it has dropped.
*
*/
if( batteryLevel_current_read < batteryLevel )
batteryLevel = batteryLevel_current_read;
if( batteryLevel < BATTERY_LEVEL_CRITICAL_PCT )
batteryState = BATTERY_STATE_CRITICAL_REPLACE_NOW;
else
batteryState = BATTERY_STATE_DISCHARGING;
HalUARTWrite(1,&batteryLevel,1);
osal_msg_send( HR_TaskID, &batteryLevel);
// Update the Battery Profile
// Battery_SetParameter( BATTERY_ATTR_LEVEL, sizeof ( uint8 ), &batteryLevel );
// Battery_SetParameter( BATTERY_ATTR_STATE