Cov txheej txheem:

Micro SD Card Kev Tswj Cov Ntaub Ntawv: 4 Kauj Ruam
Micro SD Card Kev Tswj Cov Ntaub Ntawv: 4 Kauj Ruam

Video: Micro SD Card Kev Tswj Cov Ntaub Ntawv: 4 Kauj Ruam

Video: Micro SD Card Kev Tswj Cov Ntaub Ntawv: 4 Kauj Ruam
Video: 20 MOMENTS YOU WOULDN'T BELIEVE IF NOT FILMED 2024, Hlis ntuj nqeg
Anonim
Kev Tswj Ntaub Ntawv Micro SD Card
Kev Tswj Ntaub Ntawv Micro SD Card
Kev Tswj Ntaub Ntawv Micro SD Card
Kev Tswj Ntaub Ntawv Micro SD Card
Kev Tswj Ntaub Ntawv Micro SD Card
Kev Tswj Ntaub Ntawv Micro SD Card

Cov txheej txheem kev tswj hwm daim npav SD hauv phau ntawv qhia no tuaj yeem siv rau hauv cov haujlwm uas xav tau cov ntaub ntawv txuas ntxiv, cov ntaub ntawv uas tau khaws cia thaum koj qhov haujlwm raug kaw thiab muaj thaum siv rov qab. Ib yam nkaus, cov ntaub ntawv tau txav mus los uas daim npav tuaj yeem tshem tawm ntawm lub adapter thiab ntsaws rau hauv koj lub khoos phis tawj, rau siv hauv koj lub computer; rau ntawm lub khoos phis tawj mus rau Arduino.

Thaum kuv xub pib siv daim npav SD daim npav, kuv hais txog qhov zoo tshaj plaws tau pib qhia, Micro SD Card Tutorial. Kuv cov lus qhia suav nrog kev xaiv txuas rau Nano thiab Mega2560 Arduino. Thiab, raws li kuv yog tus programmer, kuv tau tsim thiab sim ib qho program uas qhia txog kev ua haujlwm hauv qab no hauv ib qhov haujlwm, sim ntawm Nano thiab Mega2560 Arduino.

Kev Ua Haujlwm Zoo

Cov khoos kas tuaj yeem sau los tswj hwm, thiab nyeem, cov npe thiab cov ntaub ntawv ntawm daim npav micro SD:

  • Sau cov ntaub ntawv
  • Nyeem cov ntaub ntawv
  • Txheeb xyuas yog tias muaj cov ntawv
  • Tau txais cov ntaub ntawv xws li qhov loj me
  • Rho tawm cov ntaub ntawv
  • Tsim cov ntawv teev npe (cov ntawv tais ceev tseg)
  • Txheeb xyuas yog tias muaj cov ntawv tais ceev tseg
  • Rho tawm cov ntawv tais ceev tseg

Qauv Siv

Koj tuaj yeem siv daim npav SD daim npav los khaws cov npe ntawm cov ntaub ntawv xws li sau cov txiaj ntsig sib sau ua ke ib ntus. Kuv siv lub khoos phis tawj los khaws cov haujlwm ntawm kuv lub Altair 8800 emulator computer, kom thauj khoom thiab khiav (saib daim duab saum toj no). Daim npav SD ua haujlwm zoo li lub computer emulator's SSD/hard drive.

Yuav tsum muaj

Cov lus qhia no xav kom koj muaj Arduino IDE teeb tsa. Koj kuj tseem yuav tsum muaj cov txuj ci yooj yim los rub tawm Arduino qhov kev kos duab los ntawm cov kab ntawv txuas hauv qhov haujlwm no, tsim cov npe rau cov haujlwm (npe npe, zoo ib yam li lub npe program). Thaum rub tawm, cov kauj ruam tom ntej yog thauj cov program rau hauv IDE, saib nws, thiab kho nws. Tom qab ntawd, rub qhov program los ntawm USB cable rau koj pawg Arduino.

Khoom siv

  • Arduino ATmega2560 (Mega), Uno, lossis Nano ATmega328P microcontroller board nrog USB cable txuas rau koj lub computer.
  • Micro SD daim npav adapter
  • Breadboard cov xov hlau lossis cov xaim hluav taws xob (txiv neej rau poj niam)

