Cov txheej txheem:
- Kauj Ruam 1: Tsim Cov Tswv Yim Counter
- Kauj Ruam 2: Tsim LED Clock Divider
- Kauj Ruam 3: Tsim LED Controller
- Kauj Ruam 4: Tsim kom muaj kev txwv thiab sib dhos
- Kauj Ruam 5: Siv Koj Li Dimmer Hloov
Video: Dimmable LED Siv Basys 3 Board: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Hauv phau ntawv qhia no peb yuav tsim thiab tswj cov txheej txheem sab nrauv LED dimming. Nrog cov nyees khawm muaj, tus neeg siv tuaj yeem txo lub teeb LED rau txhua qhov kev xav tau ci. Lub kaw lus siv Basys 3 lub rooj tsavxwm, thiab nws txuas nrog lub khob cij uas muaj cov tiv thaiv thiab lub teeb LED. Nias lub khawm "nce" xaiv yuav ua rau pom kev ci ntsa iab, thiab nias lub pob "nqis" yuav txo qhov ci ci mus rau xoom. Tsis tsuas yog qhov no tiv thaiv tus neeg siv los ntawm qhov muag tsis pom los ntawm lub teeb ci zoo li lub hnub tab sis nws tseem txuag lub zog!
Kauj Ruam 1: Tsim Cov Tswv Yim Counter
Rau cov kauj ruam no peb tsim cov khoom siv uas txiav txim siab qib kev ci ntsa iab (dhau ntawm lub moos) los ntawm kev siv ob lub hloov pauv: ib qho kom nce thiab ib qho kom txo qis. Siv VHDL, peb tsim lub txee los ntawm kev siv D flip-flops. Nias lub pob "nce" thawb lub xeev tom ntej mus rau lub xeev tam sim no, tso tawm mus rau xya ntu ntu thiab lub teeb LED.
entity updown_counter yog
Chaw nres nkoj (present_state: tawm STD_LOGIC_VECTOR (3 downto 0); yav dhau los_state: hauv STD_LOGIC_VECTOR (3 downto 0); next_state: hauv STD_LOGIC_VECTOR (3 downto 0); clk: hauv STD_LOGIC; down_enable: hauv STD kawg updown_counter; architecture Tus cwj pwm ntawm kev hloov kho tshiab_counter yog pib flop: txheej txheem (next_state, clk, nce_enable, down_enable, yav dhau los_state) pib yog (nce_edge (clk)) ces yog (up_enable = '1' thiab tsis yog (next_state = "0000")) ces present_state <= tom ntej_state; elsif (down_enable = '1' thiab tsis yog (yav dhau los_state = "1111")) ces tam sim no_state <= yav dhau los_state; kawg yog; kawg yog; kawg txheej txheem flop; kawg Tus Cwj Pwm;
Peb kuj xav tau lub moos rau txhua qhov kev nkag mus rau hauv qhov chaw (thaum nws nce), yog li peb kuj tsim lub moos faib uas txiav txim siab nrawm npaum li cas cov nyees khawm tuaj yeem nias ntawm txhua qib ntawm qhov ci. Lub moos faib ua haujlwm no tso cai rau peb kom ua kom raug rau qib raug rau ntawm xya ntu ntu thiab tsim kom raug rau qib raug rau txhua qib.
entity counter_clkDiv yog
Chaw nres nkoj (clk: hauv std_logic; sclk: tawm std_logic); kawg counter_clkDiv; architecture my_clk_div ntawm counter_clkDiv tas li max_count: integer: = (10000000); teeb liab tmp_clk: std_logic: = '0'; pib my_div: txheej txheem (clk, tmp_clk) sib txawv div_cnt: integer: = 0; pib yog (nce_edge (clk)) ces yog (div_cnt> = MAX_COUNT) ces tmp_clk <= tsis tmp_clk; div_cnt: = 0; lwm qhov div_cnt: = div_cnt + 1; kawg yog; kawg yog; sclk <= tmp_clk; kawg txheej txheem my_div; kawg my_clk_div;
Kauj Ruam 2: Tsim LED Clock Divider
Rau cov kauj ruam no peb tsim lub moos faib rau lub teeb LED txhawm rau txiav txim siab 16 qib sib txawv ntawm kev siv. Nrog 0 tau tawm mus rau 15 tso tawm qhov siab tshaj plaws, lub moos faib ua ntu zuj zus txhua lub pob nyem los ntawm qhov peb teeb tsa ua qib ci ntsa iab. Txhua qib nce ntxiv txhais tau tias nce hauv lub moos rau lub teeb LED. Nco ntsoov tias qhov ci ntsa iab tsis nce ntxiv, peb cranked lub moos mus rau qhov siab tshaj plaws nws tuaj yeem mus thiab txo peb cov moos raws li.
Nco tseg: peb tab tom siv LED xiav. Siv cov xim sib txawv (zoo li liab) yuav xav tau lub moos sib txawv me ntsis rau nws; qhov nruab nrab qhov ci ci rau xiav tuaj yeem yog qhov ci tshaj plaws rau liab. Qhov no tshwm sim vim qhov sib txawv ntawm lub teeb yuav xav tau ntau lub zog, nrog cov xim txias dua li xim liab thiab xiav xav tau lub zog ntau dua, thaum cov xim sov dua li liab thiab txiv kab ntxwv xav tau lub zog tsawg dua.
entity led_clkDiv is Port (present_state: in STD_LOGIC_VECTOR (3 downto 0); clk: in STD_LOGIC; led_clk: tawm STD_LOGIC); kawg led_clkDiv; architecture Tus cwj pwm coj ntawm led_clkDiv yog teeb liab tmp_clk: std_logic: = '0'; sib koom sib txawv max_count: integer; pib suav_stuff: txheej txheem (tam sim no_state) pib rooj plaub present_state yog thaum "0000" => max_count: = 0; thaum "0001" => max_count: = 2; thaum "0010" => max_count: = 4; thaum "0011" => max_count: = 6; thaum "0100" => max_count: = 8; thaum "0101" => max_count: = 10; thaum "0110" => max_count: = 12; thaum "0111" => max_count: = 14; thaum "1000" => max_count: = 16; thaum "1001" => max_count: = 25; thaum "1010" => max_count: = 50; thaum "1011" => max_count: = 100; thaum "1100" => max_count: = 150; thaum "1101" => max_count: = 200; thaum "1110" => max_count: = 250; thaum "1111" => max_count: = 300; rooj plaub xaus; kawg txheej txheem count_stuff; my_div: txheej txheem (clk, tmp_clk, tam sim no_state) sib txawv div_cnt: integer: = 0; pib yog (nce_edge (clk)) ces yog (div_cnt> = max_count) ces tmp_clk <= tsis tmp_clk; div_cnt: = 0; lwm qhov div_cnt: = div_cnt + 1; kawg yog; kawg yog; led_clk <= tmp_clk; kawg txheej txheem my_div; kawg Tus Cwj Pwm;
Kauj Ruam 3: Tsim LED Controller
Tam sim no uas peb tau ua nws nyob deb no, nws yog lub sijhawm kawg thaum kawg ua ke txhua yam khoom siv uas peb tau tsim kom deb li deb mus rau hauv LED Controller file.
Yuav kom xaus, cov khoom siv yog cov hauv qab no:
- Cov tswv yim tawm tswv yim (updown_counter)
- Clock divider (counter_clkDiv)
- LED moos faib (led_clkDiv)
- Xya-ntu tso saib tsav tsheb (sseg_dec) (txuas nrog cov ntawv)
Xya-ntu cov neeg tsav tsheb tsis tau tham yav dhau los vim tias peb tau qiv cov ntaub ntawv VHDL los ntawm Dr. Bryan Mealy vim nws txoj cai ntev thiab nyuaj. Dab tsi nws qhov tseem ceeb ua yog tsav peb lub khawm nkag mus rau xya ntu ntu ntawm Basys 3 pawg thawj coj kom peb paub tias qib kev ci ntsa iab nyob rau qhov twg.
Txav mus rau tom ntej, Tus Tswj Xyuas LED siv flip flops txhawm rau nce lossis txo qhov suav uas tswj hwm ob ntu ntu ntu thiab qib qhov ci ntawm LED teeb ib txhij.
cov khoom suav yog Port (clk: hauv STD_LOGIC; nce_enable: hauv STD_LOGIC; down_enable: hauv STD_LOGIC; SEGMENTS: tawm STD_LOGIC_VECTOR (7 downto 0); DISP_EN: tawm STD_LOGIC_VECTOR (3 downto:) kawg txee; architecture Kev coj tus cwj pwm ntawm lub txee yog kev hloov kho tshiab_counter yog Port (tam sim no_state: tawm STD_LOGIC_VECTOR (3 downto 0); yav dhau los_state: hauv STD_LOGIC_VECTOR (3 downto 0); next_state: hauv STD_LOGIC_VECTOR (3 downto 0); clk: hauv up_enable: hauv STD_LOGIC); kawg tivthaiv updown_counter; tivthaiv counter_clkDiv yog Port (clk: hauv std_logic; sclk: tawm std_logic); kawg tiv thaiv counter_clkDiv; tivthaiv sseg_dec yog Port (ALU_VAL: in std_logic_vector (7 downto 0); SIGN: in std_logic; VALID: in std_logic; CLK: in std_logic; DISP_EN: tawm std_logic_vector (3 downto 0); SEGMENTS:; kawg tivthaiv sseg_dec; tivthaiv led_clkDiv yog Port (tam sim no_state: hauv STD_LOGIC_VECTOR (3 downto 0); clk: hauv STD_LOGIC; led_clk: tawm STD_LOGIC); kawg tivthaiv led_clkDiv; teeb liab present_state: STD_LOGIC_VECTOR (3 downto 0): = "0000"; teeb liab next_state: STD_LOGIC_VECTOR (3 downto 0): = "0000"; teeb liab yav dhau los_state: STD_LOGIC_VECTOR (3 downto 0): = "0000"; teeb liab Alu_Val: STD_LOGIC_VECTOR (7 downto 0); teeb liab sclk: STD_LOGIC; pib Alu_Val (7 downto 4) <= "0000"; Alu_Val (3 downto 0) <= tam sim no_state; next_state (0) <= tsis (tam sim no_state (0))); next_state (1) <= tam sim no_state (0) xor tam sim no_state (1); next_state (2) <= (present_state (0) thiab present_state (1)) xor present_state (2); next_state (3) <= (present_state (0) thiab present_state (1) thiab present_state (2)) xor present_state (3); yav dhau los_state (0) <= tsis (tam sim no_state (0))); yav dhau los_state (1) <= tam sim no_state (0) xnor tam sim no_state (1); yav dhau los_state (2) <= (tam sim no_state (0) lossis tam sim no_state (1)) xor tam sim no_state (2); yav dhau los_state (3) sclk, next_state => next_state, yav dhau los_state => yav dhau los_state, up_enable => up_enable, down_enable => down_enable, present_state => tam sim no_state); display: sseg_dec chaw nres nkoj daim ntawv qhia (ALU_VAL => Alu_Val, SIGN => '0', VALID => '1', CLK => clk, DISP_EN => DISP_EN, SEGMENTS => SEGMENTS); led_div: led_clkDiv port map (clk => clk, present_state => present_state, led_clk => led_clk); clk_div: counter_clkDiv chaw nres nkoj daim ntawv qhia (clk => clk, sclk => sclk); kawg Tus Cwj Pwm;
Kauj Ruam 4: Tsim kom muaj kev txwv thiab sib dhos
Kev txwv
Txhawm rau teeb tsa kom raug thiab teeb tsa Lub Rooj Sib Tham Basys 3, peb yuav tsum xub teeb tsa peb cov ntaub ntawv txwv uas txuas nrog rau theem no. Cov chaw hauv qab no tau hloov kho:
Nyees khawm
- Hloov T18 rau "up_enable" (nce qhov ci)
- Hloov U17 rau "down_enable" (txo qhov ci)
7 ntu zaub
- W7, W6, U8, V8, U5, V5, U7, V7 sawv cev rau txhua ntu ntawm ib qho zaub
- U2, U4, V4, W4 sawv cev rau txhua qhov anode tso tawm (tsuas yog 2 ua haujlwm vim tias peb tus lej siab tshaj yog 15)
PMOD Lub taub hau JC
JC7 yog qhov uas peb txuas ib qho ntawm cov xov hlau ntawm lub teeb LED, thiab lwm txoj xov hlau coj mus rau GROUND
Tom qab teeb tsa qhov no tag nrho, txhua yam koj yuav tsum tau ua yog tsim koj li bitstream (nrog rau qhov software twg koj siv piv txwv li Vivado), teeb tsa koj lub rooj tsavxwm, thiab tawg! Koj tau txais koj tus kheej pawg thawj coj ua haujlwm.
Nco tseg: Tus pin taw qhia tuaj yeem pom ntawm Basys 3 Datasheet ntawm no.
Los ua ke
Kauj Ruam 5: Siv Koj Li Dimmer Hloov
Yog tias txhua yam mus zoo, koj yuav tsum muaj lub kaw lus ua haujlwm dimmer. Txhawm rau ua kom pom tseeb, nias lub pob saum toj kawg nkaus yuav ua rau koj qhov ci ci (txhua txoj kev mus rau 15), thiab nias lub pob kom qis yuav txo koj qhov ci ci (txhua txoj kev mus rau 0). Vam tias txhua yam mus zoo rau koj tam sim no-pom qhov muag!
Pom zoo:
Cov Khoom Siv Teeb Meem Siv Chaw Taws Teeb Siv Arduino: 7 Kauj Ruam
Cov Khoom Siv Teeb Meem Siv Khoom Siv Hluav Taws Xob Siv Arduino: Tam sim no, Cov Tsim, Cov tsim tawm tau nyiam Arduino rau kev txhim kho sai ntawm cov qauv ntawm cov phiaj xwm. Arduino yog lub platform siv hluav taws xob qhib raws qhov yooj yim-rau-siv-kho vajtse thiab software. Arduino muaj zej zog cov neeg siv zoo heev. Hauv qhov no
Saib Xyuas Kev Siv Sijhawm Siv Raspberry Pi thiab AIS328DQTR Siv Python: 6 Cov Kauj Ruam
Saib Xyuas Kev Siv Sijhawm Siv Raspberry Pi thiab AIS328DQTR Siv Python: Kev nrawm yog qhov kawg, Kuv xav raws li qee txoj cai ntawm Physics.- Terry Riley Tus cheetah siv qhov nrawm nrawm thiab hloov pauv sai thaum caum. Tus tsiaj nrawm tshaj plaws nyob ntawm ntug hiav txwv ib zaug hauv ib lub sijhawm siv nws qhov nrawm tshaj plaws kom ntes tau cov tsiaj txhu. Qhov
Txawb Xov Tooj Siv Yooj Yim Siv STM32F407 Cov Khoom Siv Tshawb Pom thiab GSM A6 Module: 14 Cov Kauj Ruam (nrog Duab)
Kev Siv Xov Tooj Ntawm Lub Xov Tooj Siv STM32F407 Cov Khoom Siv Tshawb Pom thiab GSM A6 Module: Koj puas tau xav tsim qhov kev ua kom txias txias? Yog tias yog, ua li cas txog kev tsim ib qho ntawm cov neeg nyiam tshaj plaws thiab txhua tus nyiam cov khoom siv xws li Lub Xov Tooj Txawb !!!. Hauv Cov Lus Qhia no, Kuv yuav qhia koj yuav tsim lub xov tooj txawb yooj yim siv STM li cas
Tsis Siv Neeg Kev Hla Hla Kev Siv Hluav Taws Xob Siv Arduino Raws Kev Nkag Nkag Platform: 9 Cov Kauj Ruam
Tsis Siv Neeg Kev Hla Hla Kev Siv Hluav Taws Xob Siv Arduino Raws Kev Nkag Siab Platform: Christmas tsuas yog ib lub lim tiam xwb! Txhua leej txhua tus tibneeg hu tauj coob nrog kev ua koob tsheej thiab tau txais khoom plig, uas, los ntawm txoj kev, tau txais txhua qhov nyuaj dua kom tau nrog qhov tsis muaj peev xwm nyob ib puag ncig peb. Yuav ua li cas mus los ntawm khoom plig qub thiab ntxiv qhov kov ntawm DIY rau
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: 6 Kauj Ruam
Arduino Neeg Hlau Nrog Kev Nyob, Kev Qhia thiab Qib Kev Sib Hloov (Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) Tswj los ntawm Lub Suab Siv Bluetooth Module thiab Kev Siv Tus Neeg Siv Hluav Taws Xob: Cov lus qhia no piav qhia yuav ua li cas thiaj tsim tau Arduino Robot uas tuaj yeem txav mus raws qhov xav tau (Forward, Backward) , Sab laug, Txoj Cai, Sab Hnub Poob, Sab Hnub Poob, Sab Qaum Teb, Sab Qab Teb) xav tau Kev nrug deb hauv Centimeters siv lub suab hais kom ua. Neeg hlau kuj tseem tuaj yeem txav tau tus kheej