这些小活动你都参加了吗?快来围观一下吧!>>
电子产品世界 » 论坛首页 » 综合技术 » 基础知识 » S3C4510B S3C4510B如何初始化才能进中断(附程序)

共3条 1/1 1 跳转至

S3C4510B S3C4510B如何初始化才能进中断(附程序)

院士
2006-09-17 18:14:16     打赏
S3C4510B S3C4510B如何初始化才能进中断(附程序)



关键词: S3C4510B     如何     初始化     才能     中断     程序    

院士
2006-12-22 22:43:00     打赏
2楼
问 新手多有不解,请多帮忙.

#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, 好象已经问得很清楚了. 我该如何设置才能进中断运行.

菜鸟
2007-05-19 17:52:00     打赏
3楼

程序在那里呢?


共3条 1/1 1 跳转至

回复

匿名不能发帖!请先 [ 登陆 注册 ]