熱門: 51單片機(jī) | 24小時(shí)必答區(qū) | 單片機(jī)教程 | 單片機(jī)DIY制作 | STM32 | Cortex M3 | 模數(shù)電子 | 電子DIY制作 | 音響/功放 | 拆機(jī)樂園 | Arduino | 嵌入式OS | 程序設(shè)計(jì)
![]() |
1481509156 發(fā)表于 2024-7-17 18:56 需要,樓主用的GPIOA這一組,是按組使用io的 |
很多情況下,一次點(diǎn)亮數(shù)個(gè)LED,只能專用,用途受限。 |
本帖最后由 coody_sz 于 2024-7-21 21:04 編輯 說顯示有問題的朋友,可能沒有編程驅(qū)動(dòng)過。 大量的移動(dòng)電源使用,不會(huì)有問題的。 樓主的這個(gè)比較好驅(qū)動(dòng),最簡單的是5腳輸出高電平,1~4腳輸出低就能控制4個(gè)。 5腳輸出高阻或低電平,則1~4腳輪流有一個(gè)輸出高,其余3個(gè)要顯示就輸出低,不顯示就高阻。 其實(shí)這是分時(shí)驅(qū)動(dòng)共陰、共陽的接法,比如8個(gè)SEGMENT和8個(gè)COMMENT就可以驅(qū)動(dòng)16個(gè)數(shù)碼管,即16個(gè)IO驅(qū)動(dòng)16個(gè)數(shù)碼管,很常用的接法,一些MCU直接支持,比如STC8H4K64TL的24個(gè)IO就可以驅(qū)動(dòng)32個(gè)數(shù)碼管256段。 早幾天我剛好買了一些無線話筒的顯示模塊,7個(gè)IO顯示40段(最多可以42段)。 ![]() |
Mgc666 發(fā)表于 2019-8-27 18:52 大量的移動(dòng)電源使用,不會(huì)有問題的,看我下面的驅(qū)動(dòng)描述。 |
Mgc666 發(fā)表于 2019-8-27 18:44 大量的移動(dòng)電源使用,不會(huì)有問題的,看我下面的驅(qū)動(dòng)描述。 |
這個(gè)對單片機(jī)有要求。普通數(shù)碼管,是一位一位的掃描;這個(gè)是一段一段的掃描,且只能有一段,其它腳要為高阻態(tài)。 |
每次只能有兩個(gè)I0做輸出,一個(gè)輸出高,一個(gè)輸出低,另外的不用全做高阻輸入狀態(tài),這樣其它不相關(guān)的LED就會(huì)不被點(diǎn)亮。 |
這個(gè)跟普通的4*8一樣的驅(qū)動(dòng)原理,4*8就是一次點(diǎn)亮一個(gè)8,而這種一次只是點(diǎn)亮一筆,即一個(gè)LED,利用快速掃瞄顯出一個(gè)個(gè)8字。只要掃完一周的頻率大于60HZ基本人眼就看不到閃爍了。 |
jjy1039 發(fā)表于 2024-7-2 16:02 沒用過動(dòng)態(tài)的,請教下,如果我用的IO腳不同的話,這個(gè)真值表需要變更嗎? |
wangshouyun001 發(fā)表于 2020-10-30 17:15 u16 w1Tab[2]={0x0000,0x0480}; //第一位0,1 u16 w2Tab[10]={0x0936,0x0110,0x0925,0x0931,0x0113,0x0833,0x0837,0x0910,0x0937,0x0933};//第二位0-9 u16 w3Tab[10]={0xf240,0x5000,0xb208,0xd208,0x5048,0xc248,0xe248,0xd000,0xf248,0xd248}; //第三位0-9 u8 ywTab[16]={1,2,3,0,2,3,0,1,3,0,1,2,0,1,2,3};//移位 |
jacks888 發(fā)表于 2020-4-20 21:58 u16 w1Tab[2]={0x0000,0x0480}; u16 w2Tab[10]={0x0936,0x0110,0x0925,0x0931,0x0113,0x0833,0x0837,0x0910,0x0937,0x0933}; u16 w3Tab[10]={0xf240,0x5000,0xb208,0xd208,0x5048,0xc248,0xe248,0xd000,0xf248,0xd248}; u8 ywTab[16]={1,2,3,0,2,3,0,1,3,0,1,2,0,1,2,3}; 解釋一下 |
jacks888 發(fā)表于 2020-4-20 21:58 很不錯(cuò)的分享,慢慢研究一下 |
來個(gè)精簡版的 u16 w1Tab[2]={0x0000,0x0480}; u16 w2Tab[10]={0x0936,0x0110,0x0925,0x0931,0x0113,0x0833,0x0837,0x0910,0x0937,0x0933}; u16 w3Tab[10]={0xf240,0x5000,0xb208,0xd208,0x5048,0xc248,0xe248,0xd000,0xf248,0xd248}; u8 ywTab[16]={1,2,3,0,2,3,0,1,3,0,1,2,0,1,2,3}; u8 stp=0; void display(u8 dt) { u8 odt; u16 dm = w1Tab[dt/100]|w2Tab[(dt%100)/10]|w3Tab[dt%10]; if(stp>=16)stp=0; odt = 0x1f & (~((((dm&(0x0001<<(15-stp)))==(0x0001<<(15-stp)))?1:0)<<ywTab[stp])); GPIOA->BSRR =((((u32)(~odt))<<16)|(u32)(odt)); stp++; } |
asd.png (38.46 KB, 下載次數(shù): 87)
C:\Users\sj\Desktop\asd.png u16 w1Tab[2]={0x0000,0x0480}; u16 w2Tab[10]={0x0936,0x0110,0x0925,0x0931,0x0113,0x0833,0x0837,0x0910,0x0937,0x0933}; u16 w3Tab[10]={0xf240,0x5000,0xb208,0xd208,0x5048,0xc248,0xe248,0xd000,0xf248,0xd248}; u8 ywTab[16]={1,2,3,0,2,3,0,1,3,0,1,2,0,1,2,3}; u8 stp=0; void display(u8 dt) { u8 odt; u16 dm = w1Tab[dt/100]|w2Tab[(dt%100)/10]|w3Tab[dt%10]; if(stp>=16)stp=0; odt = 0x1f & (~((((dm&(0x0001<<(15-stp)))==(0x0001<<(15-stp)))?1:0)<<ywTab[stp])); GPIOA->BSRR =((((u32)(~odt))<<16)|(u32)(odt)); stp++; } |
![]() ![]() |
可以咨詢數(shù)碼管的生產(chǎn)廠家 深圳市新亮點(diǎn)電子有限公司,有完整的驅(qū)動(dòng)方案 |
Mgc666 發(fā)表于 2019-8-28 14:08 有沒有C的的提示? |
天涯落客 發(fā)表于 2019-8-28 10:37 這匯編看得一頭霧水 ![]() |
LcdDrive_init: movlw 00001011b andwf pt1en,1 ; movlw 00000000b ; andwf pt5en,1 clrf R_Temp1 clrf R_Temp2 movfw R_LcdDate_Ge call LcdData_Tab0 btfsc R_TimeFlag,B_FirstOnMode2 movlw FFH btfsc R_TimeFlag,B_Error_En movlw FFH movwf R_Temp1 movfw R_LcdDate_Shi call LcdData_Tab0 btfsc R_TimeFlag,B_FirstOnMode2 movlw FFH btfsc R_TimeFlag,B_Error_En movlw FFH movwf R_Temp2 btfss R_LcdDate_Bai,0 goto LcdDrive_Deal bsf R_Temp1,7 bsf R_Temp2,7 LcdDrive_Deal: movfw R_LcdCom_Cnt andlw 00001111b addpcw goto LcdDrive_Com1 ;1-2 seg - com goto LcdDrive_Com2 ;2-1 goto LcdDrive_Com3 ;1-3 goto LcdDrive_Com4 ;3-1 goto LcdDrive_Com5 ;1-4 goto LcdDrive_Com6 ;4-1 goto LcdDrive_Com7 ;5-1 goto LcdDrive_Com8 ;2-3 goto LcdDrive_Com9 ;3-2 goto LcdDrive_Com10 ;4-3 goto LcdDrive_Com11 ;4-2 goto LcdDrive_Com12 ;5-2 goto LcdDrive_Com13 ;5-3 goto LcdDrive_Com14 ;5-4 goto LcdDrive_Com15 ;3-4 goto LcdDrive_Com16 ;2-4 LcdDrive_Com1: btfss R_Temp1,6 return call Set_Seg1 call Set_Com2 return LcdDrive_Com2: btfss R_Temp1,5 return call Set_Seg2 call Set_Com1 return LcdDrive_Com3: btfss R_Temp1,4 return call Set_Seg1 call Set_Com3 return LcdDrive_Com4: btfss R_Temp1,3 return call Set_Seg3 call Set_Com1 return LcdDrive_Com5: btfss R_Temp1,2 return call Set_Seg1 call Set_Com4 return LcdDrive_Com6: btfss R_Temp1,1 return call Set_Seg4 call Set_Com1 return LcdDrive_Com7: btfss R_Temp1,0 return call Set_Seg5 call Set_Com1 return LcdDrive_Com8: btfss R_Temp2,6 return call Set_Seg2 call Set_Com3 return LcdDrive_Com9: btfss R_Temp2,5 return call Set_Seg3 call Set_Com2 return LcdDrive_Com10: btfss R_Temp2,4 return call Set_Seg4 call Set_Com3 return LcdDrive_Com11: btfss R_Temp2,3 return call Set_Seg4 call Set_Com2 return LcdDrive_Com12: btfss R_Temp2,2 return call Set_Seg5 call Set_Com2 return LcdDrive_Com13: btfss R_Temp2,1 return call Set_Seg5 call Set_Com3 return LcdDrive_Com14: btfss R_Temp2,0 return call Set_Seg5 call Set_Com4 return LcdDrive_Com15: btfss R_Temp2,7 return call Set_Seg3 call Set_Com4 return LcdDrive_Com16: btfss R_Temp1,7 return call Set_Seg2 call Set_Com4 return Set_Seg1: bsf PT_Seg1,P_Seg1 bsf PT_Seg1_En,P_Seg1 return Set_Seg2: bsf PT_Seg2,P_Seg2 bsf PT_Seg2_En,P_Seg2 return Set_Seg3: bsf PT_Seg3,P_Seg3 bsf PT_Seg3_En,P_Seg3 return Set_Seg4: bsf PT_Seg4,P_Seg4 bsf PT_Seg4_En,P_Seg4 return Set_Seg5: bsf PT_Seg5,P_Seg5 bsf PT_Seg5_En,P_Seg5 return Set_Com1: bcf PT_Com1,P_Com1 bsf PT_Com1En,P_Com1 return Set_Com2: bcf PT_Com2,P_Com2 bsf PT_Com2En,P_Com2 return Set_Com3: bcf PT_Com3,P_Com3 bsf PT_Com3En,P_Com3 return Set_Com4: bcf PT_Com4,P_Com4 bsf PT_Com4En,P_Com4 return LcdData_Tab0: andlw 0fh addpcw retlw 01111110B ;0 retlw 00110000B ;1 retlw 01101101B ;2 retlw 01111001B ;3 retlw 00110011B ;4 retlw 01011011B ;5 retlw 01011111B ;6 retlw 01110000B ;7 retlw 01111111B ;8 retlw 01111011B ;9 retlw 01111011B ;9 retlw 01111011B ;9 retlw 01111011B ;9 retlw 01111011B ;9 retlw 01111011B ;9 retlw 01111011B ;9 |
xianfajushi 發(fā)表于 2019-8-27 18:40 這個(gè)只用單片機(jī)的5個(gè)io口來控制而已1 2 3 4 5 對應(yīng)的是5個(gè)io口,對應(yīng)的數(shù)字是連接在一起的 |
共陽端1-5腳作為數(shù)碼管位,用動(dòng)態(tài)掃描,驅(qū)動(dòng)可用三極管8550;1、2、3、4作為數(shù)碼管段位 |
csmyldl 發(fā)表于 2019-8-27 18:33 就像要點(diǎn)亮3A 3B時(shí)候就出現(xiàn)問題 |
想法是這樣,但是點(diǎn)亮數(shù)字的時(shí)候會(huì)被干擾到 |
16個(gè)段引腳看你要如何與蛋騙雞連接,5個(gè)共同端并聯(lián)即可,段各接限流電阻.用8個(gè)IO口驅(qū)動(dòng)或使用16個(gè)IO口驅(qū)動(dòng)設(shè)計(jì)起來就不一樣. |
只需要5個(gè)三極管或類似5個(gè)3極管的IC,如ULN2003 74LS245等均可,假設(shè)三極管導(dǎo)通提供電源(高電平),截止時(shí)電壓接近于0(低電平),關(guān)鍵是程序需采用掃描的方式編寫,當(dāng)1腳的三極管導(dǎo)通提供電源時(shí),234腳要控制相應(yīng)三極管為低電平,此時(shí)有3A 3C 3E三段能點(diǎn)亮,如果只需3A一段亮,需控制2腳三極管低電平輸出 34腳三極管高電平輸出,其它段類似控制,需要把各顯示內(nèi)容做一個(gè)真值表,顯示時(shí)把掃描顯示即可 |
Powered by 單片機(jī)教程網(wǎng)