Cov txheej txheem:

BloodBowl Turn Counter Siv 7-ntu LEDs: 5 Cov Kauj Ruam
BloodBowl Turn Counter Siv 7-ntu LEDs: 5 Cov Kauj Ruam

Video: BloodBowl Turn Counter Siv 7-ntu LEDs: 5 Cov Kauj Ruam

Video: BloodBowl Turn Counter Siv 7-ntu LEDs: 5 Cov Kauj Ruam
Video: Начало → Изучайте английский → Освойте ВСЕ ОСНОВЫ АНГЛИЙСКОГО ЯЗЫКА, которые вам НУЖНО знать! 2024, Kaum ib hlis
Anonim
BloodBowl Turn Counter Siv 7-ntu LEDs
BloodBowl Turn Counter Siv 7-ntu LEDs

Txoj haujlwm no yog rau BloodBowl game turn counter siv rau Charlieplexed 7-ntu LEDs.

Kauj ruam 1: Tswv yim

Tswv yim
Tswv yim

Ib tus phooj ywg ntawm kuv tau nug kuv txog cov tswv yim tsim Bloodbowl Turn counter rau nws cov gamegame. Tsis paub tias qhov no yog dab tsi, thiab nws xav tau dab tsi, nws siv sijhawm luv los txiav txim siab yog tias thiab yuav ua li cas kuv thiaj yuav ua qhov no. Kuv xub tau muaj lub tswv yim ntawm qhov nws xav tau, yog li kuv pib nrog lub tswv yim kos duab (duab). Lub tswv yim yooj yim yog kom muaj 3 lub khawm thawb, tswj 3 LED txhua tus thiab nws yuav muab tso rau hauv ib lub tsev tsim tshwj xeeb. Qhov kev thov loj tsuas yog kom muaj 4 sab saum toj suav suav los ntawm 0 txog 8 thiab rov pib dua, thiab muaj qis dua 2 qhia suav suav los ntawm 8 txog 0 thiab rov qab los. Kuv yuav ua tiav qhov Circuit Court, thiab nws yuav ua kom tiav tus pej thuam.

Kauj Ruam 2: Tsim & Sau Npe

Tsim & Tshooj Npe
Tsim & Tshooj Npe

Txij li lub tswv yim hu rau 6 7-ntu LED's, thiab kuv muaj qee qhov 8-ntsis Microchip PICs yooj yim, Kuv tshawb nrhiav txoj hauv kev siv PICs los tswj LEDs. Kuv pom qhov txuas no https://www.mikroe.com/en/books /picbook/7_08chapter.htm uas hais tias "Mus txog 6 cov lus tuaj yeem nkag tau zoo li qhov no yam tsis muaj qhov ci ntawm txhua cov zaub raug cuam tshuam." Kuv tau txiav txim siab qhov no yog qhov nyuaj thiab qee yam los tshuaj xyuas ua ib feem ntawm kuv qhov project. Thawj qhov kuv tau ua, yog lob qee qhov 7-ntu ntu qhia tawm ntawm kuv lub npov thiab pom tias lawv yuav ua haujlwm li cas. Xov xwm phem Qhov tshwj xeeb uas kuv tau xaiv tsis coj zoo li kuv xav tau. Cov ntu yuav pom kev thaum xav tau, ntawm lub khob cij, tab sis cov dej xau tam sim no tau faib rau lwm 6 ntu. Kuv paub tias cov lus qhia tsis tuaj yeem tsis yog txoj hauv kev mus, lossis kuv xav tau siv lawv hauv lwm txoj kev. Yog li kom yooj yim Kuv tau txheeb xyuas 7-ntu LEDs kuv muaj ntawm tes yuav ua haujlwm rau breadboarding, thiab xaj qee qhov kev qhia anode. Qhov thib ob uas kuv xav tau ua yog teeb tsa kuv tus qauv thiab pib ua haujlwm ntawm tus lej. Daim duab yog kuv lub voj voog. Tsis ntau rau nws, raws li cov cai hauv PIC saib xyuas qhov sib txuam sib luag… yuam kev Charlieplexing. Nco tseg: TXHUA 6 cov lus qhia muaj SAME kab los ntawm tus tsav IC. Tus xaiv IC ua kom pom txhua qhov, 1 ntawm ib lub sijhawm, thiab 7 kab ntu tau hloov kho los ntawm PIC raws li. Lub tswv yim yooj yim heev. Tom qab ntawd, cov lej thiab khoos phis tawj tiav yog txhua yam uas xav tau. Parts ListAfter 3 kev txiav txim me me los ntawm Digi-Key thaum txiav txim siab ntawm cov khoom tshwj xeeb, Kuv muaj txhua yam kuv xav tau (nrog qee yam khoom ntawm tes); 1 ~ 3 "x4 "PCB6 lub me me khawm khawm hloov (TSIS MUAJ) 1 74LS47, 7-ntu tso saib IC1 PIC16F627 1 CD4028, 1 ntawm 10 tus xaiv IC 6 10KOhm resistors1 470Ohm resistor1 spool ntawm xaim. Kuv siv ntau yam xim thiab lus, tab sis qhov ntawd tsuas yog kuv.1 78L05 5V tus tswj hwm 1 9V roj teeb clip1 9V roj teeb 1 hloov me me (rau lub zog tua hluav taws rau/tua) Kuv xav txog qhov no yog txoj haujlwm nyuaj me me, vim; 1) Microprocessor code yuav tsum tau 2) Cov laug thiab breadboarding 3) Tsim kom zoo dua qub. Nyob ntawm cov teeb meem no los ntawm lawv tus kheej yog qhov nyuaj dhau, tab sis coj lawv txhua yam yam tsis muaj kev paub dhau los tuaj yeem ua tau zoo rau tus pib. Tus khoos phis tawj khoos phis tawj yuav tsum tau hlawv lub cuab yeej, lub chaw muag khoom muag, thiab lwm yam … Thawj zaug ib tus neeg yuav pom yog tias 7-ntu LED's TSIS TXHOB muaj koob (txwv tam sim no) resistors! Cia kuv hais qhov sai sai, los ntawm qhov hais tias kuv tus qauv tsim qub tau muaj nyob hauv… tab sis nyeem cov kauj ruam tom ntej rau kev piav qhia!

