📄 main.c
字号:
/*LED ioport address 810050h,810040h-81005fh*/
/*void c_int99(); /*声明中断处理函数*/
/*volatile int *io_in=(volatile int*)0x810050;
/*定义LED接口地址指针*/
/*volatile int *io_add=(volatile int*)0x808000;
/*定义C32控制器表表首 */
volatile int *intvec=(volatile int*)0x87fe00;
#define vec_addr (volatile int)0x87fe00; /*定义中断向量表表首*/
int send;
asm("ctrstr0 .word 0f10f8h");
asm("ctrstr1 .word 0010f8h");
void timer0();
void timer1();
void DR0();
void send8251();
main()
{
/*int i;*/
/*for (i=0;i<=9;i++)*/
send=0x55;
asm(" LDI 87feh,R0"); /*87feH送R0*/
asm(" LSH 16,R0"); /*左移16位,变成87fe0000*/
asm(" LDI R0,IF"); /*87fe0000H送IF,定位中断向量表,并清除所有的中断标志*/
asm(" AND 09h,IE"); /*timer interrupt disable*/
asm(" OR 09h,IE"); /*int0,int3 interrupt enable*/
asm(" OR 6000h,ST"); /*全局中断使能,边缘触发。GIE=1*/
asm(" ldp @800000h"); /*iostrb=00f8h,strb0=0f10f8h,srrb1=010f8h,*/
asm(" ldi 00F8h,r1");
asm(" sti r1,@8060h");
asm(" ldi @ctrstr0,r1");
asm(" sti r1,@8064h");
asm(" ldi @ctrstr1,r1");
asm(" sti r1,@8068h");
asm(" LDP @900000h"); /*8251 initialize*/
asm(" LDI 0eh,r0");
asm(" sti r0,@0004h");
asm(" ldi 14h,r0");
asm(" sti r0,@0004h");
timer0();
timer1();
DR0();
send8251();
/* while(1)
{
asm(" LDP @900000h");
asm(" LDI 0aah,r1");
asm(" STI r1,@01h");} */
while(1)
{
asm(" LDI 02h,IOF");
asm(" nop ");
asm(" nop ");
asm(" nop ");
asm(" nop ");
asm(" OR 06h,IOF");
}
}
/*void c_int09()
{
*io_in=~(*io_in); } /*取反,LED闪烁*/
void c_int99()
{
/*空操作*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -