Cov txheej txheem:

MCP41HVX1 Digital Potentiometer rau Arduino: 10 Kauj Ruam (nrog Duab)
MCP41HVX1 Digital Potentiometer rau Arduino: 10 Kauj Ruam (nrog Duab)

Video: MCP41HVX1 Digital Potentiometer rau Arduino: 10 Kauj Ruam (nrog Duab)

Video: MCP41HVX1 Digital Potentiometer rau Arduino: 10 Kauj Ruam (nrog Duab)
Video: Show Wiper Control Arduino sketch running while controlling an MCP41HV51-104E/ST digipot. 2024, Hlis ntuj nqeg
Anonim
MCP41HVX1 Digital Potentiometer rau Arduino
MCP41HVX1 Digital Potentiometer rau Arduino

MCP41HVX1 tsev neeg ntawm digital potentiometers (aka DigiPots) yog cov cuab yeej siv uas ua raws li kev ua haujlwm ntawm cov potentiometer analog thiab raug tswj los ntawm SPI. Ib qho piv txwv thov yuav hloov lub pob qhov rooj ntawm koj lub tso suab nrog DigiPot uas yog tswj los ntawm Arduino. Qhov no kwv yees tias kev tswj ntim ntawm koj lub tso suab yog lub hwj chim thiab tsis yog lub cav nkag teb chaws.

MCP41HVX1 yog qhov txawv me ntsis tom qab lwm qhov DigiPots hauv qhov uas lawv muaj cov qauv kev tsheb ciav hlau sib cais. Qhov no txhais tau tias thaum DigiPot nws tus kheej tuaj yeem tswj tau los ntawm qhov hluav taws xob tso tawm ntawm Arduino, lub teeb liab uas dhau los ntawm lub network resistor ua haujlwm nrog ntau qhov ntau ntawm qhov hluav taws xob (txog 36 volts). Feem ntau DigiPots uas tuaj yeem tswj tau los ntawm 5 volts raug txwv rau 5 volts hla cov resistor network uas txwv lawv kev siv rau rov kho dua ib qho kev sib txuas uas twb muaj lawm uas ua haujlwm ntawm qhov hluav taws xob ntau dua xws li koj yuav pom hauv tsheb lossis nkoj.

Tsev neeg MCP41HVX1 yog ua los ntawm cov kab hauv qab no:

  • MCP41HV31-104E/ST - 100k ohm (7 khoom)
  • MCP41HV31-503E/ST - 50k ohm (7 khoom)
  • MCP41HV31-103E/ST - 10k ohm (7 khoom)
  • MCP41HV31-502E/ST - 5k ohm (7 khoom)
  • MCP41HV31-103E/MQ - 10k ohm (7 khoom)
  • MCP41HV51-104E/ST - 100k ohm (8 khoom)
  • MCP41HV51-503E/ST - 50k ohm (8 khoom)
  • MCP41HV51T -503E/ST - 50k ohm (8 khoom)
  • MCP41HV51-103E/ST - 10k ohm (8 khoom)
  • MCP41HV51-502E/ST - 5k ohm (8 khoom)

Lub 7 ntsis chips tso cai rau 128 cov kauj ruam hauv lub network resistor thiab 8 ntsis chips pub rau 256 cov kauj ruam hauv cov resistor network. Qhov no txhais tau tias 8 ntsis chips tso cai rau ua ob zaug kom muaj nuj nqis tiv thaiv los ntawm cov potentiometer.

Khoom siv

  • Xaiv qhov tsim nyog MCP41HVX1 nti los ntawm cov npe saum toj no. Cov nti uas koj xaiv yog ua raws qhov kev tawm tsam xav tau rau koj daim ntawv thov. Cov Lus Qhia no yog ua raws TSSOP 14 pob ntawv ntawm cov nti kom ua raws nrog cov lus qhia no xaiv ib qho nti hauv cov npe tshwj tsis yog MCP41HV31-103E/MQ uas yog pob QFN. Nws tau pom zoo kom tau txais ob peb daim ntxiv raws li kuv tau ntsib qhov tsis zoo thiab lawv pheej yig. Kuv xaj kuv li ntawm Digi-Key.
  • Secondary DC fais fab mov uas yog los ntawm 10 txog 36 volts. Hauv kuv qhov piv txwv kuv siv 17 volt phab ntsa wart DC fais fab mov los ntawm kuv lub thawv ntawm cov khoom siv hluav taws xob qub.
  • Soldering flux
  • Soldering hlau
  • Solder
  • Tweezers thiab / lossis txhuam hniav
  • TSSOP 14 tus pin breakout board - Amazon - QLOUNI 40pcs PCB Proto Boards SMD rau DIP Adapter Plate Converter TQFP (32 44 48 64 84 84 100) SOP SSOP TSSOP 8 10 14 16 20 23 24 28 (Muaj ntau qhov ntau. Muaj ntau rau ntau txoj haujlwm)
  • Quantify ntawm 2 - 7 tus pin headers - Amazon - DEPEPE 30 Pcs 40 Pin 2.54mm Txiv neej thiab Poj Niam Pin Headers rau Arduino Prototype Shield - (Txiav kom loj me xav tau. Muaj ntau hauv pob rau ntau txoj haujlwm)
  • Arduino Uno - yog tias koj tsis muaj ib qho kuv xav qhia kom tau txais lub rooj tsav xwm raug cai. Kuv tau muaj hmoov sib xyaw nrog cov ntawv tsis raug cai. Digi -Key - Arduino Uno
  • Multi-meter uas tuaj yeem ntsuas qhov tsis kam thiab tseem txheeb xyuas qhov txuas ntxiv mus
  • Jumper xov hlau
  • Cov qhob cij
  • Cov lus pom zoo tab sis tsis tas yuav tsum tau yog lub tsom iav dawb tsis siv tes raws li TSSOP chips me me. Koj yuav xav tau ob txhais tes rau qhov muag thiab ntsuas nrog ntau lub ntsuas. Kuv siv ib khub ntawm Harbor Freight 3x Clip-On Magnifiers nyob rau sab saum toj ntawm kuv cov iav tsom iav thiab muaj kev ywj pheej sawv ntsug hais txog iav tsom iav. Lwm qhov kev xaiv yog ib khub ntawm cov neeg nyeem pheej yig los ntawm cov luv nqi lossis khw duas. Koj tseem tuaj yeem hnav cov nyeem ntawm koj lub iav tsom iav lossis tau txais ob khub ntawm cov nyeem (ib qho saum toj ntawm lwm qhov) nyob ntawm seb koj zoo (lossis tsis zoo) koj lub zeem muag zoo li cas. Yog tias koj tau nce ob npaug ntawm tsom iav yuav tsum ceev faj vim tias koj lub zeem muag yuav raug txwv heev yog li nco ntsoov tshem lawv ua ntej ua lwm yam. Kuj yuav tsum tau ceev faj ntxiv thaum siv cov khoom siv.
  • Lwm yam khoom uas tsis xav tau tab sis pom zoo yog Harbor Freight Helping Hands. Lawv yog cov yeeb yaj kiab uas txuas nrog lub hauv paus hlau. Cov no muaj los ntawm ntau lwm tus neeg muag khoom hauv is taws nem nrog rau hauv cov npe sib txawv. Cov no yog qhov muaj txiaj ntsig zoo heev thaum siv cov laug txuas rau ntawm pawg thawj coj.

Kauj Ruam 1: Solder TSSOP Chip rau Pawg Txiav Txim

Image
Image
Soldering TSSOP Chip rau Pawg Txiav Txim
Soldering TSSOP Chip rau Pawg Txiav Txim
Soldering TSSOP Chip rau Pawg Txiav Txim
Soldering TSSOP Chip rau Pawg Txiav Txim

TSSOP nti yuav tsum tau muab muag rau lub rooj sib tsoo tawg kom koj tuaj yeem siv nws nrog lub khob cij lossis ncaj qha nrog DuPont dhia. Txog kev ua qauv ua ntej lawv me me dhau los ua haujlwm ncaj qha.

Vim tias lawv qhov me me, siv cov TSSOP nti yuav yog qhov nyuaj tshaj plaws ntawm txoj haujlwm no tab sis paub txog qhov ua kom yuam kev ua qhov no ua rau nws ua haujlwm uas txhua tus tuaj yeem ua tiav. Muaj ntau cov txheej txheem, ib qho hauv qab no yog qhov kuv tau ua.

Lub tswv yim yog txhawm rau txhawm rau txhawm rau txhawm rau txhawm rau txhawm rau ntawm pawg thawj coj tawg.

  • Tsis txhob muab lub nti tso rau ntawm pawg thawj coj tawg kom txog thaum qhia.
  • Thawj qhov uas yuav tsum tau ua yog ua kom muaj txiaj ntsig zoo ntawm cov dej ntws mus rau lub rooj sib cais.
  • Tom ntej no, siv koj cov hlau ua kom sov qee qhov laug thiab ntws nws mus rau qhov cim tseg.
  • Muab qee qhov ntxiv tso rau sab saum toj ntawm cov laug uas koj ntws tawm ntawm cov khoom ib yam li hauv qab ntawm ob txhais ceg ntawm nti.
  • Muab cov nti tso rau saum cov kab uas koj nyuam qhuav tso cov laug thiab cov dej ntws. Tweezers lossis tus pas txhuam hniav ua rau cov cuab yeej zoo rau kev teeb tsa lub nti kom raug. Nco ntsoov ua kom haum cov nti kom raug kom tag nrho cov pins ncaj qha saum cov kab. Teem tus pin ib qho ntawm cov nti nrog kos rau tus pin rau ntawm lub rooj txiav tawm.
  • Siv koj cov hlau ua kom sov ib qho ntawm tus pin ntawm qhov kawg ntawm lub nti (tog twg los tus pin 1, 7, 8, lossis 14) nias nws rau hauv kab. Cov laug uas koj tau thov yav dhau los yuav yaj thiab ntws ncig tus pin.

Saib cov vis dis aus hauv cov kauj ruam no kom pom qhov ua piv txwv ntawm yuav ua li cas txhawm rau txhawm rau lub rooj sib tsoo. Ib qhov lus qhia uas kuv muaj qhov txawv ntawm daim vis dis aus yog tias tom qab koj tau siv thawj tus pin nres thiab rov tshuaj xyuas kom haum ntawm tag nrho cov nti kom paub tseeb tias txhua tus pins tseem nyob saum cov kab. Yog tias koj tawm me ntsis nws yog qhov yooj yim los kho ntawm qhov no. Thaum koj tau yooj yim txhua yam zoo li zoo, muab lwm tus pin tso rau ntawm qhov kawg ntawm lub nti thiab tshawb xyuas qhov sib dhos dua. Yog tias zoo li zoo mus tom ntej thiab ua tus so ntawm tus pin.

Tom qab koj tau muag tag nrho cov pins cov vis dis aus qhia siv lub iav tsom iav txhawm rau txheeb xyuas koj cov kev sib txuas. Ib txoj hauv kev zoo dua yog siv lub multimeter los tshuaj xyuas txuas ntxiv. Koj yuav tsum tso ib qho kev sojntsuam rau ntawm tus taw ntawm tus pin thiab lwm qhov kev sojntsuam mus rau ntu ntawm lub rooj tsavxwm uas koj yuav muab lub taub hau tso rau (saib daim duab thib ob hauv cov kauj ruam no). Koj yuav tsum tau txheeb xyuas cov pins uas nyob ib sab kom paub tseeb tias lawv tsis txuas nrog vim cov kab laug sab luv ob peb tus pin ua ke. Yog li piv txwv yog tias koj tab tom txheeb xyuas tus pin 4, tseem txheeb xyuas tus pin 3 thiab tus pin 5. Tus pin 4 yuav tsum qhia txuas mus ntxiv thaum tus pin 3 thiab tus pin 5 yuav tsum qhib qhov qhib. Tsuas yog qhov tshwj xeeb yog lub wiper P0W tuaj yeem qhia kev sib txuas rau P0A lossis P0B.

