📄 main.c
字号:
//*********************************************************************************************************************
//【 版 权 】Copyright (c) 2007-2008 http://gliethttp.cublog.cn
//
//【 文 件 版 本 】v1.x
//
//【 文 件 名 称 】main.c
//
//【 创 建 日 期 】2007-12-27
//
//【 功 能 描 述 】
//*********************************************************************************************************************
#include <ads7843.h>
#include <XDBGU.h>
#include <coms.h>
//--------------------------------------------------------------
struct irqdesc {
int triggered: 1;
int running : 2;
int pending : 1;
int probing : 1;
int probe_ok : 1;
int valid : 1;
int noautoenable : 1;
};
void testxxxxxx(void)
{struct irqdesc im;
int count;
count = sizeof(struct irqdesc);
im.triggered = 1;
im.running = 5;
im.pending = 1;
im.probe_ok = 1;
}
void __irq OS_Time_Tick_IRQ_Handler(void);
void OS_Time_Tick_IRQ_ini(void)
{volatile uint32 dummy;
//2005-12-19 防止中途停止后没能复位(直接映象软件升级)
/*
GMCLK/128 128/GMCLK秒-0.139808秒
SCLK 1/SCLK 秒-1.999969482421875秒
*/ //1.0033秒一次
//#define OS_Tick_freq ((32768*10033/10000/*OS_TICKS_PER_SEC*/)-1)//系统时钟频率为 OS_TICKS_PER_SEC
#define XOS_Time_ticks_per_sec 5/*一秒中断5次 即:200ms一个时钟*/
#define OS_Tick_freq ((32768/XOS_Time_ticks_per_sec)-1)
*AT91C_TC0_CCR = AT91C_TC_CLKDIS;
*AT91C_AIC_IDCR = (uint32)(1 << AT91C_ID_TC0); //Disable timer 0 interrupt at AIC level
dummy = *AT91C_TC0_SR;
*AT91C_AIC_ICCR = (1 << AT91C_ID_TC0); //Clear the TC0 interrupt
AT91F_AIC_AcknowledgeIt(AT91C_BASE_AIC);
AT91F_TC0_CfgPMC();
*AT91C_TC0_CMR = (0x4 | AT91C_TC_CPCTRG);
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)OS_Time_Tick_IRQ_Handler;//Set the TC0 IRQ handler address
AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = (2); //Set the trigg and priority for TC0 interrupt
*AT91C_TC0_RC = OS_Tick_freq; //OS_TICKS_PER_SEC
*AT91C_TC0_CCR = AT91C_TC_CLKEN; //Enable the Clock Counter
*AT91C_TC0_IER = AT91C_TC_CPCS; //Validate the RC compare interrupt
*AT91C_AIC_IECR = (1 << AT91C_ID_TC0); //Enable the TC0 interrupt
*AT91C_TC0_CCR = (AT91C_TC_CLKEN | AT91C_TC_SWTRG);
}
//---------------------------------------------------------------------------------------------------------------------
void __irq OS_Time_Tick_IRQ_Handler(void)
{volatile uint32 dummy;dummy = *AT91C_TC0_SR;
*AT91C_AIC_ICCR = (1 << AT91C_ID_TC0);
AT91C_BASE_AIC->AIC_EOICR = 0;
}
void Main(void)
{
testxxxxxx();
xat91_remap();
XDBGU_ini();
coms_ini(0);
coms_ini(1);
coms_ini(2);
coms_ini(3);
ads7843_ini();
OS_Time_Tick_IRQ_ini();
{uint32 i;for(i = 0;i < 0xffff;i++);}
xxxdprintf("\r\n\ads7843测试程序启动!\r\n");
for(;;)
{
ads7843_proc();
{static uint32 count = 0;
if(count++ == 0x8ffff)
{
count = 0;
xxxdprintf("D");
xxxdprintf_coms(0,"0");
xxxdprintf_coms(1,"1");
// xxxdprintf_coms(2,"2");
xxxdprintf_coms(3,"3");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -