基于51單片機太陽能電池太陽跟蹤裝置程序設(shè)計
#include
#include
#define uchar unsigned char
#define uint unsigned int
#define ysfs 600 //宏定義 預(yù)設(shè)風(fēng)速
#define shuiping 1500 //宏定義 水平位置AD轉(zhuǎn)換結(jié)果
#define fuyang 1500 //宏定義 俯仰位置AD轉(zhuǎn)換結(jié)果
#define PA XBYTE [0x7CFF] //8255芯片端口4個基地址宏定義
#define PB XBYTE [0x7FFD]
#define PC XBYTE [0x7FFE]
#define CONTROL XBYTE [0x7FFF]
sbit OE=P1^0; //以下為關(guān)于AD0808與單片機的八個接口定義
sbit EOC=P1^1;
sbit START=P1^2;
sbit CLK=P1^3;
sbit ALE=P1^4;
sbit C0=P1^5;
sbit C1=P1^6;
sbit C2=P1^7;
sbit gdkg=P2^3; //用于復(fù)位光電開關(guān)端口定義
sbit clock=P2^0; //定義水平俯仰步進電機的速度端口,頻率越快,速度越快,不給頻率電機不轉(zhuǎn)
sbit cw1=P2^1; //定義水平步進電機的轉(zhuǎn)向端口,1正轉(zhuǎn),0反轉(zhuǎn)
sbit enable1=P2^2; //定義水平步進電機的使能端口,1轉(zhuǎn),0不轉(zhuǎn)
sbit cw2=P2^4; //定義俯仰步進電機的轉(zhuǎn)向端口,1正轉(zhuǎn),0反轉(zhuǎn)
sbit enable2=P2^5; //定義俯仰步進電機的使能端口,1轉(zhuǎn),0不轉(zhuǎn)
uint ad_result_fenshu,ad_result_shuiping,ad_result_fuyang;
void timer_init()
{
}
void AD_chane(int x)
{
C1=0;
C2=0;
C1=0;
C2=0;
C1=1;
C2=0;
}
int Get_AD_Sd()
{
}
void reset()
{
}
void shuiping_tiaozheng(int date)
{
}
void fuyang_tiaozheng(int date)
{
}
void main()
{
ALE=0;
enable1=0;
enable2=0;
while(1) //進入循環(huán)
{
}
}
void timer0() interrupt 1
{
}
void timer1() interrupt 3
{
}
關(guān)鍵詞:
51單片機太陽能電池太陽跟蹤裝
評論