Chinaunix首页 | 论坛 | 博客
  • 博客访问: 356626
  • 博文数量: 120
  • 博客积分: 4010
  • 博客等级: 上校
  • 技术积分: 1810
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-11 17:50
文章分类

全部博文(120)

文章存档

2008年(120)

我的朋友

分类: C/C++

2008-03-24 13:14:56

/*************************************************************************/
/*                                                                       */
/* FILE NAME                                      VERSION                */
/*                                                                       */
/* LEDSEG7.C                                           1.0               */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*     LED DEMO CODE for MBA-44B0(S3C44B0X)                              */
/*                                                                       */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/* FUNCTIONS : LED & seg7 ROUTINE                                        */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*                                                                       */
/* NAME:                                                     */
/* REMARKS:                                                              */
/*                                                                       */
/*        Copyright (C) 2003 Wuhan CVTECH CO.,LTD  */
/*************************************************************************/
/* includes */
/* defines */
#define    U8     unsigned char
/* globals */
U8 output1 = 0xff;
static int delayLoopCount=401;
/********************************************************************
// Function name : Test_Seg7
// Description     : test seg7
// Return type  : void
// Argument         : void
*********************************************************************/
void Test_Seg7(void)
{   
 int i,aTemp,bBreak = 0;
 for( ; ; )
 {
  /* 0x0 -> 0xf */
     for(i=0;i<0x10;i++)
  {
      switch(i)
   {
       case 0x0: aTemp = 0xc0; break;
       case 0x1: aTemp = 0xf9; break;
       case 0x2: aTemp = 0xa4; break;
       case 0x3: aTemp = 0xb0; break;
       case 0x4: aTemp = 0x99; break;
       case 0x5: aTemp = 0x92; break;
       case 0x6: aTemp = 0x82; break;
       case 0x7: aTemp = 0xf8; break;
       case 0x8: aTemp = 0x80; break;
       case 0x9: aTemp = 0x90; break;
       case 0xa: aTemp = 0x88; break;
       case 0xb: aTemp = 0x83; break;
       case 0xc: aTemp = 0xc6; break;
       case 0xd: aTemp = 0xa1; break;
       case 0xe: aTemp = 0x86; break;
       case 0xf: aTemp = 0x8e; break;      
       default: break;      
      }    
      *((U8*)0x8000000) = aTemp;     
      Delay(500);      
     }
  if(bBreak == 1)
   break;
  /* 0xf -> 0x0 */
     for(i=0xf;i>=0x0;i--)
  {
      switch(i)
   {
       case 0x0: aTemp = 0xc0; break;
       case 0x1: aTemp = 0xf9; break;
       case 0x2: aTemp = 0xa4; break;
       case 0x3: aTemp = 0xb0; break;
       case 0x4: aTemp = 0x99; break;
       case 0x5: aTemp = 0x92; break;
       case 0x6: aTemp = 0x82; break;
       case 0x7: aTemp = 0xf8; break;
       case 0x8: aTemp = 0x80; break;
       case 0x9: aTemp = 0x90; break;
       case 0xa: aTemp = 0x88; break;
       case 0xb: aTemp = 0x83; break;
       case 0xc: aTemp = 0xc6; break;
       case 0xd: aTemp = 0xa1; break;
       case 0xe: aTemp = 0x86; break;
       case 0xf: aTemp = 0x8e; break;      
       default: break;      
      }    
      *((U8*)0x8000000) = aTemp;     
      Delay(500);      
     }
  if(bBreak == 1)
   break;  
 }
    *((U8*)0x8000000) = 0xff;     
}
/********************************************************************
// Function name : Delay
// Description     : delay 'time' ms
// Return type  : void
// Argument         : int time : time by ms to be delayed
*********************************************************************/
void Delay(int time)
{
    int i;
    for(;time>0;time--)
  for(i=0;i}
 
链接脚本文件:
SECTIONS
{
 . = 0x0c200000;
 .text : { *(.text) }
 Image_RO_Limit = .;
 Image_RW_Base = .;
 Image_RO_Base = .;
 Image_RW_Limit = .;
 .data : { *(.data) }
 .rodata : { *(.rodata) }
 Image_ZI_Base = .;
 .bss : { *(.bss) }
 Image_ZI_Limit = .;
 __bss_start__ = .;
 __bss_end__ = .;
 __EH_FRAME_BEGIN__ = .;
 __EH_FRAME_END__ = .;
PROVIDE (__stack = .);
 end = .;
 _end = .;
 .debug_info     0 : { *(.debug_info)  }
  .debug_line  0 : { *(.debug_line)  }
    .debug_abbrev   0 : { *(.debug_abbrev)}
    .debug_frame    0 : { *(.debug_frame) }
}
阅读(1034) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~