Tswv yim:

  • Raws li tau hais hauv cov npe khoom muaj qee qhov kev nthuav dav muaj uas tso koj txhais tes dawb los ua haujlwm yuav pab tau zoo hauv theem no.
  • Siv tus nab kuab clip pab txhais tes tuav lub rooj sib tsoo tawg ua rau txhua yam yooj yim dua.
  • Sau tus lej naj npawb ntawm daim kab xev daim kab xev thiab lo rau hauv qab ntawm pawg thawj coj tawg (saib daim duab thib peb hauv ntu no). Yog tias yav tom ntej koj yuav tsum txheeb xyuas lub nti nws yuav yooj yim dua los nyeem daim kab xev. Kuv tus kheej kev paub yog tias kuv tau txais me ntsis flux ntawm lub nti thiab tus naj npawb tuaj tawm kiag li yog li txhua yam kuv muaj yog kab xev.

Kauj ruam 2: Kev thaiv kab

Thaiv
Thaiv

Koj yuav tsum txuas Arduino thiab Digipot raws li qhia hauv kab duab kab. Cov koob uas tau siv yog ua raws qhov teeb tsa ntawm Arduino Uno. Yog tias koj siv lwm qhov Arduino sib txawv pom cov kauj ruam kawg.

Kauj Ruam 3: Tau Txais Arduino Library rau Tswj DigiPot

Tau txais Arduino Library rau Tswj DigiPot
Tau txais Arduino Library rau Tswj DigiPot

Txhawm rau kom yooj yim programing Kuv tau tsim lub tsev qiv ntawv uas muaj nyob ntawm Github. Mus rau github.com/gregsrabian/MCP41HVX1 kom tau MCP41HVX1 lub tsev qiv ntawv. Koj yuav xav xaiv lub pob "Clone" thiab tom qab ntawd xaiv "Download Zip". Nco ntsoov khaws Zip cov ntaub ntawv mus rau qhov chaw uas koj paub tias nws nyob qhov twg. Lub desktop lossis rub tawm cov ntawv yog qhov chaw yooj yim. Thaum koj import nws mus rau hauv Arduino IDE koj tuaj yeem tshem nws los ntawm qhov chaw rub tawm.

Kauj Ruam 4: Ntshuam Lub Tsev Qiv Ntawv Tshiab rau hauv Arduino IDE

Ntshuam Lub Tsev Qiv Ntawv Tshiab rau hauv Arduino IDE
Ntshuam Lub Tsev Qiv Ntawv Tshiab rau hauv Arduino IDE

Hauv Arduino IDE mus rau "Sketch", tom qab ntawv xaiv "suav nrog Lub Tsev Qiv Ntawv", tom qab ntawd xaiv "Ntxiv ZIP Library..". Lub npov lus sib tham tshiab yuav tshwm los tso cai rau koj xaiv cov. ZIP cov ntaub ntawv uas koj rub tawm los ntawm GitHub.

Kauj Ruam 5: Piv Piv Tsev Qiv Ntawv

Piv Txwv Qiv
Piv Txwv Qiv

Tom qab koj tau ntxiv lub tsev qiv ntawv tshiab koj yuav pom tias yog koj mus rau "Cov Ntaub Ntawv", tom qab ntawv xaiv "Piv txwv", thiab tom qab ntawv xaiv "Piv txwv los ntawm Cov Tsev Qiv Ntawv" koj tam sim no koj yuav pom nkag rau MCP41HVX1 hauv cov npe. Yog tias koj nyob ntawm qhov nkag ntawd koj yuav pom WLAT, Wiper Control, thiab SHDN uas yog piv txwv piv txwv. Hauv Cov Lus Qhia no peb yuav siv tus piv txwv Wiper Control.

Kauj Ruam 6: Txheeb Xyuas Qhov Code

#include "MCP41HVX1.h" // Txheeb xyuas cov pins siv ntawm Arduino#txhais WLAT_PIN 8 // Yog tias teeb tsa qis "hloov pauv thiab siv" #define SHDN_PIN 9 // Teem siab kom pab tau lub resistor network#txhais CS_PIN 10 // Teem kom qis los xaiv cov nti rau SPI // Txheeb xyuas qee qhov txiaj ntsig siv rau kev xeem app#txheeb xyuas FORWARD tseeb#txhais REVERSE cuav#txhais MAX_WIPER_VALUE 255 // Qhov siab tshaj plaws wiper muaj nuj nqis MCP41HVX1 Digipot (CS_PIN, SHDN_PIN, WLAT_PIN); tsis muaj teeb tsa () { Serial.begin (9600); Serial.print ("Pib Txoj Haujlwm ="); Serial.println (Digipot. WiperGetPosition ()); // Zaub pib tus nqi Serial.print ("Teeb Wiper Txoj Haujlwm ="); Serial.println (Digipot. WiperSetPosition (0)); // Teeb tsa txoj haujlwm wiper rau 0} void loop () {static bool bDirection = FORWARD; int nWiper = Digipot. WiperGetPosition (); // Tau txais txoj haujlwm wiper tam sim no // Txiav txim siab qhov kev taw qhia. yog (MAX_WIPER_VALUE == nWiper) {bDirection = REVERSE; } lwm yog (0 == nWiper) {bDirection = FORWARD; } // Tsiv tus digipot wiper yog (FORWARD == bDirection) {nWiper = Digipot. WiperIncrement (); // Cov lus qhia yog xa mus rau Serial.print ("nce ntxiv -"); } lwm {nWiper = Digipot. WiperDecrement (); // Cov kev taw qhia yog rov qab Serial.print ("Decrement -"); } Serial.print ("Txoj Haujlwm Wiper ="); Serial.println (nWiper); ncua (100);}

Kauj Ruam 7: Nkag Siab Qhov Code thiab Khiav Cov Duab

Image
Image

Cov peev txheej no muaj nyob hauv Arduino IDE los ntawm kev mus rau Piv Txwv cov ntawv qhia zaub mov thiab nrhiav MCP41HVX1 uas koj nyuam qhuav teeb tsa (saib cov kauj ruam dhau los). Hauv MCP41HVX1 qhib qhov "Wiper Control" piv txwv. Nws yog qhov zoo tshaj plaws los siv cov cai uas suav nrog lub tsev qiv ntawv zoo li muaj qee qhov kev kho kab mob nws yuav raug hloov kho tshiab.

Tus Wiper Control piv txwv qhia cov API hauv qab no los ntawm MCP41HVX1 lub tsev qiv ntawv:

  • Tus Tsim MCP41HVX1 (int nCSPin, int nSHDNPin, int nWLATPin)
  • WiperGetPosition ()
  • WiperSetPosition (byte byWiper)
  • WiperIncrement ()
  • WiperDecrement ()

Hauv cov qauv piv txwv tus lej kom ntseeg tau teev MAX_WIPER_VALUE txog 127 yog tias koj siv 7 ntsis nti. Lub neej ntawd yog 255 uas yog rau 8 ntsis chips. Yog tias koj hloov pauv tus qauv Arduino IDE yuav yuam kom koj xaiv lub npe tshiab rau txoj haujlwm vim nws yuav tsis pub koj hloov qhov piv txwv piv txwv. Qhov no yog kev coj ua.

Txhua lub sijhawm hla lub voj lub wiper yuav nce ntxiv los ntawm ib qib lossis txo qis los ntawm ib qib nyob ntawm qhov kev taw qhia nws mus. Yog tias cov lus qhia tau nce thiab nws tau mus rau MAX_WIPER_VALUE nws yuav thim rov qab. Yog tias nws tsoo 0 nws yuav thim rov qab.

Raws li cov duab kos sau cov ntawv saib xyuas raug hloov tshiab nrog txoj haujlwm wiper tam sim no.

Txhawm rau pom qhov kev hloov pauv koj yuav tsum tau siv lub ntsuas ntsuas teeb los nyeem Ohms. Muab lub ntsuas ntsuas ntsuas rau ntawm P0B (tus pin 11) thiab P0W (tus pin 12) ntawm tus digipot kom pom qhov tsis kam hloov pauv raws li daim ntawv thov tau ua haujlwm. Nco ntsoov tias tus nqi tiv thaiv yuav tsis mus txhua qhov mus rau xoom raws li muaj qee qhov kev tiv thaiv sab hauv hauv nti tab sis nws yuav ze rau 0 ohms. Feem ntau nws yuav tsis mus rau tus nqi siab tshaj plaws tab sis yuav nyob ze.

Raws li koj saib cov vis dis aus koj tuaj yeem pom lub ntsuas ntsuas pom qhov ua haujlwm nce mus txog thaum nws mus txog tus nqi siab tshaj thiab tom qab ntawd pib txo qis. Cov nti uas siv hauv yeeb yaj kiab yog MCP41HV51-104E/ST uas yog 8 ntsis nti nrog 100k ohm tus nqi siab tshaj.

Kauj ruam 8: Troubleshooting

Yog tias txhua yam tsis ua haujlwm raws li qhov xav tau ntawm no yog ob peb yam los saib.

  • Txheeb xyuas koj cov kab. Txhua yam yuav tsum txuas nrog kom raug. Nco ntsoov tias koj tab tom siv daim duab kab hluav taws xob tag nrho raws li tau hais hauv Cov Lus Qhia no. Muaj lwm txoj kab hluav taws xob uas tau nthuav tawm hauv README, cov tsev qiv ntawv qhov chaws, thiab hauv qab no hauv Cov Lus Qhia no tab sis lo nrog cov ntaub ntawv teev tseg saum toj no hauv Cov kauj ruam kauj ruam saum toj no.
  • Nco ntsoov tias txhua tus pin ntawm koj tus lej digitpot tau muab muag rau hauv pawg thawj coj. Siv kev tshuaj xyuas qhov muag tsis zoo txaus. Nco ntsoov tias koj txheeb xyuas kev siv lub luag haujlwm txuas ntxiv ntawm koj lub ntsuas cua kom paub tseeb tias txhua tus pins ntawm digipot tau txuas nrog hluav taws xob mus rau pawg tswj hwm kev tawg thiab tsis muaj kev sib txuas ntawm cov pins los ntawm cov kab laug sab uas tuaj yeem txuas hla cov kab.
  • Yog tias tus lej saib xyuas tau qhia tias txoj hauj lwm wiper tau hloov pauv thaum koj khiav daim duab tab sis qhov tsis kam ua haujlwm tsis hloov pauv uas yog qhov taw qhia tias WLAT lossis SHDN tsis ua qhov txuas zoo rau lub rooj sib tsoo tawg lossis jumper wipers rau WLAT lossis SHDN tsis txuas nrog kom raug rau Arduino.
  • Nco ntsoov tias koj siv lub zog thib ob uas yog DC ntawm 10 thiab 36 volts.
  • Xyuas kom meej tias lub zog hluav taws xob 10 txog 36 volt ua haujlwm los ntawm kev ntsuas qhov ntsuas hluav taws xob nrog koj lub ntsuas.
  • Sim siv daim duab qub. Yog tias koj tau hloov pauv tej zaum koj yuav tau qhia txog qhov ua yuam kev.
  • Yog tias tsis muaj ib qho ntawm cov txheej txheem daws teeb meem tau pab sim lwm digipot nti. Vam tias koj yuav ntau thiab muab lawv muag rau tib lub sijhawm rau TSSOP pawg thawj coj sib cais yog li nws yuav tsum yog teeb meem ntawm kev sib pauv ib qho rau lwm qhov. Kuv muaj cov nti tsis zoo uas ua rau kuv ntxhov siab me ntsis thiab qhov no yog qhov kho.

Kauj Ruam 9: Sab Hauv & Cov Lus Qhia Ntxiv

Alternate Wiring Diagram
Alternate Wiring Diagram

Cov Lus Qhia Ntxiv:

Cov ntaub ntawv ntxiv tuaj yeem nrhiav tau hauv MCP41HVX1 cov ntaub ntawv.

Cov ntaub ntawv tag nrho ntawm tag nrho MCP41HVX1 lub tsev qiv ntawv muaj nyob hauv README.md cov ntaub ntawv uas yog ib feem ntawm lub tsev qiv ntawv rub tawm. Cov ntaub ntawv no tau sau rau hauv qhov cim tseg thiab tuaj yeem pom nrog kev teeb tsa kom raug hauv Github (saib hauv qab ntawm nplooj ntawv) lossis nrog tus cim cia saib / editor.

Kev sib txuas lus ntawm Arduino thiab DigiPot:

Arduino sib tham nrog DigiPot siv SPI. Tom qab lub tsev qiv ntawv xa wiper txoj haujlwm hais kom ua xws li WiperIncrement, WiperDecrement, lossis WiperSetPosition nws hu WiperGetPosition kom tau txais txoj haujlwm wiper los ntawm nti. Tus nqi xa rov qab los ntawm Wiper cov lus txib no yog txoj haujlwm ntawm lub wiper raws li lub nti pom nws thiab tuaj yeem siv los txheeb xyuas tias lub wiper tau txav mus rau qhov chaw xav tau.

Kev Ua Haujlwm Zoo Tshaj (WLAT & SHDN)

Cov kev ua haujlwm siab no tsis tau qhia hauv "Wiper Control" piv txwv. Muaj APIs muaj nyob hauv lub tsev qiv ntawv los tswj WLAT & SHDN. Kuj tseem muaj WLAT thiab SHDN piv txwv cov duab kos (hauv tib qhov chaw xws li Wiper Control sketch) nrog lub tsev qiv ntawv.

SHDN (Kaw)

SHDN yog siv los xiam lossis pab kom lub network resistor. Teeb SHDN rau kev xiam oob qhab qis thiab siab ua rau lub network resistor. Thaum lub network resistor xiam oob qhab P0A (DigiPot tus pin 13) raug txiav thiab P0B (DigiPot tus pin 11) txuas nrog P0W (DigiPot tus pin 12). Yuav muaj qhov ua haujlwm me me ntawm P0B thiab P0W yog li koj lub ntsuas yuav tsis nyeem 0 ohms.

Yog tias koj daim ntawv thov tsis tas yuav tswj hwm SHDN koj tuaj yeem xaim nws ncaj qha mus rau HIGH (saib daim duab thaiv lwm txoj kab). Koj yuav tsum tau siv tus tsim kom raug lossis hla hauv MCP41HVX1_PIN_NOT_CONFIGURED rau tus tsim kom qhia tau tias SHDN yog qhov nyuaj siv. Nws yog ib qho tseem ceeb kom nco ntsoov tias yog koj ua raws nrog cov piv txwv koj yuav tsum siv daim duab kab hluav taws xob tag nrho (saib Cov Hluav Taws Xob kauj ruam saum toj no).

WLAT (Sau Latch)

Kev tsim sab hauv yog ob qho khoom siv ntawm ib tus nti. Ib qho ntawm cov khoom siv yog SDI interface thiab sau npe los tuav tus nqi wiper. Lwm qhov tivthaiv yog resistor network nws tus kheej. WLAT txuas ob lub Cheebtsam sab hauv ua ke.

Thaum WLAT tau teeb tsa LOW txhua qhov teeb tsa wiper txoj haujlwm hais kom ua cov ntaub ntawv tau xa ncaj qha mus rau lub network resistor thiab txoj haujlwm wiper tau hloov kho tshiab.

Yog tias WLAT tau teeb tsa HIGH cov ntaub ntawv qhia chaw nyob tau dhau los ntawm SPI tau tuav hauv cov ntawv sau npe sab hauv tab sis tsis dhau mus rau lub network tiv thaiv thiab yog li ntawd txoj haujlwm wiper yuav tsis hloov tshiab. Thaum WLAT tau teeb tsa LOW tus nqi raug pauv los ntawm kev sau npe mus rau lub network resistor.

WLAT muaj txiaj ntsig yog tias koj siv ntau tus lej digipots uas koj xav tau kom ua kom sib luag. Lub tswv yim yog teeb tsa WLAT rau HIGH ntawm txhua qhov digipots thiab tom qab ntawd teeb tus wiper tus nqi ntawm txhua lub chips. Thaum tus nqi wiper tau xa mus rau txhua tus digipots WLAT tuaj yeem teeb tsa rau LOW ntawm txhua lub cuab yeej ib txhij kom lawv txhua tus txav cov wipers tib lub sijhawm.

Yog tias koj tsuas yog tswj hwm ib qho DigiPot lossis muaj ntau yam tab sis lawv tsis tas yuav tsum khaws cia ua ke koj feem ntau yuav tsis xav tau txoj haujlwm no thiab yog li tuaj yeem xaim WLAT ncaj qha rau LOW (saib cov kab hluav taws xob sib piv). Koj yuav tsum tau siv tus tsim kom raug lossis dhau MCP41HVX1_PIN_NOT_CONFIGURED rau tus tsim kom qhia tau tias WLAT nyuaj siv. Nws yog ib qho tseem ceeb kom nco ntsoov tias yog koj ua raws nrog cov piv txwv koj yuav tsum siv daim duab kab hluav taws xob tag nrho (saib Cov Hluav Taws Xob kauj ruam saum toj no).

Kauj Ruam 10: Daim Duab Txuas Hluav Taws Xob

Thaiv

Koj muaj qhov kev xaiv txuas WLAT los ntawm digpot ncaj qha rau LOW / GND es tsis txhob txuas rau tus lej digital. Yog koj ua qhov no ces koj yuav tsis muaj peev xwm tswj tau WLAT. Koj kuj tseem muaj qhov kev xaiv txuas SHDN ncaj qha rau HIGH tsis txhob siv tus lej digital. Yog koj ua qhov no koj yuav tsis tuaj yeem tswj hwm SHDN.

WLAT thiab SHDN muaj kev ywj pheej ntawm ib leeg yog li koj tuaj yeem sib zog xaim ib qho thiab txuas rau lwm tus rau tus lej digital, xaim hlau ob qho tib si, lossis txuas ob qho tib si rau cov pins digital kom lawv tuaj yeem tswj tau. Xa mus rau lwm daim duab thaiv kab ntawv rau qhov uas koj xav tau xaim xaim thiab xa rov qab mus rau daim duab thaiv kab ntawv tseem ceeb hauv qib 2 rau kev txuas rau cov pins digital tswj tau.

Cov neeg tsim khoom

Muaj peb tus tsim tawm hauv chav kawm MCP41HVX. Peb yuav tham txog ob ntawm lawv. Lawv txhua tus tau teev tseg hauv README.md cov ntaub ntawv yog li yog txaus siab rau tus tsim thib peb thov xa mus rau cov ntaub ntawv.

  • MCP41HVX1 (int nCSPin) - siv tus neeg tsim khoom no tsuas yog ob qho WLAT thiab SHDN nyuaj siv.
  • MCP41HVX1 (int nCSPin, int nSHDNPin, int nWLATPin) - Siv tus neeg tsim khoom no yog tias WLAT lossis SHDN nyuaj siv. Dhau qhov MCP41HVX1_PIN_NOT_CONFIGURED tas li yog tias tus pin muaj kab xaim lossis tus lej tus lej yog tias nws txuas nrog tus lej digital.

nCSPin yuav tsum txuas nrog tus lej digital. Nws tsis raug cai dhau MCP41HVX1_PIN_NOT_CONFIGURED rau tus tsim rau nCSPin.

Yuav Ua Li Cas Yog Kuv Tsis Siv Tus Arduino Uno?

Arduino siv SPI los sib tham rau digipot. Cov SPI pins yog cov pins tshwj xeeb ntawm Arduino board. SPI tus pin ntawm Uno yog:

  • SCK - tus pin 13 ntawm Uno txuas nrog tus pin 2 ntawm digipot
  • MOSI - tus pin 11 ntawm Uno txuas nrog tus pin 4 ntawm digipot
  • MISO - tus pin 12 ntawm Uno txuas nrog tus pin 5 ntawm digipot

Yog tias koj siv Arduino uas tsis yog Uno koj yuav xav paub seb tus pin twg yog SCK, MOSI, thiab MISO thiab txuas cov ntawd rau digipot.

Lwm tus pin uas siv hauv daim duab kos yog cov lej digital tas li yog li txhua tus lej digital yuav ua haujlwm. Koj yuav tsum tau hloov kho cov duab kos kom pom cov pins uas koj xaiv ntawm Arduino pawg thawj coj uas koj tab tom siv. Cov koob digital niaj zaus yog:

  • CS - tus pin 10 ntawm Uno txuas nrog tus pin 3 ntawm digipot (hloov tshiab CS_PIN hauv daim duab nrog tus nqi tshiab)
  • WLAT - tus pin 8 ntawm Uno txuas nrog tus pin 6 ntawm digipot (hloov kho WLAT_PIN hauv daim duab nrog tus nqi tshiab)
  • SHDN - tus pin 9 ntawm Uno txuas nrog tus pin 7 ntawm tus digipot (hloov tshiab SHDN_PIN hauv daim duab nrog tus nqi tshiab)

Pom zoo: