BF518的寄存器名称和BF533完全不同,所以你编译后会告诉你寄存器没有定义。
BF512的接口在使用的时候,要首先定义其功能,BF533则不需要定义。
你可以用帮助文件,搜索寄存器名称,找到该接口所有寄存器的命名和功能说明,然后看懂了再用。
给你一个512中断的IO的代码,你参考一下:
init_port()
{
int iar5 = *pSIC_IAR5;
int imask1 = *pSIC_IMASK0;
*pPORTG_FER &= (~(PG6 | PG7 | PG8| PG9)); //PH4 时钟 PH5 数据 PH6 片选
*pPORTGIO_DIR &= (~(PG6 | PG7 | PG8| PG9));
*pPORTGIO_INEN |= PG6 | PG7 | PG8| PG9;
*pPORTGIO_EDGE |= PG6 | PG7 | PG8| PG9;; /* edge sensitive */
*pPORTGIO_POLAR &= (~(PG6 | PG7 | PG8| PG9)); /* rising edge */
*pPORTGIO_MASKA_SET |= PG6 | PG7 | PG8| PG9;/* enable pbs */
/* port H interrupt A is bits 20-23 of IAR3, setup for IVG11 */
iar5 |= 0x00000004;
iar5 &= 0xfffffff4;
*pSIC_IAR5 = iar5;
/* register ISR and enable port H interrupt A */
register_handler(ik_ivg11, Pushbutton_ISR);
imask1 = *pSIC_IMASK1;
imask1 |= 0x00000100;
*pSIC_IMASK1 = imask1;
}
EX_INTERRUPT_HANDLER(Pushbutton_ISR)
{
int pb_status = *pPORTGIO;
/* if PB1 pushed */
if ( 0x0040 == (pb_status & PG6) )
{
*pPORTGIO_CLEAR = PG6;
printf("PB is PG6!\n");
}
if ( 0x0080 == (pb_status & PG7) )
{
*pPORTGIO_CLEAR = PG7;
printf("PB is PG7!\n");
}
if ( 0x0100 == (pb_status & PG8) )
{
*pPORTGIO_CLEAR = PG8;
printf("PB is PG8!\n");
}
if ( 0x0200 == (pb_status & PG9) )
{
*pPORTGIO_CLEAR = PG9;
printf("PB is PG9!\n");
}
}
main(void)
{
unsigned short data;
Set_PLL(16,4);
Init_EBIU();
Init_SDRAM();
init_port();
while(1);
}