Cov txheej txheem:

Siv PCF8574 Backpacks Nrog LCDs thiab Arduino: 8 Kauj Ruam
Siv PCF8574 Backpacks Nrog LCDs thiab Arduino: 8 Kauj Ruam

Video: Siv PCF8574 Backpacks Nrog LCDs thiab Arduino: 8 Kauj Ruam

Video: Siv PCF8574 Backpacks Nrog LCDs thiab Arduino: 8 Kauj Ruam
Video: Siv HD - JUKE CITY (欺詐師合輯) 2024, Hlis ntuj nqeg
Anonim
Siv PCF8574 Backpacks Nrog LCDs thiab Arduino
Siv PCF8574 Backpacks Nrog LCDs thiab Arduino

Siv LCD cov qauv nrog koj Arduino yog qhov nrov, txawm li cas los xij cov xov hluav taws xob xav tau sijhawm thiab ua siab ntev los xaim nws kom raug - thiab tseem siv ntau cov lej tso tawm digital.

Tias yog vim li cas peb thiaj nyiam cov txheej txheem hnab ev khoom no - lawv haum rau sab nraum qab ntawm koj lub LCD module thiab tso cai txuas rau koj Arduino (lossis lwm lub rooj tsav xwm kev txhim kho) nrog tsuas yog plaub lub xov tooj - lub zog, GND, cov ntaub ntawv thiab moos. Koj tuaj yeem siv qhov no nrog LCD cov qauv uas muaj HD44780-sib cuam tshuam nrog ntau qhov screen loj.

Lub hnab ev ntawv kuj tseem siv tau nrog 20 x 4 LCDs. Qhov tseem ceeb yog tias koj lub LCD yuav tsum muaj cov khoom sib cuam tshuam hauv ib kab ntawm kaum rau, yog li nws sib phim cov koob ntawm lub hnab ev ntawv raws li qhia hauv daim duab rau cov kauj ruam no.

Kauj Ruam 1: Teeb Kho Vajtse

Kho vajtse teeb
Kho vajtse teeb

Tam sim no cia pib. Ua ntej koj yuav tsum tau muab lub hnab ntim rau hauv koj lub LCD module. Thaum koj cov hlau txuas ua kom sov dua, xyuas tias lub hnab ev ntawv pins ncaj thiab haum rau hauv LCD module, piv txwv li:

Kauj ruam 2:

Duab
Duab

Tom qab ntawd muab tshuaj txhuam rau hauv tus pin thawj, thaum khaws lub hnab ev ntawv nrog lub LCD:

Kauj ruam 3:

Duab
Duab

Yog tias nws me ntsis nkhaus, koj tuaj yeem rov ua kom sov dua thiab rov ua dua. Thaum koj txaus siab nrog kev sib koom ua ke, muab tshuaj txhuam rau ntawm tus pin:

Kauj ruam 4:

Duab
Duab

Tam sim no txhawm rau khaws cov khoom kom huv, txiav tawm cov header pins tshaj:

Kauj ruam 5:

Duab
Duab

Thaum koj tau ua tiav kev txiav cov kab taub hau, tau txais plaub tus txiv neej rau poj niam jumper xov hlau thiab txuas lub LCD module rau koj Arduino raws li qhia hauv cov duab hauv qab no thiab cov lus. Tom qab ntawd txuas koj Arduino rau lub khoos phis tawj ntawm USB

Kauj Ruam 6: Teeb Software thiab Siv…

Kev teeb tsa software thiab siv…
Kev teeb tsa software thiab siv…

Cov kauj ruam tom ntej yog rub tawm thiab teeb tsa Arduino I2C LCD tsev qiv ntawv rau siv nrog lub hnab ev ntawv. Ua ntej tshaj plaws, hloov npe "LiquidCrystal" lub tsev qiv ntawv tais ceev tseg hauv koj lub tsev qiv ntawv Arduino. Peb ua qhov no tsuas yog khaws nws ua cov thaub qab.

Yog tias koj tsis paub meej qhov twg tuaj yeem pom koj lub tsev qiv ntawv ntawv nplaub tshev - feem ntau yog hauv koj phau ntawv teev npe, uas nws qhov chaw nyob feem ntau tuaj yeem pom hauv Arduino IDE nyiam cov ntawv qhia zaub mov.

Tom ntej no, mus ntsib https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads thiab rub tawm cov ntawv tshiab, tam sim no peb tab tom siv v1.2.1. Nthuav rub tawm.zip cov ntaub ntawv yuav nthuav tawm qhov tshiab "LiquidCrystal" nplaub tshev - luam qhov no rau hauv koj phau ntawv Arduino cov tsev qiv ntawv.

Tam sim no rov pib dua Arduino IDE yog tias nws twb tau ua haujlwm lawm - lossis qhib nws tam sim no. Txhawm rau sim tus qauv peb muaj daim qauv qhia ua piv txwv npaj, tsuas yog luam thiab xa cov duab kos hauv qab no:

/ * Daim duab qhia ua piv txwv rau PCF8574T I2C LCD Backpack Siv lub tsev qiv ntawv los ntawm https://bitbucket.org/fmalpartida/new-liquidcryst… GNU Daim Ntawv Tso Cai Pej Xeem, version 3 (GPL-3.0) */ #suav nrog "Wire.h"

#suav nrog "LCD.h"

#suav nrog "LiquidCrystal_I2C.h"

LiquidCrystal_I2C lcd (0x27, 2, 1, 0, 4, 5, 6, 7); // 0x27 yog I2C chaw nyob tsheb npav rau lub hnab ntim khoom uas tsis tau hloov kho

void teeb tsa ()

{// qhib LCD module lcd.begin (16, 2); // rau 16 x 2 LCD module lcd.setBacklightPin (3, POSITIVE); lcd.setBacklight (HIGH); }

void lub voj ()

{lcd.home (); // teeb tus cursor rau 0, 0 lcd.print ("tronixlabs.com"); lcd.setCursor (0, 1); // mus pib ntawm kab thib 2 lcd.print (millis ()); ncua (1000); lcd.setBacklight (QIB); // Backlight tawm ncua (250); lcd.setBacklight (HIGH); // Backlight ntawm ncua (1000); }

Tom qab ob peb lub sijhawm LCD yuav pib ua haujlwm thiab pib tso tawm peb qhov URL thiab tus nqi rau millis, tom qab ntsais qhov teeb pom kev tawm thiab qhib. Yog tias cov ntawv tsis meej, lossis koj tsuas yog pom cov thaiv dawb - sim kho qhov sib piv siv lub hwj chim loj nyob tom qab ntawm tus qauv.

Kauj Ruam 7: Yuav Tswj Li Cas Lub Hnab Hnab Hauv Koj Daim Duab …

Raws li kev tawm tsam siv lub LCD module yam tsis muaj lub hnab ntim khoom, muaj ob peb kab ntxiv ntawm cov cai kom suav nrog hauv koj cov duab kos. Txhawm rau tshuaj xyuas cov no, qhib qhov piv txwv piv txwv uas tau hais ua ntej.

Koj yuav xav tau cov tsev qiv ntawv raws li qhia hauv kab 3, 4 thiab 5 - thiab pib ua tus qauv raws li qhia hauv kab 7. Nco ntsoov tias qhov chaw nyob hauv I2C npav tsis yog 0x27 - thiab thawj qhov ntsuas hauv LiquidCrystal_I2C ua haujlwm.

Thaum kawg peb kab siv hauv qhov tsis muaj teeb tsa () kuj tseem yuav tsum tau pib ua LCD. Yog tias koj siv 20x4 LCD module, hloov qhov tsis nyob hauv lcd.begin () muaj nuj nqi. Los ntawm qhov no koj tuaj yeem siv txhua tus txheej txheem LiquidCrystal ua haujlwm xws li lcd.setCursor () txav tus cursor thiab lcd.write () los tso saib cov ntawv lossis hloov pauv li qub.

Lub teeb nrig kuj tseem tuaj yeem qhib thiab kaw nrog lcd.setBacklight (HIGH) lossis lcd.setBacklight (LOW). Koj tuaj yeem tua lub teeb nrig mus tas li los ntawm kev tshem lub cev jumper nyob tom qab ntawm tus qauv.

Kauj Ruam 8: Hloov Chaw Nyob I2C Bus

Hloov Chaw Nyob I2C Bus
Hloov Chaw Nyob I2C Bus

Yog tias koj xav siv ntau dua ib tus qauv, lossis muaj lwm lub cuab yeej ntawm I2C npav nrog chaw nyob 0x27 ces koj yuav tsum hloov chaw nyob uas siv ntawm tus qauv. Muaj yim txoj kev xaiv los ntawm, thiab cov no raug xaiv los ntawm kev siv ntau dua ib lossis ntau qhov ntawm cov hauv qab no.

Muaj yim qhov ua tau ua ke, thiab cov no tau piav qhia hauv Table 4 ntawm PCF8574 cov ntaub ntawv uas tuaj yeem rub tawm los ntawm TI lub vev xaib. Yog tias koj tsis paub meej txog qhov chaw nyob npav siv los ntawm tus qauv, tsuas yog txuas nws rau koj Arduino raws li tau piav ua ntej thiab khiav I2C scanner sketch los ntawm Arduino chaw ua si.

Txwv tsis pub peb vam tias koj nyiam nyeem phau ntawv qhia no thiab tuaj yeem siv nws. Yog tias koj muaj lus nug txog cov ntsiab lus hauv qhov kev qhia no, thov nug ntawm no lossis email [email protected]. Thiab thov mus ntsib PMD Way Limited.

Pom zoo: