S3C2410_example
所属分类:处理器开发
开发工具:C/C++
文件大小:240KB
下载次数:123
上传日期:2007-05-12 16:03:55
上 传 者:
zqh_well
说明: ARM9系列,s3c2410实验代码,包括(LED显示实验,七段数码管实验,四位拨段开关实验)都在开发板上调试通过。初学值得一看,
(ARM9 series s3c2410 experimental code, including (LED display experiment, paragraph 107 of digital tube experiments, four switches allocation of experiments) are in the development board through debugging. Beginners eye-catcher.)
文件列表:
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\led_api.c (3346, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\led_api.h (609, 2006-07-24)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\led_api.h.bak (590, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\led_driver.c (2193, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\led_driver.h (373, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\main.c (294, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\Makefile (1437, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\ADS_demo_jtag\ADS_demo_jtag.mcp (197779, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\ADS_demo_jtag\ADS_demo_jtag_Data\CWSettingsWindows.stg (3448, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\ADS_demo_jtag\ADS_demo_jtag_Data\DebugRel\ADS_demo_jtag.axf (14016, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\ADS_demo_jtag\ADS_demo_jtag_Data\DebugRel\TargetDataWindows.tdt (57362, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\ADS_demo_jtag\ADS_demo_jtag_Data\DebugRel\ADS_demo_jtag.bin (1192, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\ADS_demo_jtag\ADS_demo_jtag_Data\DebugRel\ObjectCode\led_api.o (11036, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\ADS_demo_jtag\ADS_demo_jtag_Data\DebugRel\ObjectCode\led_driver.o (7484, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-09.使用 JTAG调试\src\ADS_demo_jtag\ADS_demo_jtag_Data\DebugRel\ObjectCode\main.o (5952, 2007-04-15)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\led_api.c (3112, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\led_api.h (590, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\led_driver.c (2193, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\led_driver.h (373, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\main.c (268, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\Makefile (1437, 2005-06-07)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led.mcp (199832, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\CWSettingsWindows.stg (3475, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\ADS_demo_led.axf (15396, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\ADS_demo_led.bin (1304, 2005-06-09)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\ADS_demo_led.uue (1866, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\bin2uue.bat (42, 2005-06-09)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\TargetDataWindows.tdt (56960, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\uuencode.exe (90624, 2004-07-16)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\ObjectCode\led_api.o (12104, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\ObjectCode\led_driver.o (7824, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-10.LED显示灯实验\src\ADS_demo_led\ADS_demo_led_Data\DebugRel\ObjectCode\main.o (6364, 2006-10-25)
S3C2410实验代码\Learn-lumit-Step-11.七段数码管实验\src\main.c (587, 2005-06-11)
S3C2410实验代码\Learn-lumit-Step-11.七段数码管实验\src\Makefile (1601, 2005-06-11)
S3C2410实验代码\Learn-lumit-Step-11.七段数码管实验\src\seg7_api.c (1390, 2005-06-11)
S3C2410实验代码\Learn-lumit-Step-11.七段数码管实验\src\seg7_api.h (1623, 2005-06-11)
S3C2410实验代码\Learn-lumit-Step-11.七段数码管实验\src\seg7_driver.c (854, 2005-06-11)
... ...
Learn lumit Step 11 : 7段数码管实验
++++++++++++++++++++++++++++++++++++++++++++++++++++++
这一小节我们着重讲解7段数码管的驱动原理和方法。在 seg7_driver.c 文件中
我们仍然将实现和 led 驱动中类似的五个接口函数:
int seg7_open( void )
函数入口参数:无
返回值: 正常返回值 0
执行流程:
无
int seg7_read( char * buf, int count )
函数入口参数:buf : 读缓冲的首地址
count : 需要读的字节数
返回值: 直接返回 count
执行流程:
7段数码管主要用于输出,其读操作暂时不实现,意义不大。
int seg7_write( char * buf, int count )
函数入口参数:buf : 写缓冲的首地址
count : 需要写的字节数
返回值: 正常返回值 count 表示已经写入的字节数, 出错则返回 -1
执行流程:
1) 根据要写入的字节数 count,每个字节代表seg7中的一个 segment led 的状态,依次设置。
int seg7_ioctl( unsigned int cmd, unsigned long arg )
函数入口参数:cmd : ioctl 的入口命令名
arg : 命令所带参数
返回值: 正常返回值 0
执行流程:
暂时实现为空操作
int seg7_release( void )
函数入口参数:无
返回值: 正常返回值 0
执行流程:
暂时实现为空操作
这里和 led 驱动有所不同的是,led 驱动主要是依靠驱动 gpio 来实现 led 的点亮和熄灭。
而 7段数码管是将其 8 个段和数据总线的低 8 位连接在一起,依靠 cpu 对特定地址的读写,
片选上7段数码管这个设备后,实现对其的点亮和熄灭。
由于 lumit4510 中是采用了 nECS3 和 nWE 的“与操作”作为 7段数码管的 SEG7_CS
片选信号,因此,要实现对 SEG7_CS 的片选,需要对 0x03fdc000 - 0x03fe0000 这段地址空间
进行“写”操作。(注意,这里的地址必须是 4 字节对齐的,否则无效!)
有关每个 segment 段和其对应的位置关系,如下图所示:
/*
________
| a |
| |
|b |g
|________|
| c |
|d |f
| |
|________| o dp
e
*/
由此,我们可以根据需要拼凑出每一个 hex 数字 (从 0x0 - 0xF)的表示组合。
后面的 4 行,是我们根据需要实现的几个特殊显示需求,例如 3 个横杠,2 个竖杠等。
大家还可以定义出自己需要的其他符号。
#define DISP_0 (SEG_F|SEG_G|SEG_A|SEG_B|SEG_D|SEG_E)
#define DISP_1 (SEG_F|SEG_G)
#define DISP_2 (SEG_A|SEG_C|SEG_D|SEG_E|SEG_G)
#define DISP_3 (SEG_A|SEG_C|SEG_E|SEG_F|SEG_G)
#define DISP_4 (SEG_B|SEG_C|SEG_F|SEG_G)
#define DISP_5 (SEG_A|SEG_B|SEG_C|SEG_E|SEG_F)
#define DISP_6 (SEG_A|SEG_B|SEG_C|SEG_D|SEG_E|SEG_F)
#define DISP_7 (SEG_A|SEG_F|SEG_G)
#define DISP_8 (SEG_A|SEG_B|SEG_C|SEG_D|SEG_E|SEG_F|SEG_G)
#define DISP_9 (SEG_A|SEG_B|SEG_C|SEG_E|SEG_F|SEG_G)
#define DISP_A (SEG_A|SEG_B|SEG_C|SEG_D|SEG_F|SEG_G)
#define DISP_B (SEG_B|SEG_C|SEG_D|SEG_E|SEG_F)
#define DISP_C (SEG_A|SEG_B|SEG_D|SEG_E)
#define DISP_D (SEG_C|SEG_D|SEG_E|SEG_F|SEG_G)
#define DISP_E (SEG_A|SEG_B|SEG_C|SEG_D|SEG_E)
#define DISP_F (SEG_A|SEG_B|SEG_C|SEG_D)
#define DISP_ALL_OFF (0)
#define DISP_ALL_ON (SEG_A|SEG_B|SEG_C|SEG_D|SEG_E|SEG_F|SEG_G|SEG_DP)
#define DISP_ROW_3 (SEG_A|SEG_C|SEG_E)
#define DISP_COL_2 (SEG_B|SEG_D|SEG_G|SEG_F)
另外,一个需要特别提示的地方是 Makefile 文件有了一些改动,主要是依赖关系里面需要
补充上 .h 文件的修改,对于其他包含它的文件所产生的影响,有时需要重新编译一些 .c 文件。
这里所作的修改主要是添加了以下几条新的规则。
$(OUTPUT_DIR)\main.o: seg7_api.h
$(OUTPUT_DIR)\seg7_api.o: seg7_api.h
seg7_api.h: seg7_driver.h
$(OUTPUT_DIR)\seg7_driver.o: seg7_driver.h
因为 Makefile 的规则解析是可以递归的,所以我们不用特别告诉 make 说 main.o 也依赖于
seg7_driver.h ,这个关系 make 可以通过 seg7_api.h 依赖于 seg7_driver.h 同样能够得到。
这样在我们修改头文件定义的时候,依赖于它的那些源文件也会重新被编译。
┌-------------------------------------------------------------------------┐
│ │
│ Welcome to visit http://www.lumit.org & http://bbs.lumit.org │
│ │
│ [lumit] - let us make it together │
│ │
│ │
│ lumit-admin
│
│ │
└-------------------------------------------------------------------------┘
近期下载者:
相关文件:
收藏者: