共3条
1/1 1 跳转至页
S3C4510B S3C4510B如何初始化才能进中断(附程序)
问
新手多有不解,请多帮忙.
#include "s3c4510b.h"
void InitUART(int Port,int Baudrate);
int Main()
{
InitUART(0,0x500); //19200bps 50MHz 0=COM1;1=COM2
for(;;){
}
return(0);
}
void __irq IRQ_UART0() //仿周立功的写法 S3C4510B是否相同
{
unsigned char i;
if ((USTAT0&0x20)==0x20)
{
i=URXBUF0;
UTXBUF0=i;
}
}
void InitUART(int Port,int Baudrate)
{
if(Port==0)
{ULCON0=0x03;
UCON0=0x05;
UBRDIV0=Baudrate;
}
if(Port==1)
{ULCON1=0x03;
UCON1=0x05;
UBRDIV1=Baudrate;
}
INTMOD=0;
INTMSK=0x001fffdf;
........ //后面还得加啥,才能进中断程序IRQ_UART0()
........
}
/////////////////////////s3c4510b.h
#define IOPMOD (*(volatile unsigned *)0x03FF5000) //IO port mode register
#define IOPCON (*(volatile unsigned *)0x03FF5004) //IO port control register
#define IOPDATA (*(volatile unsigned *)0x03FF5008) //IO port data register
#define ULCON0 (*(volatile unsigned *)0x03FFD000) //UART channel0 line control register
#define UCON0 (*(volatile unsigned *)0x03FFD004) //UART channel0 control register
#define USTAT0 (*(volatile unsigned *)0x03FFD008) //UART channel0 status register
#define UTXBUF0 (*(volatile unsigned *)0x03FFD00c) //UART channel0 transimit holding register
#define URXBUF0 (*(volatile unsigned *)0x03FFD010) //UART channel0 recieve buffer register
#define UBRDIV0 (*(volatile unsigned *)0x03FFD014) //Baud rate divisor register0
#define ULCON1 (*(volatile unsigned *)0x03FFE000) //UART channel1 line control register
#define UCON1 (*(volatile unsigned *)0x03FFE004) //UART channel1 control register
#define USTAT1 (*(volatile unsigned *)0x03FFE008) //UART channel1 status register
#define UTXBUF1 (*(volatile unsigned *)0x03FFE00c) //UART channel1 transimit holding register
#define URXBUF1 (*(volatile unsigned *)0x03FFE010) //UART channel1 recieve buffer register
#define UBRDIV1 (*(volatile unsigned *)0x03FFE014) //Baud rate divisor register1
#define INTMOD (*(volatile unsigned *)0x03FF4000) //INTERAPUT MODE register
#define INTPND (*(volatile unsigned *)0x03FF4004) //INTERAPUT PAND register
#define INTMSK (*(volatile unsigned *)0x03FF4008) //
#define INTOFFSET (*(volatile unsigned *)0x03FF4024) //
#define INTOSET_FIO (*(volatile unsigned *)0x03FF4030) //
#define INTOSET_IRQ (*(volatile unsigned *)0x03FF4034) //
#define INTPRI0 (*(volatile unsigned *)0x03FF400C) //
#define INTPRI1 (*(volatile unsigned *)0x03FF4010) //
#define INTPRI2 (*(volatile unsigned *)0x03FF4014) //
#define INTPRI3 (*(volatile unsigned *)0x03FF4018) //
#define INTPRI4 (*(volatile unsigned *)0x03FF401C) //
#define INTPRI5 (*(volatile unsigned *)0x03FF4020) //
答 1: 没人能帮一下吗?刚学ARM, 好象已经问得很清楚了. 我该如何设置才能进中断运行.
#include "s3c4510b.h"
void InitUART(int Port,int Baudrate);
int Main()
{
InitUART(0,0x500); //19200bps 50MHz 0=COM1;1=COM2
for(;;){
}
return(0);
}
void __irq IRQ_UART0() //仿周立功的写法 S3C4510B是否相同
{
unsigned char i;
if ((USTAT0&0x20)==0x20)
{
i=URXBUF0;
UTXBUF0=i;
}
}
void InitUART(int Port,int Baudrate)
{
if(Port==0)
{ULCON0=0x03;
UCON0=0x05;
UBRDIV0=Baudrate;
}
if(Port==1)
{ULCON1=0x03;
UCON1=0x05;
UBRDIV1=Baudrate;
}
INTMOD=0;
INTMSK=0x001fffdf;
........ //后面还得加啥,才能进中断程序IRQ_UART0()
........
}
/////////////////////////s3c4510b.h
#define IOPMOD (*(volatile unsigned *)0x03FF5000) //IO port mode register
#define IOPCON (*(volatile unsigned *)0x03FF5004) //IO port control register
#define IOPDATA (*(volatile unsigned *)0x03FF5008) //IO port data register
#define ULCON0 (*(volatile unsigned *)0x03FFD000) //UART channel0 line control register
#define UCON0 (*(volatile unsigned *)0x03FFD004) //UART channel0 control register
#define USTAT0 (*(volatile unsigned *)0x03FFD008) //UART channel0 status register
#define UTXBUF0 (*(volatile unsigned *)0x03FFD00c) //UART channel0 transimit holding register
#define URXBUF0 (*(volatile unsigned *)0x03FFD010) //UART channel0 recieve buffer register
#define UBRDIV0 (*(volatile unsigned *)0x03FFD014) //Baud rate divisor register0
#define ULCON1 (*(volatile unsigned *)0x03FFE000) //UART channel1 line control register
#define UCON1 (*(volatile unsigned *)0x03FFE004) //UART channel1 control register
#define USTAT1 (*(volatile unsigned *)0x03FFE008) //UART channel1 status register
#define UTXBUF1 (*(volatile unsigned *)0x03FFE00c) //UART channel1 transimit holding register
#define URXBUF1 (*(volatile unsigned *)0x03FFE010) //UART channel1 recieve buffer register
#define UBRDIV1 (*(volatile unsigned *)0x03FFE014) //Baud rate divisor register1
#define INTMOD (*(volatile unsigned *)0x03FF4000) //INTERAPUT MODE register
#define INTPND (*(volatile unsigned *)0x03FF4004) //INTERAPUT PAND register
#define INTMSK (*(volatile unsigned *)0x03FF4008) //
#define INTOFFSET (*(volatile unsigned *)0x03FF4024) //
#define INTOSET_FIO (*(volatile unsigned *)0x03FF4030) //
#define INTOSET_IRQ (*(volatile unsigned *)0x03FF4034) //
#define INTPRI0 (*(volatile unsigned *)0x03FF400C) //
#define INTPRI1 (*(volatile unsigned *)0x03FF4010) //
#define INTPRI2 (*(volatile unsigned *)0x03FF4014) //
#define INTPRI3 (*(volatile unsigned *)0x03FF4018) //
#define INTPRI4 (*(volatile unsigned *)0x03FF401C) //
#define INTPRI5 (*(volatile unsigned *)0x03FF4020) //
答 1: 没人能帮一下吗?刚学ARM, 好象已经问得很清楚了. 我该如何设置才能进中断运行.
共3条
1/1 1 跳转至页
回复
有奖活动 | |
---|---|
【有奖活动】分享技术经验,兑换京东卡 | |
话不多说,快进群! | |
请大声喊出:我要开发板! | |
【有奖活动】EEPW网站征稿正在进行时,欢迎踊跃投稿啦 | |
奖!发布技术笔记,技术评测贴换取您心仪的礼品 | |
打赏了!打赏了!打赏了! |
打赏帖 | |
---|---|
与电子爱好者谈读图四被打赏50分 | |
与电子爱好者谈读图二被打赏50分 | |
【FRDM-MCXN947评测】Core1适配运行FreeRtos被打赏50分 | |
【FRDM-MCXN947评测】双核调试被打赏50分 | |
【CPKCORRA8D1B评测】---移植CoreMark被打赏50分 | |
【CPKCORRA8D1B评测】---打开硬件定时器被打赏50分 | |
【FRDM-MCXA156评测】4、CAN loopback模式测试被打赏50分 | |
【CPKcorRA8D1评测】--搭建初始环境被打赏50分 | |
【FRDM-MCXA156评测】3、使用FlexIO模拟UART被打赏50分 | |
【FRDM-MCXA156评测】2、rt-thread MCXA156 BSP制作被打赏50分 |