Kuv yuav cov khoom ntawm eBay, feem ntau los ntawm Hong Kong lossis Tuam Tshoj tus xa khoom. Cov neeg xa khoom hauv Asmeskas tuaj yeem muaj qhov zoo ib yam lossis zoo ib yam rau tus nqi tsim nyog thiab xa khoom sai dua. Cov khoom hauv Suav teb siv sijhawm li 3 txog 6 lub lis piam kom xa tuaj. Cov neeg xa khoom kuv tau siv tau txhua tus ntseeg tau.

Tus nqi kwv yees: $ 15 rau Mega, $ 3 rau Nano, micro SD daim npav adapter rau $ 1.

Kauj Ruam 1: Ntsuas Arduino Nano lossis Mega

Image
Image
Ntsuas Arduino Nano lossis Mega
Ntsuas Arduino Nano lossis Mega
Ntsuas Arduino Nano lossis Mega
Ntsuas Arduino Nano lossis Mega
Ntsuas Arduino Nano lossis Mega
Ntsuas Arduino Nano lossis Mega

Yog tias koj siv Arduino Nano, ntsaws nws rau hauv Breadboard. Txuas lub zog thiab av los ntawm Arduino mus rau lub khob cij lub zog bar. Txuas Arduino 5V+ tus pin rau lub khob cij qhov zoo bar. Txuas Arduino GND (hauv av) tus pin rau lub khob cij qhov tsis zoo (hauv av) bar. Lub hwj huam bar tuaj yeem siv los ua lub zog rau SD adapter. Yog tias koj siv Arduino Mega lossis Uno, siv lub khob cij yog xaiv tau vim tias koj tuaj yeem xaim lub adapter ncaj qha rau Arduino.

Rub tawm thiab ua haujlwm qhov kev xeem Arduino yooj yim: arduinoTest.ino. Thaum tab tom ua haujlwm, lub teeb LED onboard yuav qhib rau 1 thib ob, tua rau 1 vib nas this, thiab txuas ntxiv mus. Tsis tas li, cov lus tau tshaj tawm uas tuaj yeem pom hauv Arduino IDE Cov Cuab Yeej/Saib Xyuas Ib Leeg.

+++ Teeb tsa.

+ Pib pib ntawm lub rooj tsavxwm LED tus lej pin rau cov zis. LED tawm. ++ Mus rau lub voj. + Loop counter = 1 + Loop counter = 2 + Loop counter = 3…

Nco tseg, koj tuaj yeem siv qhov program no los ntsuas koj li Nano, Mega, lossis Uno, lawv txhua tus muaj tus lej tus lej tib yam rau ntawm lub teeb LED onboard.

Kauj Ruam 2: Txhim Kho Micro SD Card Adapter thiab Xeem

Hlau Up Micro SD Card Adapter thiab Kev Xeem
Hlau Up Micro SD Card Adapter thiab Kev Xeem
Hlau Up Micro SD Card Adapter thiab Kev Xeem
Hlau Up Micro SD Card Adapter thiab Kev Xeem
Hlau Up Micro SD Card Adapter thiab Xeem
Hlau Up Micro SD Card Adapter thiab Xeem
Hlau Up Micro SD Card Adapter thiab Kev Xeem
Hlau Up Micro SD Card Adapter thiab Kev Xeem

Hlau txuas lub micro SD daim npav adapter los tswj cov ntaub ntawv rau khaws cov ntaub ntawv tsis tu ncua. Yog tias koj tab tom siv Nano, koj tuaj yeem siv cov xov hluav taws xob txuas rau lub adapter rau ntawm lub khob cij raws li hauv daim duab saum toj no. Lossis, koj tuaj yeem ntsaws lub adapter rau hauv lub khob cij thiab siv xov hlau txuas Nano pins 10 txog 13 rau tus pin txuas raws li tau hais hauv qab no. Yog tias siv Mega, ntsaws tus txiv neej sab ntawm cov xov hlau rau hauv Mega pins (tus pin 50 txog 53) thiab tus poj niam sab ntawm cov xov hlau mus rau lub adapter (zoo li hauv daim duab saum toj no).

Kuj txuas lub zog los ntawm Arduino mus rau lub adapter.

Mega Nano lossis Uno - SPI module pins

Pin 53 10 - CS: chip/qhev xaiv tus pin Pin 13 13 - SCK: lub moos txuas Pin 51 11 - MOSI: tus tswv tawm qhev hauv Pin 50 12 - MISO: tus tswv hauv qhev Tawm Pin 5V+ 5V+ - VCC: tuaj yeem siv 3.3V lossis 5V Pin GND GND - GND: hauv av

Pin piav qhia kev ua haujlwm,

  • CS: nti/qhev xaiv tus pin. Yuav yog ib tus lej digital los pab/lov tes taw cov cuab yeej no ntawm SPI npav.
  • SCK: lub moos txuas, SPI: lees paub lub moos mem tes uas sib txuas cov ntaub ntawv xa tawm los ntawm Arduino.
  • MOSI: tus tswv tawm (Arduino), qhev hauv, SPI: nkag mus rau Micro SD Card Module.
  • MISO: tus tswv hauv (Arduino in), qhev tawm (SD apapter tawm), SPI: tso tawm los ntawm Micro SD Card Module.

Hauv Arduino IDE, teeb tsa lub tsev qiv ntawv SD, yog tias nws tseem tsis tau teeb tsa. Xaiv Cov Cuab Yeej/Tswj Tsev Qiv. Lim koj qhov kev tshawb fawb los ntawm kev ntaus hauv 'SPI' lossis 'SD'. Kuv muaj lub tsev qiv ntawv SD los ntawm Arduino, SparkFun version 1.2.3, tau teeb tsa. Yog tias koj tsis ua, teeb tsa qhov hloov tshiab tsis ntev los no. Nco tseg, tus pin txuas tau tshaj tawm hauv SPI lub tsev qiv ntawv rau SCK, MOSI, MISO, thiab CS.

SPI Master/Slave sau ntawv nrog kev sib raug zoo rau SD adapter CS tus pin thiab SD tsev qiv ntawv:

  • Ardunio tus pin, uas txuas rau SD adapter CS tus pin, hu ua tus qhev xaiv (SS) tus pin. Lub tsev qiv ntawv SD siv tus pin 10, tus pin 53 ntawm Mega, raws li lub hauv paus SS tus pin. Qhov tsev qiv ntawv tsuas yog txhawb nqa Arduino li tus tswv xwb.
  • Koj tuaj yeem siv ib qho Arduino tus lej digital, txhawm rau txuas rau SD daim npav adapter xaiv tus pin (CS). Yog tias koj siv tus pin tsis yog tus lej SS qub, ua tus pin ntawd ua tus pin los ntawm kev ntxiv: pinMode (otherPin, OUTPUT);. Thiab teeb tus pin kom qis
  • Thaum Arduino tus qhev xaiv (SS) tus pin tau teeb tsa qis, SD adapter yuav sib tham nrog Arduino. Arduino yog tus tswv, thiab SD adapter yog tus qhev.
  • Thaum nws tau teeb tsa siab, SD adapter tsis quav ntsej Arduino (tus tswv).
  • Kev xaiv tau tso cai rau koj kom muaj ntau yam khoom siv SPI sib koom ua ke tib txoj kab tsheb npav Ardunio (pins): MISO, MOSI, thiab CLK.

Rub tawm thiab ua haujlwm qhov kev xeem yooj yim: sdCardTest.ino. Qhov haujlwm no tau sim ua tiav nrog Mega thiab Nano.

Cov Ntaub Ntawv thiab Cov Ntawv Teev Npe Cov Lus Qhia

Kev pib ua: suav nrog cov tsev qiv ntawv, tshaj tawm Arduino SS tus pin uas txuas nrog rau tus pin CS tus pin, tshaj tawm cov ntaub ntawv khoom, thiab pib ua Arduino txuas nrog rau lub adapter.

#suav nrog

#include const int csPin = 10; // Rau Mega, tus pin 53. Ua ntaub ntawv myFile; Cov ntaub ntawv hauv paus; SD.begin (csPin)

Cov ntaub ntawv muaj nuj nqi: txheeb xyuas yog tias muaj cov ntawv, qhib rau sau thiab sau, luam qhib lub npe lub npe thiab qhov loj me, qhib cov ntawv rau nyeem, nyeem kom txog thaum kawg ntawm cov ntawv thiab kaw cov ntawv, amd rho tawm cov ntawv.

yog (SD.exists ("F1. TXT")) {…}

myFile = SD.open ("F1. TXT", FILE_WRITE); myFile.println (F ("Nyob zoo,")); Serial.print (entry.name ()); Serial.print (entry.size (), DEC); myFile = SD.open ("F1. TXT"); thaum (myFile.available ()) {Serial.write (myFile.read ()); } myFile.close (); SD.remove ("F1. TXT");

Cov haujlwm muaj npe: qhib cov npe rau npe/ua haujlwm, qhib cov ntaub ntawv tom ntej hauv cov npe (tuaj yeem siv los teev cov ntaub ntawv hauv cov npe), rov qab (cov ntawv tus cursor) mus rau thawj cov ntawv hauv phau ntawv teev npe, tsim cov npe, xyuas seb puas muaj cov npe muaj, thiab rho tawm cov npe.

hauv paus = SD.open ("/"); Cov ntaub ntawv nkag = dir.openNextFile (); hauv paus.rewindDirectory (); SD.mkdir ("/TESTDIR"); yog (SD.exists ("/TESTDIR")) {…} SD.rmdir (aDirName);

Siv txuas:

SPI siv: https://www.arduino.cc/en/Reference/SPISD daim ntawv qiv tsev qiv ntawv siv:

Kauj Ruam 3: SD Daim Ntawv Cim Cim

Koj daim npav xav tau rau MS DOS rog hom. Ntawm Mac, siv lub tshuab hluav taws xob los ua daim disk: Cov Ntawv Thov> Cov Khoom Siv> qhib Disk Utility.

Nyob ntawm koj daim npav, kuv siv ib qho ntawm cov hauv qab no.

Nyem rau ntawm daim npav SD, piv txwv: APPLE SD Card Reader Media/MUSICSD.

Nyem cov ntawv qhia zaub mov, Lwv. Teeb lub npe, piv txwv: MUSICSD. Xaiv: MS-DOS (Rog). Nyem lwv. Lub disk raug ntxuav thiab tsim tawm.

Los yog, Xaiv: APPLE SD Card Reader Media nyob rau sab laug xaiv.

+ Nyem Lwv rau ntawm qhov kev xaiv sab saum toj. + Hauv qhov tshwm sim, teeb tsa qhov tseem ceeb, ++ Lub Npe: Micro32gig ++ Hom Ntawv: MS-DOS (FAT) ++ Scheme: Master Boot Record + Nyem Lwv hauv qhov popup. Daim npav yuav raug teeb tsa rau siv hauv daim npav SD daim npav.

Kauj Ruam 4: Siv SD Card Adapter hauv Cov Haujlwm

Image
Image
Siv SD Card Adapter hauv Cov Haujlwm
Siv SD Card Adapter hauv Cov Haujlwm

Kuv siv lub adapter hauv kuv Altair 8800 emulator ntsiav tshuaj thiab duab qauv. Cov vis dis aus qhia tus adapter siv los thauj cov program game rau hauv lub ntsiav tshuaj lub cim xeeb kom khiav. Hauv cov duab, SD daim npav adapter txuas nrog rau Altair desktop qauv Mega. Lwm daim duab yog Altair lub desktop pem hauv ntej vaj huam sib luag nrog LED teeb thiab toggles.

Daim npav SD daim npav yog qhov muaj txiaj ntsig, thiab ncaj nraim rau ntxiv rau ib qhov haujlwm, txawm hais tias txoj haujlwm yog qhov yooj yim lossis zoo ib yam li lub computer emulator.

Txaus siab rau Arduinoing.

Pom zoo: