采集部分的思路是对信号源采集16个信号后再进行处理
#include<reg51.h>
#include <stdio.h>
#include <absacc.h>
#include <math.h>
#define PI 3.1415926;
#define uchar unsigned char
uchar ar[16];
uchar u=0;
uchar i,j , k1,b;
uchar tr,ti,a,a1;
uchar q1,q2,q3;
uchar m=4;
uchar n=16;
int max;
uchar k;
int hk[16];
uchar ai[16];
sbit p1_0=P1^0;
sbit p1_1=P1^1;
sbit p1_2=P1^2;
sbit p1_3=P1^3;
sbit p1_4=P1^4;
sbit p1_5=P1^5;
sbit p1_6=P1^6;
sbit p1_7=P1^7;
sbit p2_0=P2^0;
sbit p2_1=P2^1;
sbit p2_2=P2^2;
sbit p2_3=P2^3;
sbit ST=P3^0;
sbit OE=P3^1;
sbit EOC=P3^2;
sbit CLK=P3^3;
sbit p3_4=P3^4;
sbit p3_5=P3^5;
sbit p3_6=P3^6;
void TimeInitial();
void TimeInitial()
{ TMOD=0x11;
TH1=(65536-65535)/256;
TL1=(65536-65535)%256;
EA=1;
ET1=1;
TR1=1;
}
void main()
{
TimeInitial();
while(1){
ST=0;
OE=0;
ST=1;
ST=0;
p3_4=0;
p3_5=0;
p3_6=0;
while(EOC==0);
OE=1;
ar=P0;
u++;
if(u>15)
{
/ 信号处理程序/
.
.
.
.
.
}
}信号处理程序结束
u=0;}
OE=0;
}}
void t1(void) interrupt 3 using 0
{
TH1=(65536-65535)/256;
TL1=(65536-65535)%256;
CLK=~CLK;
}