Cov txheej txheem:

LCD COG rau Arduino Nano: 3 Kauj Ruam
LCD COG rau Arduino Nano: 3 Kauj Ruam

Video: LCD COG rau Arduino Nano: 3 Kauj Ruam

Video: LCD COG rau Arduino Nano: 3 Kauj Ruam
Video: Afisaj inteligent SVTC035WT (conectare cu Arduino) - 2 2024, Kaum ib hlis
Anonim
LCD COG rau Arduino Nano
LCD COG rau Arduino Nano

Cov lus qhia no piav qhia yuav siv COG LCD nrog Arduino Nano li cas.

COG LCD cov lus yog pheej yig tab sis nyuaj me ntsis rau cuam tshuam. (COG sawv rau "Chip On Glass".) Qhov kuv tab tom siv muaj UC1701 tus tsav tsheb nti. Nws xav tau tsuas yog 4 tus pin ntawm Arduino: SPI-moos, SPI-cov ntaub ntawv, nti xaiv thiab hais kom ua/cov ntaub ntawv.

UC1701 yog tswj los ntawm SPI npav thiab khiav ntawm 3.3V.

Nov kuv piav qhia yuav siv nws li cas nrog Arduino Nano. Nws tseem yuav tsum ua haujlwm nrog Arduino Mini lossis Uno - Kuv yuav sim sai sai no.

Nov yog kuv thawj qhov haujlwm Arduino thiab kuv tsis tau sau C ntau caum xyoo yog li yog tias kuv ua yuam kev pom tseeb, thov qhia rau kuv paub.

Kauj Ruam 1: Tsim Kho Vajtse

Tsim Kho Vajtse
Tsim Kho Vajtse
Tsim Kho Vajtse
Tsim Kho Vajtse
Tsim Kho Vajtse
Tsim Kho Vajtse

Yuav ib lub COG LCD uas muaj UC1701 nti. Nws yuav tsum tau siv lub npav SPI ntau dua li qhov sib txuas ua ke. Nws yuav muaj nyob ib ncig ntawm 14 tus lej uas yuav sau nrog cov npe zoo li cov npe hauv qab no. (Koj tsis xav tau kev sib txuas nrog nrog ntau ntau tus lej cim npe D0, D1, D2 …)

Qhov kuv yuav yog: https://www.ebay.co.uk/itm/132138390168 Los yog koj tuaj yeem tshawb nrhiav eBay rau "12864 LCD COG".

Xaiv ib qho uas muaj tus Tsov tus Tsov tus dav dav nrog cov pins sib nrug ntawm 1.27mm - cov pins zoo dua yuav nyuaj rau yaj. Xyuas kom nws muaj UC1701 nti. Pom zoo li cas hauv daim duab thib rau ntawm nplooj ntawv ebay, nws hais tias "CONNECTOR: COG/UC1701".

Cov zaub yog pob tshab thiab nws nyuaj rau paub uas yog pem hauv ntej thiab tom qab. Kawm kuv cov duab kom zoo. Daim ntawv ceeb toom qhov twg pins 1 thiab 14 yog - lawv tau cim rau ntawm tus Tsov tus tw.

Tus Tsov tus tw hloov pauv tau yooj yim heev rau cov kab laug sab tab sis nws xav tau tus adapter yog li koj tuaj yeem ntsaws nws rau hauv lub khob cij. Kuv yuav: https://www.ebay.co.uk/itm/132166865767 Los yog koj tuaj yeem tshawb nrhiav eBay rau "Adapter Smd SSOP28 DIP28".

Tus adapter siv 28-pin SOP nti ntawm ib sab lossis 28-pin SSOP nti ntawm lwm sab. Ib qho SOP nti muaj tus pin sib nrug ntawm 0.05 (1.27mm) uas zoo ib yam li tus Tsov tus tw ntawm LCD.

Koj tseem yuav xav tau qee tus pin header. Thaum twg los xij kuv yuav Arduino lossis lwm yam qauv, nws los nrog ntau lub taub hau ntau tshaj qhov xav tau yog li koj yuav twb muaj qee qhov lawm. Txwv tsis pub, tshawb nrhiav eBay rau "2.54mm header pins".

Solder 14 ntawm tus pin header mus rau lub adapter. Tsis txhob thawb lawv txhua txoj hauv kev - nws zoo dua yog tias sab nraub qaum ntawm lub adapter tiaj tus. Muab nws tso rau ntawm koj lub rooj ntev zaum kom cov pins tsis tuaj yeem raug thawb mus rau hauv qhov. Nco ntsoov tias cov pins nyob ntawm SOP sab ntawm lub rooj tsavxwm (piv txwv li lub nti loj dua).

Cov ntaub qhwv ntawm tus Tsov tus tw yog nyob ntawm qhov rai. Tin ob sab ntawm lawv nrog cov laug. Nyem cov ntaub qhwv ntawm lub adapter. Tuav tus Tsov tus tw rau ntawm qhov chaw ces kov txhua lub ncoo nrog cov hlau txuas (koj yuav xav tau cov lus qhia ncaj ncees).

Tie ib co xov los ntawm lub qhov nyob rau hauv lub adapter kom ua raws li nyem nyem. (Kuv siv "transformer wire").

Yog tias koj muab nws tso rau ntawm txoj kev tsis raug puag ncig, tsis txhob sim muab tus tw muag muag. Nqa cov pins tawm ib zaug thiab txav lawv mus rau lwm sab ntawm pawg thawj coj saib. (Yog, Kuv tau ua qhov yuam kev ntawd thiab rov muab tus tw rov qab uas yog vim li cas nws thiaj li tsis meej pem hauv daim duab.)

Kauj ruam 2: Txuas mus rau Arduino

Txuas mus rau Arduino
Txuas mus rau Arduino
Txuas mus rau Arduino
Txuas mus rau Arduino

Nqe lus no piav qhia yuav ua li cas txuas rau Arduino Nano. Nws yuav zoo ib yam rau Mini lossis Uno tab sis kuv tseem tsis tau sim nws.

Kawm daim duab qhia chaw.

Ib qho Arduino Nano uas txuas nrog USB chaw nres nkoj khiav ntawm 5V. LCD ua haujlwm ntawm 3.3V. Yog li koj yuav tsum tau siv lub LCD los ntawm 3V3 tus pin ntawm Nano thiab kom txo qhov hluav taws xob ntawm txhua tus pin tswj los ntawm 5V txog 3.3V.

Lub pinout ntawm LCD yog:

  • 1 CSJ
  • 2 TSI
  • 3cd ua
  • 4
  • 5 CLK ib
  • 6 SDAB
  • 7 3vv 3
  • 80v wb
  • 9 VB0+
  • 10 VB0-
  • 11
  • 12
  • 13
  • 14

CS yog Chip-Select. Nws tau rub qis los xaiv (pab kom) UC1701 nti. (CS yuav raug hu ua CS0 lossis En lossis zoo sib xws.)

RST tau rov pib dua. Nws tau rub qis kom rov pib dua lub nti. (RST yuav raug hu ua Pib dua.)

CD yog hais kom ua/cov ntaub ntawv. Nws tau rub qis thaum xa cov lus txib rau lub nti hla SPI. Nws siab thaum xa cov ntaub ntawv. (CD yuav raug hu ua A0.)

CLK thiab SDA yog SPI npav npav. (SDA yuav raug hu ua SPI-Data. CLK yuav yog SCL lossis SPI-Clock.)

VB0+ thiab VB0- tau siv los ntawm lub twj tso kua mis sab hauv ntawm UC1701. Lub twj tso kua mis ua kom muaj qhov tsis txaus xav tau los ntawm LCD. Txuas lub 100n capacitor ntawm VB0+ thiab VB0-. Cov ntaub ntawv UC1701 pom zoo 2uF tab sis kuv tsis tuaj yeem pom qhov sib txawv nrog qhov tshwj xeeb LCD no.

Yog tias koj lub LCD muaj VB1+ thiab VB1-pins, tseem txuas rau 100n lub peev xwm nruab nrab ntawm lawv. (Yog tias koj lub LCD muaj tus pin VLCD, koj tuaj yeem sim txuas lub 100n capacitor nruab nrab ntawm VLCD thiab Gnd. Nws tsis txawv nrog kuv lub LCD.)

Txuas lub LCD rau Nano raws li hauv qab no:

  • 1 TZS = D10 *
  • 2 TZS = 6 ST
  • 3 CD = D7 * Cov
  • 5 CLK = 133.5 TZS
  • 6 SDA = D11 * TZS
  • 7 3V3 = 3V3
  • 80 V = VND

("*" txhais tau tias siv lub peev xwm faib ua ke kom txo qhov hluav taws xob. Yog tias Arduino khiav ntawm 3V3 los ntawm cov khoom siv ywj pheej, koj yuav tsis xav tau cov tiv thaiv.)

3.3V yog tso tawm los ntawm Nano thiab tuaj yeem muab tam sim no txaus rau LCD. (Cov duab kos ib ncig 250uA.)

5V kuj tseem tso tawm los ntawm Nano thiab tuaj yeem siv los txhawb lub teeb pom kev zoo. Txwv qhov tam sim no rau lub teeb pom kev zoo nrog 100ohm resistor.

Yog tias koj tab tom khiav luv ntawm tus pin ntawm Nano, koj tuaj yeem txuas RST rau 3V3 - tom qab ntawd koj tuaj yeem siv D6 rau lwm yam. U1701 tuaj yeem rov pib dua hauv software los ntawm kev hais kom ua ntawm SPI. Kuv tsis tau muaj teeb meem nrog qhov ntawd tab sis yog tias koj tab tom siv koj tus kheej Circuit hauv qhov chaw muaj suab nrov, nws yuav zoo dua los siv kho vajtse dua.

Kauj ruam 3: Software

Software
Software

Hauv kev xav, koj tuaj yeem tsav UC1701 los ntawm U8g2 lub tsev qiv ntawv (lossis Ucglib lossis lwm lub tsev qiv ntawv muaj). Kuv tawm tsam rau hnub kom nws mus ua haujlwm thiab ua tsis tiav. Lub tsev qiv ntawv U8g2 yog dab vim nws tuaj yeem tsav ntau yam chips thiab nws nyuaj rau ua raws txoj cai. Yog li kuv tso tseg thiab sau kuv tus kheej lub tsev qiv ntawv me. Nws siv sijhawm tsawg dua qhov chaw hauv Arduino (kwv yees li 3400 bytes ntxiv rau fonts).

Koj tuaj yeem rub kuv lub tsev qiv ntawv los ntawm no (Rub lub pob ntawm nplooj ntawv no). Ib qho piv txwv kos duab thiab phau ntawv qhia siv. Lub vev xaib https://www.arduino.cc/en/Guide/Libraries piav qhia yuav ua li cas ntshuam lub tsev qiv ntawv; mus rau ntu "Ntshuam ib lub.zip Library".

Initialise LCD nrog

UC1701Begin ();

UC1701Begin tuaj yeem siv qhov ntsuas los hloov tus pin lossis tsis quav ntsej RST tus pin. Lub tsev qiv ntawv tsuas yog siv kho vajtse SPI (tsis muaj software SPI). Cov zaub tuaj yeem tig rau hauv x thiab y axes. Qhov ntawd muaj txiaj ntsig yog tias koj xav kom teeb lub LCD hauv qhov sib txawv.

Ob peb txheej txheem tau theej los ntawm U8g2 lub tsev qiv ntawv:

  • DrawLine
  • DrawPixel
  • DrawHLine
  • DrawVLine
  • DrawBox
  • DrawFrame
  • DrawCircle
  • DrawDisc
  • DrawFilledEllipse
  • DrawEllipse
  • DrawTriangle
  • UC1701SetCursor
  • UC1701ClearDisplay

Qee cov txheej txheem sib txawv me ntsis:

  • tsis muaj dabtsis DrawChar (uint8_t c, lo lus Font);
  • tsis muaj dabtsis DrawString (char * s, lo lus Font);
  • tsis muaj dabtsis DrawInt (int i, word Font);

Cov txheej txheem teeb duab tau dhau qhov ntsuas ntawm Font. Cov ntawv tau tshaj tawm hauv lub cim xeeb nco ntawm Arduino yog li lawv tsis nyob hauv SRAM muaj nuj nqis. Peb muab fonts (me, nruab nrab thiab loj). Lawv tsuas yog txuas rau hauv thiab nyob hauv flash nco yog tias koj siv lawv (kwv yees li 500 txog 2000 bytes txhua).

"Xim" tau ua haujlwm txawv ntawm lub tsev qiv ntawv U8g2. Thaum lub LCD raug tshem tawm nws muaj qhov tsaus ntuj. Yog MakeMark (hloov pauv thoob ntiaj teb) muaj tseeb, kev kos duab yog ua tiav dawb. Yog MakeMark tsis raug, teeb duab ua tiav hauv qhov tsaus ntuj.

Qee cov txheej txheem tshwj xeeb rau UC1701:

SetInverted kos xim dub-rau-dawb ntau dua li dawb-rau-dub.

tsis muaj dab tsi SetInverted (bool inv);

Qhov ci thiab sib piv ntawm UC1701 tau teeb tsa los ntawm:

  • tsis muaj dab tsi SetContrast (uint8_t tus nqi); // pom zoo yog 14
  • tsis muaj dab tsi SetResistor (uint8_t tus nqi); // pom zoo yog 7

Lawv ua haujlwm ua ke hauv txoj kev tsis txaus siab.

SetEnabled hwj chim hauv LCD:

tsis muaj dab tsi SetEnabled (bool en);

Cov zaub siv 4uA thaum pw tsaug zog. Koj kuj yuav tsum tua lub teeb nraub qaum - tsav nws los ntawm tus pin ntawm Nano. Tom qab rov qhib dua, UC1701 yuav tau rov pib dua; cov zaub raug tshem tawm thiab qhov sib piv thiab Resistor yuav tau rov pib dua rau lawv qhov txiaj ntsig qub.

Yog li, qhov xaus, COG cov lus qhia yog pheej yig thiab tsim nyog me me. Lawv yooj yim txuas rau Arduino.

Pom zoo: