?? main.c
字號:
/*========================================================/
/ /
/ Copyright (C), 2001-2005, Pangu Automation. Co., Ltd. /
/ FileName: main.c /
/ Author: Zheng M.D. /
/ Version: 1.0 /
/ Date: 2005.11.12 /
/ Description: 酸度計(pH計)AD板主程序 /
/ Modify: /
/ /
/========================================================*/
#include <reg52.h>
#include "include/CS5529.h"
#include "include/time.h"
#include "include/serialcom.h"
#include "include/DAC7612.h"
#include "include/X5045.h"
#include "include/DataProces.h"
unsigned char idata channel=0; // 0:pH,1:pt1000 G,2:pt1000 D,3:Gnd,4:mA
/*************************************************
//函 數 名:SysIni()
//功 能:初始化系統,及系統內設備
//輸入參數:無
//返 回 值:無
//備 注:
*************************************************/
void SysIni()
{
__All_Int_Disable(); //關閉所有中斷
__Serial_Highest(); //設置串口中斷為最高級別
__Serial_Uart8(); // n,8,1
InitUart0();
__Int_Enable(); //中斷使能
__Uart_Enable(); //串口中斷使能
__Uart_Rec_Enable();
InitTimer2();
}
/*******************************************************************
主程序
*******************************************************************/
void main()
{
X5045_Stop(); //停止看門,以下初始化可能要花若干秒時間
//FlashLed(20);
SysIni(); //系統初始化 CS5529_Init(); //CS5529初始化
//
SelectSignalAndGain(1); //初始化通道和增益
GetCaliParam(); //取標定參數
FlashLed(20); //閃閃閃,說明程序在初始化
X5045_Start(); //啟用看門狗
while(1)
{
if(GetTimer2Flg() == 1) //時間定時到
{
ClrTimer2Flg(); //清除定時標記
ProcessADInput(channel); //AD輸入
// ProcessDAOutput();
channel++;
if(channel>4){
channel=0; //一個任務周期到
ResetWDT(); //喂狗
__RUN = ~__RUN; //一閃一閃亮晶晶 說明程序在執行
ProcessDAOutput(); //DA輸出
}
}
SaveCaliParam(); //如果要保存標定數據,則保存
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -