本帖最后由 guoke_sj 于 2011-7-24 15:27 编辑
***************************************************/
#include <msp430x14x.h>
#include "BoardConfig.h"
/****************主函数****************/
/*
data p1.0
clk p1.2
a0 p1.4
RST P1.6
gain0 p2.0
gain1 p2.2
*/
#define CLK_1 {P1OUT |= BIT2;}
#define CLK_0 {P1OUT &= ~BIT2;}
#define A0_1 {P1OUT |= BIT4;}
#define A0_0 {P1OUT &= ~BIT4;}
#define RST_1 {P1OUT |= BIT6;}
#define RST_0 {P1OUT &= ~BIT6;}
#define GAIN0_1 {P2OUT |= BIT0;}
#define GAIN0_0 {P2OUT &= ~BIT0;}
#define GAIN1_1 {P2OUT |= BIT2;}
#define GAIN1_0 {P2OUT &= ~BIT2;}
unsigned char data[24];
void main(void)
{
int i;
WDTCTL = WDTPW + WDTHOLD; //关闭看门狗
BoardConfig(0xf0); //关闭数码管和电平转换,打开流水灯
P1DIR = 0xfe;
P2DIR = 0xff; //设置P2口方向为输出
P6DIR = 0x7f;
P6OUT = 0x00;
RST_0;
_NOP();
_NOP();
_NOP();
_NOP();
CLK_0;
_NOP();
A0_1;
A0_0;
GAIN1_0;
GAIN0_0;
RST_1;
_NOP();
_NOP();
_NOP();
_NOP();
CLK_1;
CLK_0;
CLK_1;
CLK_0;
CLK_1;
CLK_0;
CLK_1;
CLK_0;
CLK_1;
CLK_0;
while(1)
{
if((P1IN&BIT1)==0)
{
for(i=0;i<24;i++)
{
P1OUT |= BIT0;//CLK=1
data = P1IN & BIT0 ;
P1OUT &= ~BIT0;//CLK=0;
}
}
CLK_1;
_NOP();
_NOP();
CLK_0;
_NOP();
_NOP();///*第25个脉冲是RDY保持高电平*/
CLK_1;
_NOP();
_NOP();
CLK_0;
_NOP();
_NOP();///*第26个脉冲进行积累误差校正*/
}
}
/*******************************************
********************************************/ |