51单片机实现6位共阳数码管动态扫描

版权申诉
0 下载量 14 浏览量 更新于2024-10-13 收藏 14KB RAR 举报
资源摘要信息:"mcu.rar_共阳数码管" 标题中提到的是“mcu.rar_共阳数码管”,而描述中则指出“6位数码管动态扫描程序,用51单片机和共阳数码管实现”。标签为“共阳数码管”。从这些信息中,我们可以提取以下知识点: 1. **单片机(MCU)概念**:单片机全称为微控制器单元(Microcontroller Unit),是一种集成电路芯片,它将微处理器的核心功能(如运算、控制)与内存、输入输出端口等外围电路集成在一起,形成一个完整的微型计算机系统。51单片机是基于Intel 8051微控制器架构的一种单片机,常用于教学和工业控制领域。 2. **共阳数码管介绍**:共阳数码管是一种常见的七段显示设备,用于显示数字和某些字符。在共阳数码管中,所有的阳极都连接在一起,共同接正电源。要使某个段亮起来,需要将对应的阴极引脚接地。这种数码管因其连接方式而得名。 3. **动态扫描技术**:动态扫描技术是在多路显示设备中常用的一种技术,用于控制多个显示单元,比如数码管或LED点阵。在一个多路显示系统中,通过快速地轮流点亮每一行或每一个数码管,由于人眼的视觉暂留效应,肉眼会感受到所有显示单元都是同时亮起的,这样可以显著降低所需的I/O口数量。在本文件描述中,动态扫描技术被应用于控制6位数码管。 4. **51单片机编程实践**:51单片机的编程通常涉及汇编语言或C语言。在实现6位数码管动态扫描程序时,开发者需要熟悉51单片机的I/O操作、定时器/计数器、中断等核心功能。程序设计时,需要考虑如何安排定时器来生成准确的扫描周期,并且在中断服务程序中实现数码管的动态显示逻辑。 5. **数码管的驱动方式**:为了驱动共阳数码管,需要设计一个驱动电路,将单片机的I/O端口输出的低电平信号转换为能使数码管某段发光的高电平信号。在硬件电路中,这通常通过晶体管或其他开关元件实现。同时,还需要确定数码管的共阳端接在单片机的哪个电源线上,确保共阳端有稳定的高电平。 6. **文件压缩和解压缩**:文件名中的“mcu.rar”暗示了文件内容可能被压缩。RAR是一种常见的压缩文件格式,具有较高的压缩率。要查看和使用压缩包中的文件内容,需要先对rar文件进行解压缩处理,解压缩软件如WinRAR或者7-Zip等工具可以帮助完成这一任务。 综上所述,该压缩文件可能包含了使用51单片机控制6位共阳数码管进行动态扫描显示的相关程序代码或者硬件设计文档。对于学习和研究单片机开发的人来说,这样的文件是十分宝贵的资源。通过实践这样的项目,可以加深对单片机编程和外围设备控制的理解。

为下面每一行代码添加注释:#include "stm32f10x.h" void RCC_Configuration(void) { /* Enable GPIOA, GPIOC and AFIO clocks / RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE); / Enable SYSCFG clock / RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); } void GPIO_Configuration(void) { GPIO_InitTypeDef GPIO_InitStructure; / Configure PA0 pin as input floating / GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOA, &GPIO_InitStructure); / Configure PC13 pin as output push-pull / GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_Init(GPIOC, &GPIO_InitStructure); } void NVIC_Configuration(void) { NVIC_InitTypeDef NVIC_InitStructure / Configure the NVIC Preemption Priority Bits / NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); / Enable the EXTI0 Interrupt / NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_Init(&NVIC_InitStructure); } void EXTI_Configuration(void) { EXTI_InitTypeDef EXTI_InitStructure; / Configure EXTI Line0 to generate an interrupt on falling edge / EXTI_InitStructure.EXTI_Line = EXTI_Line0; EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_Init(&EXTI_InitStructure); / Connect EXTI Line0 to PA0 pin / GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0); } void SysTick_Configuration(void) { / Configure SysTick to generate an interrupt every 1ms / if (SysTick_Config(SystemCoreClock / 1000)) { / Capture error / while (1); } } void Delay(__IO uint32_t nTime) { / Wait for nTime millisecond / TimingDelay = nTime; while (TimingDelay != 0); } void TimingDelay_Decrement(void) { if (TimingDelay != 0x00) { TimingDelay--; } } int main(void) { RCC_Configuration(); GPIO_Configuration(); NVIC_Configuration(); EXTI_Configuration(); SysTick_Configuration(); / Infinite loop / while (1) { / Toggle PC13 LED every 500ms / GPIOC->ODR ^= GPIO_Pin_13; Delay(500); } } void EXTI0_IRQHandler(void) { / Check if PA0 button is pressed / if (GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0) == RESET) { / Reset MCU / NVIC_SystemReset(); } / Clear EXTI Line0 pending bit */ EXTI_ClearITPendingBit(EXTI_Line0); }

2023-06-03 上传

Read Spd Begin... The memory on CH :1 are different! N: pre svc call fun = 0xc2000f04 -- pm-1 = 0, pm-2 = 29819750, pm-3 = 0 N: ddr fun = 0x0 -- pm = 0x29819750, pm2 = 0x0 N: parameter mcu: v0.5 Mcu Start Work ... get_clocks_value: scpi send command start: 0x10 scpi send command success get clocks = 533 MHZ pll_scp_num = 8 Lmu Freq = 1066Mhz ch = 0 parameter set ch closed! DIMM Don't Probed! ch = 1 the dimm info is from uboot... Dimm_Capacity = 8GB Mcu Channel 1 AES configuration begin... AES bypass end... TZC configuration begin... TZC bypass end... use_0x14 == 0xb0100 ctl_cfg_begin...... pi_cfg_begin...... phy_cfg_begin...... fast mode caslat = 15 wrlat = 14 tinit = 856000 r2r_diffcs_dly = 4 r2w_diffcs_dly = 5 w2r_diffcs_dly = 3 w2w_diffcs_dly = 7 r2w_samecs_dly = 4 w2r_samecs_dly = 0 r2r_samecs_dly = 0 w2w_samecs_dly = 0 ch 1 adapter_alg -- 0-0-0-0-0-0-0 rtt_wr = dis rtt_park = 80ohm ron = 34ohm val_cpudrv = 34 rtt_nom = 48ohm val_cpuodt = 48 vref_dev = 10 vrefsel = 0x45 dq_oe_timing = 0x42 rank_num_decode = 1 set phy_indep_init_mode set pi_dram_init_en set_pi_start & ctl_start...... wait init complete...... init complete done...... wait complete done...... rddqs_lat = 0x2 tdfi_phy_rdlat = 0x1f begin software ntp training... rank_num: 0 phy_write_path_lat_add =-1-1-1-1-1-1-1-1-1 phy_write_path_lat_add = 0 0 0 0 0 0 0 0 0 phy_write_path_lat_add = 1 1 1 1 1 1 1 1 1 phy_write_path_lat_add = 2 2 2 2 2 2 2 2 2 phy_write_path_lat_add = 3 3 3 3 3 3 3 3 3 phy_write_path_lat_add = 4 4 4 4 4 4 4 4 4 rank 0 wdqlvl! r2r_diffcs_dly = 4 r2w_diffcs_dly = 7 w2r_diffcs_dly = 4 w2w_diffcs_dly = 6 r2w_samecs_dly = 5 rank 0 ch 1 training fail

2023-06-02 上传