Kauj Ruam 3: Breadboarding & Micro Code

Breadboarding & Micro Code
Breadboarding & Micro Code

Breadboard yog qhov yuav tsum tau ua rau qhov no. Qhia yog kuv daim ntawv qhia zaub mov dav dav, tab sis rau qhov loj me ntawm txoj haujlwm no kuv tau siv qhov no thiab lub khob cij me dua, vim muaj ntau lub xov hlau uas xav tau kom nyob sib nrug. Qhov no tau lees paub 3 yam; 1) Kev thaiv ntawm IC's tau txheeb xyuas tau zoo! 2) coj kuv los ua kom zoo dua thiab ua kom tiav kuv cov cai. 3) Ua rau kuv paub tias kuv tsis xav tau qhov txwv tam sim no resistors! 1 WIRING raws li tau hais, kuv cov qauv tsim tau pom ua haujlwm nrog kuv tus lej, zoo li LED yuav hloov pauv tus lej siv ib lub khawm hloov, yog li qhov tau txheeb xyuas kuv cov cai thiab teeb tsa. Tsis xav tau ntau tab sis daim ntawv qhia zaub mov tau lees paub tias kuv tau zoo. 2 CODEI thaum xub thawj tau muaj kuv tus lej teeb tsa nrog lub hauv paus tseem ceeb los tshuaj xyuas cov nyees khawm thiab ISR (cuam tshuam kev pabcuam niaj hnub ua haujlwm) tso tawm cov lej,. Tom qab ntsuas cov ntawv ntsuas, kuv thim rov qab cov txheej txheem, yog li feem ntau ntawm lub sijhawm tau nthuav qhia cov lej thiab ISR los tshuaj xyuas cov nyees khawm. Qhov laj thawj kuv ua qhov no, tsuas yog kom muaj cov duab tas li, txij li PIC tau ua haujlwm nrog 4Mhz moos sab hauv, Kuv poob sijhawm me ntsis los tshuaj xyuas cov nyees khawm. Tsis muaj teeb meem loj … tsuas yog nyob ntawm seb koj xav ua txoj cai thiab dab tsi ua rau muaj kev nkag siab zoo tshaj plaws rau txhua daim ntawv thov. Rau qhov no, tso saib yog ib qho tseem ceeb, yog li kuv muab tso rau hauv cov txheej txheem tseem ceeb. Thaum kuv thawj ntu tuaj txog (tag nrho 6 cov lus!), Kuv ua tiav txoj kab thaiv kab xev thiab pom lwm qhov teeb meem. Thaum thawb lub pob kuv tus lej muaj qee cov ntawv sau tsis raug uas tsis tau raug tshem tawm thiab ISR tau ua rau qee qhov teeb meem me me.; ======================== ====================================================================== =====; Turn Counter;; -----------; Dsply3 Dsply2; Dsply4 Dsply1; Led1 Led3; A5 | 4 15 | A6 - Coj 2; Vws | 5 14 | Vdd; Button1 B0 | 6 13 | B7; B1 | 712 | B6; B2 | 811 | B5; B3 | 910 | B4; ------------;;; LED1-3-BCD-dec IC -LEDSeg's1-6; Dsply1-3-BCD-7seg IC -Dsply#1-9;; ================================== ================================================; Kho dua keeb kwm & Sau ntawv:; V1.0 Thawj Header, Code 3/30/09;; (C) 5/2009; Cov cai no tuaj yeem siv rau kev kawm tus kheej/thov/hloov kho..; ------------------------------------------------------- -------------------------------#suav nrog P16F627A. INC; ============= ====================================================================== ================; Txhais; ------------------------------------------------ -------------------------------; ================== ====================================================================== ===========; Cov ntaub ntawv; ------------------------------------------------ -------------------------------; Lub sijhawm khaws cov lej sib npaug 1 suav 20 suav 2 sib npaug 21 dis1 sib npaug 22dis2 equ 23dis3 equ 24dis4 equ 25dis5 equ 26dis6 equ 27w_temp equ 28status_temp equ 29ISRCNTR equ 2A; ====================== ====================================================================== =======; Pib dua Vectors;; CHECK CONFIG. BITS ua ntej hlawv !!!; INTOSC; MCLR: ENABLED; PWRUP: ENABLED; TXHUA lwm tus: TSEV !!;; ---------------------------------------------- ------------------------------------- RESET_ADDR EQU 0x00 ISR_ADDR EQU 0x04 org RESET_ADDR tau pib; == ====================================================================== ===========================; ISR;; ----------------------------------------------------------------------- -------------------------------- org ISR_ADDR movwf w_temp swapf STATUS, w movwf status_temp; ISR NTAWM NO; Txheeb xyuas PB0-PB5 Hloov btfsc PORTB, 0; Txheeb xyuas SW1 hu sw1debounce btfsc PORTB, 1; Kos SW1 hu sw2debounce btfsc PORTB, 2; Kos SW1 hu sw3debounce btfsc PORTB, 3; Kos SW1 hu sw4debounce btfsc PORTB, 4; Kos SW1 hu sw5debounce btfsc PORTB, 5; Kos SW1 hu sw6debounce goto endisrsw1debounce hu debounce; Tos 0.2 sec hu debounce incf dis1; Hloov kho txee movf dis1, W; Txheeb rau xorlw 0x1A; 10 ntawm 7-seg? btfss STATUS, Z rov qab los; Tsis yog, rov qab mus rau scan. movlw h'10 '; Yog, pib dua cov zaub. movwf dis1 returnw2debounce hu debounce; Tos 0.2 sec hu debounce incf dis2; Hloov kho txee movf dis2, W; Txheeb xyuas cov xorlw 0x4A; 10 ntawm 7-seg? btfss STATUS, Z rov qab los; Tsis yog, rov qab mus rau scan. movlw 40 '; Yog, rov pib dua cov zaub. movwf dis2 rov qabw3debounce hu debounce; Tos 0.2 sec hu debounce incf dis3; Hloov kho txee movf dis3, W; Txheeb rau xorlw 0x5A; 10 ntawm 7-seg? btfss STATUS, Z rov qab los; Tsis yog, rov qab mus rau scan. movlw h'50 '; Yog, rov pib dua cov zaub. movwf dis3 returnw4debounce hu debounce; Tos 0.2 sec hu debounce incf dis4; Hloov kho txee movf dis4, W; Txheeb xyuas cov xorlw 0x8A; 10 ntawm 7-seg? btfss STATUS, Z rov qab los; Tsis yog, rov qab mus rau scan. mov hw80 '; Yog, pib dua cov zaub. movwf dis4 returnw5debounce hu debounce; Tos 0.2 sec hu debounce incf dis5; Hloov kho txee movf dis5, W; Txheeb rau xorlw 0x9A; 10 ntawm 7-seg? btfss STATUS, Z rov qab los; Tsis yog, rov qab mus rau scan. mov hw 90 '; Yog, rov pib dua cov zaub. movwf dis5 returnw6debounce hu debounce; Tos 0.2 sec hu debounce incf dis6; Hloov kho txee movf dis6, W; Txheeb xyuas cov xorlw 0xCA; 10 ntawm 7-seg? btfss STATUS, Z rov qab los; Tsis yog, rov qab mus rau scan. movlw h'C0 '; Yog, rov pib dua cov zaub. movwf dis6 tus neeg xa rov qab bcf INTCON, T0IF swapf status_temp, w movwf STATUS swapf w_temp, f swapf w_temp, wretfie; ============================ ====================================================================== =; Pib Ntawm No!; ---------------------------------------------- --------------------------------- pib; Config I/O ports clrf PORTA movlw 0x07 movwf CMCON bcf STATUS, RP1 bsf STATUS, RP0 movlw h'00 '; RA Outputs, RA5 No output movwf TRISA bcf STATUS, RP0 clrf PORTB bsf STATUS, RP0lw' RB Cov tswv yim movwf TRISB; Teem sijhawm sab hauv bsf PCON, 3; Teeb rau 4Mhz. movlw h'CF '; Tmr0 Internal qhov chaw, prescale TMR0 1: 256 movwf OPTION_REG movlw h'A0 'movwf INTCON; Pab kom TMR0 cuam tshuam, bcf STATUS, RP0; Pib sau npe sau npe clrf PORTA; Ntshiab PortA clrf PORTB; Clear PortB outputs clrf count1 clrf count2 movlw h'10 'movwf dis1 movlw h'40' movwf dis2 movlw h'50 'movwf dis3 movlw h'80' movwf dis4 movlw h'90 'movwf dis5 movlw h'C0' movwf dis6 hu debounce; 0.2 sec; ntsuas LEDs, tso saib 8 ??? = ====================================== ============================================; Lub ntsiab; Tau txais cov tswv yim los ntawm cov hloov pauv, sib cav thiab nthuav tawm qhov pom.;; Qhov no hloov kho cov lus, @4Mhz nrog TMR0 prescal 1: 4, ntawm 1Khz tus nqi.; Zaub 0 yog siv los faib rau qhov tsis siv. Zaub 1-6 tau txuas.; Ua ntej, BCD-7Seg IC tau ntim nrog cov khoom tso tawm, THIAB BCD-Dec IC tau qhib rau; tso saib xaiv. IC tau deactivated… display0 raug xaiv los kaw cov zaub;; Qhov no tau rov ua dua rau txhua ntawm 6 cov lus, thiab rov ua dua.; ISR ua haujlwm hloov pauv kev nkag siab ntawm 15Hz tus nqi.; -------------- ----------------------------------------------------------------------- --------------- main; Disp1 movf dis1, 0 movwf PORTA hu rau ledon goto main; ===================== ====================================================================== ========; Ledon; Teeb lub sijhawm rau LED fais fab tuag; 6 cov lus qhia-> 1/6 lub voj voog ua haujlwm ntawm 1Khz = 166 mus; ----------------------------------- -------------------------------------------- ledon movlw.54 movwf count1ledloop decfsz suav 1, F goto ledloopreturn; =========================================== ====================================; Tshaj tawm lub teeb liab; 4 mus thauj khoom thiab hu, 2 mus kom rov qab los; 4Mhz Tc:: suav2 = 255-> 0.2 sec; -------------------------------------- ----------------------------------------- debounce movlw.255; Ncua rau 1/5 thib ob debounce. movwf suav2 hu pon_wait rov; -------------------------------------------- ---------------------------------------; suav 1 = 255d:: 775 mus rau 0, + 3 mus kom rov los.; --------------------------------- ---------------------------------------------- pon_waitbig_loopS movlw.255 movwf count1short_loopS decfsz count1, F goto short_loopS decfsz count2, F goto big_loopSreturnend3 CIRCUITI thaum xub thawj muaj 470Ohm resistors los ntawm txhua cov kab tsav tsheb los ntawm 74LS47 thiab CD4028 qhib kab. Txawm li cas los xij, Kuv sim kuv qhov kev kos tam sim no thiab pom nws tsuas yog rub ~ 31mA. Thiab txij li tus tsav tsheb tiag rau cov lus qhia ncaj qha los ntawm 74LS47 thiab pab tau yog los ntawm lwm IC, nrawm nrawm ntawm qhov nruab nrab thiab qhov xav tau siab tshaj, thiab cov ntaub ntawv cuam tshuam….. Kuv rub cov resistors tawm ntawm lub khob cij thiab pom qhov sib txawv 1mA ! Nws pom tias ncaj qha tsav CA kab los ntawm 4028 thaum tsav tsheb ncaj qha txhua ntu yog OK! … tsi.:) Kuv DID muaj qhov tsis txaus ntseeg hauv kuv tus lej uas tsis tau tshem kuv cov ntawv sau npe thaum lub pob raug nias, ua rau lub ntsej muag kawg kom muaj 2 ntu ci ntsa iab heev thaum lub pob raug nias. Qhov no phem. Txawm li cas los xij, tshem tawm daim ntawv sau npe teeb tsa qhov teeb meem no, thiab txuas ntxiv lub zog ntsuas xyuas nws tas li nyob ib puag ncig 30mA kos. Qhov no yuav tsum muab rau kuv (raws li kev paub dhau los nrog cov kev sib txuas zoo sib xws) ~ 20 teev ntawm lub sijhawm ua haujlwm siv 1 9V roj teeb (500mAH/30mAH raws li 5V txoj cai) … Kuv vam tias! Kuv txiav txim siab khaws cov LED ncaj qha tsav, tab sis muab lawv tso rau hauv qhov rooj plaub ib yam tshwm sim, ntev.

