msp430单片机模拟IIC总线读取MMA7660三轴加速度传感器
if (X_value_final>
if(X_value_final<0)
P1OUT&=~ BIT0;
else _nop();
//------------------------------
TimerA_UART_print("X_value---->");
output((unsigned int )X_value,4);
TimerA_UART_print("
//------------------------------
output((unsigned int )Y_value,4);
TimerA_UART_print("
//------------------------------
TimerA_UART_print("Z_value---->");
output((unsigned int )Z_value,4);
TimerA_UART_print("rn");
//------------------------------
P1OUT ^= BIT6 ;
//delay_us(20000);
}
}
//-------------------华丽的分割线-----------------------------------------------------------------
//file2 : g2452uart.h
#include "msp430g2452.h"
//------------------------------------------------------------------------------
// Hardware-related definitions
//------------------------------------------------------------------------------
#define UART_TXD
#define UART_RXD
//------------------------------------------------------------------------------
// Conditions for 9600 Baud SW UART, SMCLK = 1MHz
//------------------------------------------------------------------------------
#define UART_TBIT_div_2
#define UART_TBIT
//------------------------------------------------------------------------------
// Global variables used for full-duplex UART communication
//------------------------------------------------------------------------------
unsigned int txData;
unsigned char rxBuffer;
//------------------------------------------------------------------------------
// 串口通信的接口函数说明:
//------------------------------------------------------------------------------
void TimerA_UART_init(void);
//TimerA_UART_init()模拟串口通信初始化函数,在main()函数中调用此函数就可以使用一下两个函数了
void TimerA_UART_tx(unsigned char byte);
//TimerA_UART_tx( byte ) 通过串口发送一字节的数据
void TimerA_UART_print(char *string);
//TimerA_UART_print(*string) 通过串口发送任意字节的字符穿
void output(unsigned int num , int n );
//输出一个数字
//注:接收的一字节数据存在rxBuffer变量里。
void Port1_Init()
{
}
//------------------------------------------------------------------------------
// Function configures Timer_A for full-duplex UART operation
//------------------------------------------------------------------------------
void TimerA_UART_init(void)
{
Port1_Init();
}
//------------------------------------------------------------------------------
// Outputs one byte using the Timer_A UART
//------------------------------------------------------------------------------
void TimerA_UART_tx(unsigned char byte)
{
}
//------------------------------------------------------------------------------
// Prints a string over using the Timer_A UART
//--------------------
msp430单片机模拟IIC总线MMA7660三轴加速度传感 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)