【注】本人用的是8个显示位的7段数码管,有八个控制位,控制位低电平有效,段码位低电平有效。首先第一个程序是控制单个数码管,用引脚位的电平控制显示数字1。第二个程序是通过段位码控制两个或者以上的轮流显示数字。
MSP430FR6989
The MSP430FR6989 is the next device in TI's new ULP FRAM technology platform. FRAM is a cutting
edge memory technology, combining the best features of flash and RAM into one nonvolatile memory.
Device features include:
• 1.8-V to 3.6-V operation
• 16-bit RISC architecture up to 16-MHz system clock and 8-MHz FRAM access
• 128KB of nonvolatile FRAM
• 100 µA/MHz active mode and 350 nA standby with RTC and 3.7-pF crystal
• Certified ULPBench score of 109
• 320-segment LCD controller
• Extended Scan Interface
• 16-channel 12-bit ADC
• Comparator
• Five Timers
• Direct memory access
• 256-bit AES
这是官网给出的部分资料,由于用的数码管需要高电平5v左右的电平才会无效,但是板子的电平控制最高在1.8-3.6V,所以无法失效。介意以后的新手买低电平有效的控制位。
段位码很简单,网上查找一下。
单片机源程序如下:
- #include "msp430fr6989.h"
- #include <stdint.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include "seg_led.h"
- #include "delay.h"
- unsigned char seg_num[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x98};
- /**********************
- 设置Init_PORT_seg_led(void):设置数码管的IO端口
- **********************/
- void Init_PORT_seg_led(void){
- P9DIR = 0xFF;//P9口设置为输出
- P1DIR |= BIT3;
- P1OUT |= BIT3;//设置P1.3为高电平可以选择此通道
-
- }
- void seg_show1(void){
- Init_PORT_seg_led();
- while(1){
- delay(100);
- P9OUT = 0xF9;//为输出低电平有效
-
- }
- }
复制代码
全部资料51hei下载地址:
快速入门msp430fr6989之八位7段数码管.7z
(286.66 KB, 下载次数: 10)
|