跪求ARM9大神帮助!!

2019-07-16 10:04发布

本帖最后由 35598581 于 2013-7-4 08:24 编辑

一、       实验设备1)     JXARM9-2410教学实验箱2)     ADT1000仿真器和ADT IDE集成开发环境 3)     串口延长线基于ARM9 S3C2410 串口通信与外部中断
实现查询方式串口的收发功能:接收来自PC机(dnw.exe)的字符,将所收小写字母转为大写,或将所收大写字母ASCII值向上偏移2(大写41~5A,小写61~7A),再返送回给PC机。每次发送要累加计数并让数码管显示数字加1。编写中断处理程序,处理外部中断3:使七段数码管从0~F变化,同时跑马灯在跳跃闪烁,且向串口发送所示的数字或字母。正向变化3遍,反向变化3遍。
学校要交坑爹的作业,本人不才,C语言基础薄弱,完全没办法,求路过的大神拔刀相助,好人一生平安!新注册,只有4E币也送了,万分感谢啊!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
5条回答
35598581
2019-07-16 16:00
给了串口个例程,据说是不对的,应该怎么改?大神在哪里?
/* 包含文件 */
#include "def.h"
#include "2410lib.h"
#include "option.h"
#include "2410addr.h"
#include "interrupt.h"

/* functions */
void eint2_isr(void) __attribute__ ((interrupt("IRQ")));;
void eint3_isr(void) __attribute__ ((interrupt("IRQ")));;
void delay();

/* variables */
int dither_count2 = 0;
int dither_count3 = 0;
int a=0;       
static int nLed = 0x01;

/*****************************************************************************
// Function name        : Main
// Description            : JXARM9-2410 中断实验主程序
//                    完成功能:
//                        外部中断按键引发中断
// Return type                : void
// Argument         : void
*****************************************************************************/
void Main(void)
{   
     unsigned int i,j,k,f;
     unsigned char mask;
         unsigned char pdata[6];
         mask=0x3f;  
         unsigned char ch = 'a';
        /* 配置系统时钟 */
    ChangeClockDivider(1,1);          // 1:2:4   
    ChangeMPllValue(0xa1,0x3,0x1);    // FCLK=202.8MHz  
       
        /* 中断初始化 */
    Isr_Init();
    /* 初始化端口 */
    Port_Init();
   
    /* 初始化串口 */
    Uart_Init(0,115200);
    Uart_Select(0);

    /* 打印提示信息 */
        PRINTF(" ---外部中断测试程序--- ");
        PRINTF(" 请将UART0与PC串口进行连接,然后启动超级终端程序(115200, 8, N, 1) ");
        PRINTF(" 外部中断测试开始 ");

        /* 请求中断 */

        Irq_Request(IRQ_EINT3, eint3_isr);

    /* 使能中断 */

    Irq_Enable(IRQ_EINT3);
              
    dither_count2 = 0;
    dither_count3 = 0;
  
    while(1)
    {
            delay();
            dither_count2++;
            dither_count3++;
            if(a==1)
       {
                for(i=1;i<=3;i++)
            {
            for(j=1;j<=16;j++)
             {   
                 if(nLed>16)
                nLed = 0x01;
               pdata[0]=j;pdata[1]=j;pdata[2]=j;pdata[3]=j;pdata[4]=j;pdata[5]=j;
               Seg7_Display(mask,pdata);
               if(j>9) ch=j-9+0x40;
               else ch=j+0x30;
               Uart_SendByte(ch);
               Led_Display(nLed);               
               nLed=nLed<<1;
             }
            }
            for(k=1;k<=3;k++)
            {
              for(f=16;f>=1;f--)
               { if(nLed>16)
                 nLed = 0x01;
                 pdata[0]=f;pdata[1]=f;pdata[2]=f;pdata[3]=f;pdata[4]=f;pdata[5]=f;
                 Seg7_Display(mask,pdata);
                 if(f>9)  ch=f-9+0x40;
                 else
                 ch=f+0x30;
                Uart_SendByte(ch);
                Led_Display(nLed);
                nLed=nLed<<1;
               }
            }
            a=0;
           }
    }
}

/*****************************************************************************
// Function name        : eint3_isr
// Description            : EINT3中断处理程序
// Return type                : int
// Argument         : void
*****************************************************************************/
void eint3_isr(void)
{  
        Irq_Clear(IRQ_EINT3);        

    if(dither_count3 > 5)
    {
                   dither_count3 = 0;       
                       
               
                a=1;       
        }
}

void delay()
{
        int index = 0;
       
        for ( index = 0 ; index < 20000; index++);
}

一周热门 更多>