380
delay_us(one_bit_delay);
delay_us(half_bit_delay);
for(bits = 0; bits < no_of_bits; bits++)
{
if(SW_UART_RXD_INPUT())
{
value += (1 << bits);
}
delay_us(one_bit_delay);
};
if(SW_UART_RXD_INPUT())
{
delay_us(half_bit_delay);
return value;
}
else
{
delay_us(half_bit_delay);
return 0;
}
}
main.c
#include <msp430.h>
#include "delay.h"
#include "SW_I2C.h"
#include "PCF8574.h"
#include "lcd.h"
#include "SW_UART.h"
void GPIO_graceInit(void);
void BCSplus_graceInit(void);
void System_graceInit(void);
void WDTplus_graceInit(void);
void main(void)
{
unsigned char rx_value = 0x00;
unsigned char tx_value = 0x20;
/* Stop watchdog timer from timing out during initial start-up. */
WDTCTL = WDTPW | WDTHOLD;
/* initialize Config for the MSP430 GPIO */
GPIO_graceInit();
/* initialize Config for the MSP430 2xx family clock systems (BCS) */
BCSplus_graceInit();