Kauj Ruam 4: PCB Soldering

PCB Soldering
PCB Soldering

Txhua lub sijhawm kuv mus txog qhov no hauv kuv qhov haujlwm kuv ncua sijhawm. Thaum xub thawj kuv yuav mus xaim qhov khoom no, tab sis sai sai lub tswv yim ntawd. Thaum xub thawj kuv xav tias "Ob peb xaim xaim xaim, tsis muaj teeb meem loj" … Kuv yuav tsum tau xa tawm kom muaj lub rooj sib tham proto ua, lossis kos kuv tus kheej lub rooj tsavxwm ". Kuv tsis nkag rau PCB etching (tseem), thiab tsis xav them $$ kom muaj lub rooj tsavxwm ua, yog li ….. Kuv siv sijhawm li 3 teev siv cov khoom no. Nws yog txog 150 xov hlau, yog li ntawd 300 lub ntsiab lus sib txuas, ntxiv rau kov-txuas rau cov laug txuas. Txawm li cas los xij, ntawm no yog sab nraub qaum ntawm pawg thawj coj saib duab….yeah… abit ntawm qhov tsis sib xws, tab sis thaum nws ua tiav tag nrho kuv tsuas muaj 1 lub lauj kaub luv. Siv 20 feeb ntawm kev xav txij li cov zaub pom qhov tsis raug #tau tshwm sim hauv cov txheej txheem uas kuv yuav tsum tau txiav txim siab. Tom qab ntawd, Kuv nyob qhov luv, thiab bam! Nws ua haujlwm zoo kawg nkaus.

Kauj Ruam 5: Xaus

Xaus
Xaus

Nws ua haujlwm! Qhov haujlwm no tau siv txog; ~ 2 lub lis piam los xav txog thiab xa email cov ntsiab lus zoo rau tus thov, ~ 3 teev ntawm kev ua kom tiav thiab kev debug, ~ 4 teev ntawm kev ua zaub mov noj thiab debug, ~ 3 teev ntawm kev siv Tsuas yog 3 IC nws tuaj yeem ua tau Charlieplex 6 7-ntu LEDs. Power kos yog kwv yees li 30mA nrog qhov tsim qauv no, uas tsis phem yog tias kuv hais li kuv tus kheej. Kuv xav tias ntau 7-ntu LED tuaj yeem siv tau, tab sis tsis thawb lub hnab ntawv. yuav tsum siv rau yuav luag txhua daim ntawv thov siv 7-ntu LEDs; tus pas ntsuas kub, lub moos, cov ntawv nyeem, thiab lwm yam Nrog qee qhov ua kom yuam kev, koj tuaj yeem muaj cov khoom txav mus los, lossis duab … tej zaum txawm tias yog lub hauv paus rau POV (kev nyob ruaj khov ntawm lub zeem muag) txoj haujlwm. thiab muab lub rooj tsavxwm tso rau, raws li nws pom zoo. Yog/Thaum qhov ntawd ua tiav, Kuv yuav tau txais daim duab tso tawm. Tab sis raws li rau lub Circuit Court, qhov no zoo li tau tsim los xaj!

Pom zoo: