当前位置: 技术问答>linux和unix
开发板 LED 如何点亮?
来源: 互联网 发布时间:2017-05-09
本文导语: 目前在使用MPC8313开发板,有8个可编程LED,看cfg文件有以下映射信息。 # WINDOW 3 - Read Write Buffer writemem.l 0xe0000038 0xfa000000 # LBLAWBAR3 - begining at 0xfa000000 writemem.l 0xe000003c 0x8000000e # LBLAWAR3 - enable, size = ...
目前在使用MPC8313开发板,有8个可编程LED,看cfg文件有以下映射信息。
# WINDOW 3 - Read Write Buffer
writemem.l 0xe0000038 0xfa000000 # LBLAWBAR3 - begining at 0xfa000000
writemem.l 0xe000003c 0x8000000e # LBLAWAR3 - enable, size = 32kB
# CS3 - Read Write Buffer
writemem.l 0xe0005018 0xfa000801 # BR3 base address at 0xfa000000, port size 8 bit, GPCM, valid
writemem.l 0xe000501c 0xFFFF8FF7 # OR3 32KB
说明书有以下信息:
An 8-bit write register on the RDB turns the LEDs on and off. The LEDs are arranged so that the most
significant bit represents LED0 and least significant bit represents LED7; that is, LED[0..7]. A write of
0x00 turns on all LEDs, and 0xFF turns off all LEDs.
如何能控制这8个LED呢,该如何写代码?多谢。
# WINDOW 3 - Read Write Buffer
writemem.l 0xe0000038 0xfa000000 # LBLAWBAR3 - begining at 0xfa000000
writemem.l 0xe000003c 0x8000000e # LBLAWAR3 - enable, size = 32kB
# CS3 - Read Write Buffer
writemem.l 0xe0005018 0xfa000801 # BR3 base address at 0xfa000000, port size 8 bit, GPCM, valid
writemem.l 0xe000501c 0xFFFF8FF7 # OR3 32KB
说明书有以下信息:
An 8-bit write register on the RDB turns the LEDs on and off. The LEDs are arranged so that the most
significant bit represents LED0 and least significant bit represents LED7; that is, LED[0..7]. A write of
0x00 turns on all LEDs, and 0xFF turns off all LEDs.
如何能控制这8个LED呢,该如何写代码?多谢。
|
11111111,共八位,最左边算作0位,最右边算作7位,8位代表8个LED灯,至0点亮
00001111,即0x0F,是点亮LED0-3,关闭4-7
00001111,即0x0F,是点亮LED0-3,关闭4-7
|
你的这块开发板是单片机还是ARM的?没有接触过这款开发板
如果你的开发板上已经跑了linux系统,只写应用程序是不行的,因为实际能控制硬件的只有驱动程序,
可以采用模块编译的方式,使用
outw(val, port);
函数直接往地址里面写值
如果是裸机,可以当场单片机用,编程方法网上搜