/************************** Copyright (c) **********************************
|
** FUZHOU FUGUANG ELECTRONICS Co.,LTD.
|
** ¸£Öݸ£¹âµç×ÓÓÐÏÞ¹«Ë¾
|
** http://www.fuguang.com
|
**
|
**-------------- File Info -------------------------------------------------
|
** File name: SystemInit.c
|
** Last modified Date: 2008-11-16
|
** Last Version: 1.0
|
** Descriptions: Initialize all the device's driver and system state
|
**
|
**--------------------------------------------------------------------------
|
** Created by: mxpopstar
|
** Created date: 2008-11-16
|
** Version: 1.0
|
** Descriptions: The original version
|
**
|
**--------------------------------------------------------------------------
|
** Modified by: mxpopstar
|
** Modified date: 2008-11-20
|
** Version:
|
** Descriptions: Initialize all the device's driver and system state
|
**
|
***************************************************************************/
|
//
|
#include "SystemInit.h"
|
#include "NRF905_Driver.h"
|
#include "SST25VF_Driver.h"
|
#include "AD7843_Driver.h"
|
#include "DS1302_Driver.h"
|
#include "Buzzer_Driver.h"
|
#include "M64USART_Driver.h"
|
#include "M64PWM_Driver.h"
|
#include "MainMenu.h"
|
#include "AboutPage.h"
|
#include "FileManage.h"
|
#include "WorkingPage.h"
|
#include <avr/wdt.h>
|
#include "USBModule_Driver.h"
|
#include "SYSSetPage.h"
|
#include "KeyBoard_Driver.h"
|
#include "TFT_Driver.h"
|
#include "74HC595_Driver.h"
|
#include "M64ADC_Driver.h"
|
#include "M64Timer1.h"
|
#include "SingleVol.h"
|
|
|
extern volatile FBO_Data GB_FBO_Data;
|
extern volatile SYS_State GB_SYS_State;
|
extern unsigned int GB_TestingParm[13];
|
|
void InitSystem(void)
|
{
|
//------------ ³õʼ»¯¿´ÃŹ·(2s) -------------
|
wdt_enable(WDTO_2S);
|
wdt_reset(); //ι¹·
|
//-------------------------------------------
|
_delay_ms(100);
|
|
//------------ ³õʼ»¯TFTLCDÇý¶¯ ------------
|
InitIO_TFT();
|
Config_TFT();
|
BackColorCH();
|
|
//------- ÑÓʱ100ms,ʹµçԴϵͳÎȶ¨ ---------
|
_delay_ms(100);
|
|
//------------ ³õʼ»¯·äÃùÆ÷Çý¶¯ ------------
|
InitIO_Buzzer();
|
InitAlarmBeep();
|
|
//------------ ³õʼ»¯¼üÅÌÇý¶¯ --------------
|
InitIO_KeyBoard();
|
|
//------------ ³õʼ»¯USARTÇý¶¯ -------------
|
InitIO_M64USART0();
|
Config_M64USART0(9600);
|
|
//------------ ³õʼ»¯NRF905Ä£¿éÇý¶¯ --------
|
InitIO_NRF905();
|
Write_Config905();
|
|
//------------ ³õʼ»¯´¥ÃþÆÁÇý¶¯ ------------
|
InitIo_AD7843();
|
|
//------------ ³õʼ»¯flash´æ´¢Æ÷Çý¶¯ -------
|
InitIO_SST25VF();
|
Config_SST25VF();
|
FileManageInit();
|
|
//------------ ³õʼ»¯ÊµÊ±Ê±ÖÓÇý¶¯ ----------
|
InitIO_DS1302();
|
Config_DS1302();
|
|
//------------ ³õʼ»¯74HC595Çý¶¯ -----------
|
InitIo_HC595();
|
|
//------------ ³õʼ»¯PWMÇý¶¯ ---------------
|
InitIO_M64PWM();
|
Config_M64PWM();
|
|
//------------ ³õʼ»¯ADCÇý¶¯ ---------------
|
InitIO_M64ADC();
|
Config_M64ADC();
|
|
//------------ ³õʼ»¯PC232½Ó¿Ú -------------
|
InitIO_M64USART0();
|
Config_M64USART0(192);
|
|
//------------ ³õʼ»¯UÅÌ½Ó¿Ú ----------------
|
InitIO_M64USART1();
|
Config_M64USART1(1152);
|
|
//************ ³õʼ»¯¶¨Ê±¼ÆÊýÆ÷3 ***********
|
TIFR |= 0x04;
|
TCCR1B = TCCR1A = 0;//¼ÆÊýÆ÷3¹¤×÷ÔÚÆÕͨµÄ¼ÆÊýģʽ
|
TCNT1 = 0x8F7F; //-----¼ÆÊý³õÖµ
|
//*******************************************
|
|
GetTestingParm(0);
|
GB_TestingParm[0] = 0;//ÉèÖÃΪÔÚÏ߷ŵç
|
GB_TestingParm[1] = 0;//Í£Ö¹·Åµç
|
|
GB_SYS_State.CurrentPage = DSPMainMenu;
|
GB_SYS_State.GetInput = GetMenuSelected;
|
GB_SYS_State.DealTimer1Up = M64Timer1UpNull;
|
GB_SYS_State.TestType = TestTypeDischarge;
|
GB_SYS_State.WorkState = Stopped;
|
GB_SYS_State.SaveDateEN = 0;
|
|
GB_SYS_State.OnlineLowLimit = 0;
|
GB_SYS_State.OnlineVolLow = 0;
|
GB_SYS_State.TempHighCount = 0;
|
GetButtonIsBeep(1);
|
GetExtClamprange(1);
|
}
|
//
|
|
/********************** END OF FILE (SystemInit.c)*************************/
|