?? main.c
字號:
/********************************************************************************/
/* filename : MAIN.c */
/* created : xillinx */
/* descript : 系統的C函數入口 */
/********************************************************************************/
#include "../CPU/CPU.h"
#include "../CFG/CFG.h"
#include "../PCC/PCC.h"
#include "../UART/UART.h"
#include "../LED/LED.h"
#include "../SEG7/SEG7.h"
#include "../HC595/HC595.h"
#include "../EEPROM/EEPROM.h"
unsigned int system_timer =0x00; //* 這是系統需要的定時器變量
/********************************************************************************/
/* funname : MAIN_pcc_e24c16() */
/* created : xillinx */
/* time : 2008-08-06 */
/* descript: AT24C16調試輸出 */
/* FE 45 00 00 00 10 77 72 74 65 67 72 74 72 68 79 74 68 79 68 79 FF
/********************************************************************************/
void MAIN_pcc_e24c16(unsigned char * mdata, unsigned char length)
{ unsigned char page;
unsigned char addr;
unsigned char len;
if(mdata[0x1]!='E')
{ return;
}
page=mdata[0x3];
addr=mdata[0x4];
len =mdata[0x5];
switch(mdata[0x2])
{
case 0x0: //* write
AT24C16_write(page,addr,&mdata[0x6],len);
PCC_send_mdata('E',&mdata[0x2],0x4); //* 發送應答
break;
case 0x1: //* read
AT24C16_read(page,addr,&mdata[0x6],len);
PCC_send_mdata('E',&mdata[0x2],len+0x5); //* 發送讀取的數據
break;
default:
break;
}
}
/********************************************************************************/
/* fun_name : MAIN_interrupt_hook_process() */
/* version : v1.00 */
/* created : xillinx */
/* descript : 定時器鉤子函數的處理,如果需要使用這些函數,需要重新掛接,如果不需要 */
/* 不需要做任何事情 */
/********************************************************************************/
void MAIN_interrupt_hook_process (void)
{ CPU_001_tick_process = CPU_interrupt_proc_null; //* 定時器鉤子函數的缺省處理,如果需要使用這些函數,需要重新掛接
CPU_002_tick_process = CPU_interrupt_proc_null;
CPU_004_tick_process = CPU_interrupt_proc_null;
CPU_008_tick_process = CPU_interrupt_proc_null;
CPU_010_tick_process = CPU_interrupt_proc_null;
CPU_020_tick_process = CPU_interrupt_proc_null;
CPU_040_tick_process = CPU_interrupt_proc_null;
CPU_080_tick_process = CPU_interrupt_proc_null;
CPU_100_tick_process = CPU_interrupt_proc_null;
CPU_200_tick_process = CPU_interrupt_proc_null; //* 2x 512MS=1024MS
CPU_400_tick_process = CPU_interrupt_proc_null; //* 2x1024MS=2048MS
CPU_extern_0_process = CPU_interrupt_proc_null;
CPU_extern_1_process = CPU_interrupt_proc_null;
CPU_timer_02_process = CPU_interrupt_proc_null;
pcc_hook_process = MAIN_pcc_e24c16; //* 掛接串口處理函數
}
/********************************************************************************/
/* function : main() */
/* recension: xillinx */
/* descript : 主函數入口 */
/********************************************************************************/
void main (void)
{ unsigned int delax=0x8000;
while(delax--)
{ ;
}
UART_buffer_initilize();
MAIN_interrupt_hook_process(); //* CPU的掛接函數處理
CPU_source_initialize(); //* 控制CPU的資源
SEG7_clear_screen();
LED_clear();
HC595_refresh();
while(1)
{ PCC_recv_mdata();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -