MSP430单片机驱动MSM7512程序
#define uint unsigned int
#define uchar unsigned char
//P1.2接RD(第9脚)
#define MOD1_1 P1OUT |= BIT0 //P1.0接MOD1(第14脚)
#define MOD1_0 P1OUT &= ~BIT0
#define MOD2_1 P1OUT |= BIT1 //P1.1接MOD2(第15脚)
#define MOD2_0 P1OUT %= ~BIT1
void SysInit(uint x)
{
if (x == 1)
{
P1DIR = 0XFF;P1OUT = 0XFF; //初始化P1
P2DIR = 0XFF;P2OUT = 0XFF; //初始化P2
P3DIR = 0XFF;P3OUT = 0XFF; //初始化P3
P4DIR = 0XFF;P4OUT = 0XFF; //初始化P4
P5DIR = 0XFF;P5OUT = 0XFF; //初始化P5
P6DIR = 0XFF;P6OUT = 0XFF; //初始化P6
WDTCTL = WDTPW + WDTHOLD; //关闭看门狗
}
}
int main( void )
{
SysInit(1);
MOD2_0; //使用模式1,即解调模式
MOD1_1;
P3DIR = 0x00; //设置P1.2为输入状态
P4OUT = P3IN & BIT2;
while (1)
{
P4OUT = P3IN & BIT2;
if(P4OUT == 0) //AI输入为2100Hz
{
P2OUT &= ~BIT0;
}
else
{
P2OUT &= ~BIT1;
}
}
}
MSP430单片机MSM751 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)