共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 跳转至页
回复
| 有奖活动 | |
|---|---|
| 硬核工程师专属补给计划——填盲盒 | |
| “我踩过的那些坑”主题活动——第002期 | |
| 【EEPW电子工程师创研计划】技术变现通道已开启~ | |
| 发原创文章 【每月瓜分千元赏金 凭实力攒钱买好礼~】 | |
| 【EEPW在线】E起听工程师的声音! | |
| 高校联络员开始招募啦!有惊喜!! | |
| 【工程师专属福利】每天30秒,积分轻松拿!EEPW宠粉打卡计划启动! | |
| 送您一块开发板,2025年“我要开发板活动”又开始了! | |
我要赚赏金打赏帖 |
|
|---|---|
| 在FireBeetle2ESP32-C5上实现温湿度检测和显示被打赏¥20元 | |
| 在FireBeetle2ESP32-C5上实现光照强度检测及显示被打赏¥21元 | |
| 以FireBeetle2ESP32-C5实现数据识读播报被打赏¥19元 | |
| 【STM32F103ZET6】14:实测STM32F1的串口输出任务的挂起与恢复功能被打赏¥27元 | |
| Chaos-nano在压力容器监控系统中的项目应用被打赏¥23元 | |
| 基于FireBeetle2ESP32-C5的WS2812B彩色灯带控制被打赏¥21元 | |
| SWM221CBT7显示开发板驱动TFT显示屏被打赏¥19元 | |
| SWM221CBT7显示开发板驱动OLED屏显示被打赏¥19元 | |
| SWM221CBT7显示开发板及其使用被打赏¥20元 | |
| 揭秘Chaos-nano:ArduinoProMini轻量级操作系统开发框架深度解析与实战应用被打赏¥19元 | |
我要赚赏金
