?? main.c
字號(hào):
/**************************************************************************************************
*
* Copyright (c) 2002 - 2003 Insteki Electronics (Kunshan) Corp. All rights reserved.
*
* FILENAME
* test.c
*
* VERSION
* 1.0
*
* DESCRIPTION
* This file contains the main routine for winarm project.
*
* DATA STRUCTURES
* None
*
* FUNCTIONS
* None
*
* HISTORY
* 10/28/2003 Ver 1.0 Created by Jim Lin
*
* REMARK
* None
*
*************************************************************************************************/
#include <stdio.h>
#include "740defs.h"
#define C_main
#include "ist.h"
/************** main program ***************/
int main(void)
{
/* uint8 i;
for(i=0;i<128;i++)
{
flash_buffer[i] = 0xff;
}
for(i=32;i<256;i++)
{
Fun_flash_writepage(i);
}
*/
Fun_init_system();
Fun_buzzer1();
Fun_UART_Initialize(115200); //initialize uart
while(1)
{
Fun_pccom();
}
return 0;
}
/************************************************/
/* Name: Fun_init_system */
/* In: None */
/* Out: None */
/* Description: */
/* init system */
/************************************************/
void Fun_init_system(void)
{
//open power
Power_on;
//remap interrupt vector table
*(volatile unsigned int *)0x34 = (unsigned int)IRQ_IntHandler;
//remap external i/o bank2 and bank 3;
EXT2CON = 0x6000fffd;
EXT3CON = 0x8000fffd;
//setup gpio property
GPIO_AFG = 0x00000010; //enable uart port ,others is GPIO
GPIO_DIR = 0x0002300d; //enable output
DEBNCE_CTRL =0; //disable debug mode
//load parameter from flash,
//initialize globle variable
Led_redoff; //1 sec = 100 ticks
Led_greenoff;
Buzz_off;
AIC_IMR = 0x80;
AIC_MECR = 0x80;
AIC_SCR7 = 0x41;
}
/************************************************/
/* Name: Fun_buzzer1 */
/* In: None */
/* Out: None */
/* Description: */
/* one short beep & green LED */
/************************************************/
void Fun_buzzer1(void)
{
Buzz_on;
Fun_delay_10ms(100);
Buzz_off;
}
/************************************************/
/* Name: Fun_buzzer2 */
/* In: None */
/* Out: None */
/* Description: */
/* two short beep & green LED */
/************************************************/
void Fun_buzzer2(void)
{
Buzz_on;
Fun_delay_10ms(15);
Buzz_off;
Fun_delay_10ms(10);
Buzz_on;
Fun_delay_10ms(15);
Buzz_off;
}
void Fun_delay_10ms(uint16 t)
{
uint16 i,j;
for(i=0;i<t;i++)
{
for(j=0;j<49000;j++)
{
nops;
}
}
}
void Fun_delay_1ms(uint16 t)
{
uint16 i,j;
for(i=0;i<t;i++)
{
for(j=0;j<4900;j++)
{
nops;
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -