Cov txheej txheem:

Thoob Ntiaj Teb Microcontroller Txuas rau Hauv $ 20: 15 Cov Kauj Ruam
Thoob Ntiaj Teb Microcontroller Txuas rau Hauv $ 20: 15 Cov Kauj Ruam

Video: Thoob Ntiaj Teb Microcontroller Txuas rau Hauv $ 20: 15 Cov Kauj Ruam

Video: Thoob Ntiaj Teb Microcontroller Txuas rau Hauv $ 20: 15 Cov Kauj Ruam
Video: Nkauj hmoob zoo nkauj thoob ntiaj teb -Vichai Cheng (Official Music Video) Nkauj Tawm Tshiab 2020 2024, Hlis ntuj nqeg
Anonim
Thoob Ntiaj Teb Microcontroller Txuas rau qis dua $ 20
Thoob Ntiaj Teb Microcontroller Txuas rau qis dua $ 20

Tswj koj lub ntsuas cua sov hauv tsev los ntawm kev ua haujlwm. Qhib lub tshuab txau dej los ntawm txhua qhov chaw hauv ntiaj teb los ntawm kev hloov qhov hloov. Cov Lus Qhia no qhia yuav ua li cas txuas ob lossis ntau dua $ 4 microcontrollers siv tus caj qaum ntawm is taws nem thiab qee qhov yooj yim VB. Net tus lej. Qhov no ua rau ntawm Kev Qhia Ua Ntej ua ntej uas qhia yuav ua li cas txuas microcontroller mus rau PC thiab siv lub lauj kaub los tswj lub servo https://www.instructables.com/id/Control-real-world-devices-with-your-PC/ Lub sijhawm no peb muaj microcontoller tham nrog VB. Net program tom qab ntawd mus rau ftp lub vev xaib, rov qab mus rau lwm VB. Net program thiab txij li lub microcontroller thib ob nyob txhua qhov chaw hauv ntiaj teb, nrog lossis tsis muaj tib neeg kev cuam tshuam. Yuav ua li cas ntxiv yog cov tshuab hauv Matrix puas yuav tsum tau ua yog tias lawv tsis tuaj yeem tham nrog ib leeg?

Kauj Ruam 1: Sau Cov Khoom

Sau Qhov Chaw
Sau Qhov Chaw

Ntau qhov ntawm qhov zoo ib yam li hauv PC Kev Tswj Qhia https://www.instructables.com/id/Control-real-world-devices-with-your-PC/ thiab nws tau qhia tias qhov no ua tiav ua ntej ua ntej txuas ob lub microcontrollers. Thaum nws muaj peev xwm siv lub lauj kaub los tswj cov servo, lub sijhawm no puag ncig peb tab tom yuav mus rau qee yam yooj yim dua - hloov pauv ntawm lub coj. Qhov hloov pauv tuaj yeem yooj yim ua lub tank qib ntsuas thiab coj tuaj yeem yog lub twj tso kua dej nyob ze tus dej tab sis cia peb tau txais qee yam yooj yim ua haujlwm ua ntej. Parts - Ob Picaxe 08M chips - muaj los ntawm ntau qhov chaw suav nrog Rev Ed https://www.rev- ed.co.uk/picaxe/ (UK), PH Anderson https://www.phanderson.com/ (USA) thiab Microzed https://www.microzed.com.au/ (Australia). Cov chips no qis dua $ 4US. Ob ntawm: Protoboard, 9V roj teeb thiab roj teeb, 10k resistor, 22k resistor, 33uF 16V capacitor, 0.1uF capacitor, 7805L qis zog 5V tus tswj hwm, xov hlau (cov xov tooj tseem ceeb xov tooj/cov xov tooj hlau piv txwv li Cat5/6), LED, 1k resistor. 1 ntawm: D9 poj niam lub qhov (socket) thiab npog thiab 2 meters ntawm 3 (lossis 4) cov ntaub ntawv tseem ceeb xaim (rau rub tawm) thiab hloov pauv. 2 lub khoos phis tawj nrog 9 tus lej txuas chaw nres nkoj (tuaj yeem debug ntawm ib lub computer tab sis) thiab kev siv internet. Rau cov khoos phis tawj uas tsis muaj chaw nres nkoj txuas, USB rau cov khoom siv txuas https://www.rev-ed.co.uk/docs/axe027.pdf thiab lub tso suab me me.

Kauj Ruam 2: Rub tawm thiab Nruab Ib Lub Software

Rub tawm thiab Nruab Ib Qho Software
Rub tawm thiab Nruab Ib Qho Software

Peb yuav xav tau VB. Net pub dawb thiab picaxe tus tswj software thiab yog tias koj tau ua tiav lub PC tswj kev qhia koj yuav twb muaj cov no. VB. Net (Visual Basic Express) muaj los ntawm https://msdn2.microsoft.com/en -us/express/aa718406.aspxQhov picaxe software muaj los ntawm https://www.rev-ed.co.uk/picaxe/Koj yuav tsum tau sau npe nrog microsoft kom tau txais qhov rub tawm -yog tias qhov no yog teeb meem siv email cuav los yog ib yam dab tsi. Kuv pom tau tias nws muaj txiaj ntsig muab kuv tus email tiag tiag thaum lawv xa cov hloov tshiab ib ntus. Kuv tseem yuav hais txog lub rooj sib tham picaxe https://www.picaxeforum.co.uk/ vim tias qhov no yog cov rooj sib tham ua haujlwm los ntawm cov kws qhia ntawv thiab kws qhia ntawv thiab qhov twg cov tub ntxhais kawm feem ntau tuaj yeem tau txais cov lus teb rau cov lus nug hauv ob peb teev. Lub rooj sab laj nkag siab heev ntawm txawm tias cov lus nug yooj yim tshaj plaws vim tias qee tus tub ntxhais kawm tseem nyob hauv qib tsev kawm ntawv theem pib. Thov tsis txhob ntshai thov kev pab!

Kauj Ruam 3: Tsim kom muaj Download Circuit

Tsim ib qho Download Circuit
Tsim ib qho Download Circuit

Qhov kev rub tawm no siv lub picaxe nti, ob peb tus tiv thaiv, tus tswj hwm thiab roj teeb 9V. Cov ntaub ntawv ntau ntxiv muaj nyob hauv picaxe cov ntaub ntawv/kev pabcuam uas tau tshwm sim hauv cov ntawv qhia zaub mov pabcuam ntawm txoj haujlwm. Lub voj voog yuav tsum tsuas yog siv ob peb feeb los tsim thaum txhua qhov khoom siv tes ua. Thaum lub nti tau programmed nws khaws nws txoj haujlwm hauv EEPROM txawm tias lub zog raug kaw. Txij li thaum peb tab tom tsim ob daim chips nws yuav tsim nyog sau cov chips yog li koj paub tias qhov twg yog qhov twg. Koj ib txwm tuaj yeem rov qab thiab rov tsim dua ib lub nti los ntawm kev tshem tawm qhov txuas thiab txav tus tiv thaiv.

Kuv kuj tseem yuav ntxiv tias picaxes ua haujlwm zoo siab ntawm 3 AA roj teeb. Kev tswj hwm 5V muaj txiaj ntsig zoo rau kev siv cov khoom siv sib piv raws li qhov siv hluav taws xob tsis hloov pauv, tab sis kom yooj yim rau/tawm cov kab hluav taws xob tsis muaj kev tswj hwm qhov xav tau. Txoj cai 5V tuaj yeem tawm hauv qhov xwm txheej no.

Kauj ruam 4: Program Chips

Program Chips
Program Chips

Peb yuav hu ib qho program Tx thiab ib Rx. Tx yog tus tswj hwm nti thiab muaj qhov hloov pauv thiab coj. Rx tseem muaj tus coj. Thaum qhov hloov pauv lub teeb liab mus los ntawm Tx mus rau Rx, hloov cov coj thiab tseem hloov qhov hloov pauv thib ob uas tom qab ntawd rov qab mus rau Tx. Yog li flick qhov hloov pauv thiab hauv tsawg dua li ib feeb cov coj hloov pauv ntawm ob qho kev qhia uas qhia tias cov lus tau mus txog ntawd thiab Rx ua haujlwm ntawm txoj haujlwm hloov tshiab. Hauv qib yooj yim tshaj plaws picaxe muaj 14 tus lej ib-byte npe. Thaum tsim lub network virtual peb txuas tag nrho cov npe ntawd ua ke yog li yog byte hloov hauv ib picaxe nws hloov pauv hauv txhua picaxes. Kom meej meej yog tias ob lub picaxes tau sim hloov tib lub byte ces nws yuav nkag siab ntau tab sis yog tias txhua picaxe tsuas yog hloov pauv ib byte ces tag nrho lwm picaxes tuaj yeem pom qhov kev hloov pauv thiab tuaj yeem ua rau nws. Cov lus yooj yim tuaj yeem xa rov qab thiab xa mus yog tias qee qhov byte tsuas yog hloov los ntawm ib lub picaxe. Lub lauj kaub tuaj yeem hloov tus nqi hauv npe thiab ib lossis ntau lwm yam picaxes tuaj yeem nkag siab tias hloov pauv thiab txav ib qho servo lossis ib qho twg thiab tig lub rhaub. Ib daim ntawv thib ob tuaj yeem xa rov qab kub hauv chav. Luam thiab muab cov phiaj xwm tig mus rau tus program program picaxe thiab rub lawv mus rau txhua tus ntawm cov ntu sib xws siv lub xub xub xiav download los ntawm hauv picaxe programmer. Tx: lub ntsiab: serin 3, N2400, ("Data"), b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13 'tau txais pob ntawv los ntawm lub computer yog pin2 = 0 ces 'ntsuas qhov hloov pauv thiab teeb tsa b0 nyob ntawm qhov xwm txheej b0 = 0 lwm qhov b0 = 1 qhov kawg yog tias b1 = 0 ces' lwm picaxe teeb tsa b1 nyob ntawm b0 qis 1 'coj tawm lwm qhov siab 1' coj ntawm endif serout 0, N2400, ("Cov ntaub ntawv", b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13) 'xa rov qab mus rau lub computer goto mainand Rx: lub ntsiab: serin 3, N2400, ("Cov ntaub ntawv"), b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13 'tau txais pob ntawv los ntawm lub computer b1 = b0' hloov npe b1 kom sib npaug rau npe b0 yog b1 = 0 ces qis 1 'coj tawm lwm qhov siab 1' coj mus rau endif serout 0, N2400, ("Cov ntaub ntawv", b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13) 'xa rov qab mus rau lub computer tau txais lub ntsiab

Kauj Ruam 5: Tsim Tx Circuit

Tsim Tx Circuit
Tsim Tx Circuit

Yog tias koj tab tom tig rov qab los ntawm kev ua haujlwm hauv Circuit Court thiab cov phiaj xwm phiaj xwm nco ntsoov hloov kev sib txuas mus rau ceg 2 thiab qhov chaw ntawm 22k resistor los ntawm ceg 2 mus rau ceg 4. Los yog koj tuaj yeem tsim qhov tshwj xeeb rub tawm Circuit thiab txav cov chips. hla. Tsuas yog nco ntsoov seb lub xov tooj hluav taws xob tab tom khiav lossis rub tawm vim nws tuaj yeem ua rau tsis meej pem. Tshwj xeeb, nco ntsoov tias kev sib tw khiav yuav tsis ua haujlwm yog tias ceg 2 sab laug ntab - nws yuav tsum tau muab tsaws. Ceg 2 yog tus rub tus pin thiab yog tias nws sab laug ntab nws khaws cov yuam kev RF los ntawm lub teeb flouro thiab lub nti xav tias lwm qhov haujlwm tau rub tawm.

Nws kuj tseem tsim nyog hais txog picaxe lub npe uas hu ua lub cev tus pin tus ceg thiab tus lej virtual tus pin. Yog li qhov tso tawm ntawm tus lej 2 hauv tus lej yog qhov ua tau zoo ntawm lub cev 5. Qhov no yuav zoo li coj txawv txawv tab sis nws txhais tau tias cov lej tuaj yeem xa mus rau picaxes loj dua li 28 thiab 40 tus lej tus lej thiab tseem ua haujlwm.

Kauj Ruam 6: Tsim Rx Circuit

Tsim Rx Circuit
Tsim Rx Circuit

Lub voj voog no yuav luag zoo ib yam li tus xa tawm - nws tsuas yog tsis muaj qhov hloov pauv.

Kauj Ruam 7: Sau Ib co VB. Net Code

Sau Ib co VB. Net Code
Sau Ib co VB. Net Code

Kuv tuaj yeem sau cov cai thiab ua qhov haujlwm no muaj raws li kev suav sau.exe tab sis kawm qee VB. Net yog qhov muaj txiaj ntsig zoo kawg uas nws tsim nyog mus los ntawm nws ib qib zuj zus. Yog tias koj tab tom khiav qhov no ntawm ob lub khoos phis tawj sib txawv koj tuaj yeem tsim qhov program rau hauv.exe uas tsim qhov teeb tsa me me uas tuaj yeem teeb tsa ntawm lub khoos phis tawj thib ob. Lossis koj tuaj yeem tso VB. Net ntawm ob lub khoos phis tawj thiab khiav cov haujlwm los ntawm hauv VB. NetLet's xav tias koj paub yuav qhib VB.net qhov haujlwm tshiab los ntawm qib 7 thiab 8 ntawm https://www.instructables.com/id/S1MMU2XF82EU2GT /Ntawm daim ntawv dawb paug peb ntxiv cov khoom hauv qab no los ntawm lub cuab yeej thiab muab tso rau ntawm daim ntawv hauv qhov chaw raws li qhia. Txog cov ntawv cim thiab cov ntawv kab ntawv, hloov cov ntawv cov khoom (dhau ntawm sab xis sab xis) rau yam uas xav tau. Tsis txhob txhawj xeeb txog qhov teeb tsa rau lub sijhawm - peb yuav hloov pauv lawv hauv txoj cai tab sis nco ntsoov muab lub sijhawm ua tim khawv. Lub thawv ntawv loj yog RichTextBox thiab peb qhov me me yog cov ntawv zoo tib yam. Raws li qhov kev txiav txim peb tab tom pib rau saum daim ntawv thiab txav mus los. Yog tias koj tso qee yam tawm yuav muaj qhov ua yuam kev hauv cov cai uas yuav tsum tau muab qee qhov clue. Please xaiv cov npe filename rau Textbox3 - qhov no yog lub npe ntawm koj pab pawg tshwj xeeb ntawm picaxes ntawm ftp server thiab pom tseeb yog tias peb txhua tus siv tib lub npe ces cov ntaub ntawv yuav tau tag nrho cov muddled! ------------------------------ NotesLabel1 ------------------ Picaxe CommunicationsLabel2 ------------------ FTP StatusLabel3 ------------------ StatusLabel4 ---------- -------- Picaxe RegistersLabel5 ------------------ Sau npe 0-13Label6 ------------------ Tus nqi 0-255Label7 ------------------ FTP txuas cov ntaub ntawv npeTextbox1 ---------------- 0 -------- -------------------------------------- 0 yog xoom tsis yog OTextbox2 ----- ----------- 0Textbox3 ---------------- Myfilename --------------------- ---------- Hloov kom tsis muaj kev sib tsoo! Button1 ------------------ ModifyRichtextbox1 Picturebox1 Picturebox2 Timer1

Kauj Ruam 8: Ntxiv Qee Cov Cai

Ntxiv Ib co Cai
Ntxiv Ib co Cai

Saib cov kauj ruam 12 ntawm lwm qhov kev qhia rau qhov chaw ntawm lub pob uas ntxeev ntawm daim ntawv pom thiab saib code. Hloov mus rau txoj cai saib thiab muab cov cai hauv qab no tso rau hauv. Cov xim yuav tsum rov tshwm sim dua li hauv lub screenshot. Yog tias kab tsis tau theej zoo vim muaj teeb meem wordwrap ces tshem qhov chaw kom txog thaum cov lus yuam kev ploj mus. Kuv tau sim tawm tswv yim feem ntau ntawm cov kab kom tus lej tsawg kawg ua rau muaj kev nkag siab. Rho tawm cov pej xeem hauv chav kawm me me yog li cov ntawv tau tso tseg ua ntej tso qhov no - cov cai no twb muaj chav kawm pej xeem lawm. Yog tias yam khoom zoo li lub npov ntawv tsis tau muab tso rau ntawm daim ntawv lossis muaj lub npe tsis raug ces nws yuav los nyob rau hauv cov ntawv kab ntawv nrog cov kab xiav xiav nyob hauv qab nws. Imports System. IOImports Strings = Microsoft. VisualBasic 'yog li siv tau yam zoo li sab laug (thiab sab xis (rau cov hlua Cov Pej Xeem Hauv Chav Kawm Ntawv 1 Pej Xeem Tshaj Tawm Pw Tsaug Lib "kernel32" (ByVal dwMilliseconds Raws Li Integer) 'rau kev hais lus pw tsaug zog Dim NrogEvents serialPort Raws li Tshiab IO. Ports. SerialPort' qhov chaw nres nkoj tshaj tawm Dim PicaxeRegisters (0 Rau 13) Raws li Byte 'sau npe b0 rau b13 Dim ModifyFlag Raws li Boolean Private Sub Form1_Load (ByVal sender Raws li Lub Hom Phiaj, ByVal e Raws Li System. EventArgs) Ua Haujlwm Rau Kuv. Load' xav tau tag nrho cov khoom pov tseg no -.net muab nws tso cia thaum mus form1events saum toj/thauj khoom Timer1. Enabled = True 'muab qhov no tso ua qhov tsis raug thaum tsim Timer1. Interval = 20000' txhua 20 vib nas this PictureBox1. BackColor = Color. Gray 'pib nrog lub thawv grey PictureBox2. BackColor = Color. Gray ModifyFlag = False' yog hloov tus nqi manually ces s rub rub RichTextBox1. Multiline = Muaj tseeb 'yog li tuaj yeem tso tawm ntau dua ib kab Hu rau DisplayPicaxeRegisters ()' tso saib 14 tus lej Sau npe ReadFTPFilename () 'nyeem cov npe ntawv tawm ntawm daim disk (khaws cia txhua 20 vib nas this) Xaus Sub Sub SerialTxRx () Dim DataPacket (0 txog 17) Raws li Byte 'tag nrho cov ntaub ntawv pob ntawv "Cov Ntaub Ntawv" +14 bytes Dim Kuv Raws Li Integer' kuv ib txwm muaj txiaj ntsig zoo rau loops thiab lwm yam Rau kuv = 0 Rau 3 DataPacket (i) = Asc (Mid ("Data", i + 1, 1)) 'ntxiv lo lus "Cov Ntaub Ntawv" rau pob ntawv Tom ntej Rau i = 0 Rau 13 DataPacket (i + 4) = PicaxeRegisters (i)' ntxiv tag nrho cov bytes rau pob ntawv Tom ntej Yog serialPort. IsOpen Tom qab ntawd serialPort. Close () 'tsuas yog nyob rau hauv rooj plaub uas tau qhib Xaus Yog Sim Nrog serialPort. PortName = "COM1"' Feem ntau lub khoos phis tawj tshiab tsis yog com1 tab sis ib qho ua ntej xyoo 1999 lub khoos phis tawj nrog tus lej nas yuav zaum tsis zoo rau com2. BaudRate = 2400 '2400 yog qhov nrawm tshaj plaws rau picaxes me me. Parity = IO. Ports. Parity. None 'tsis muaj parity. DataBits = 8' 8 khoom. StopBits = IO. Ports. StopBits. One 'ib qho nres me ntsis. ReadTimeout = 1000' millisecon ds yog li lub sijhawm tawm hauv 1 thib ob yog tias tsis muaj lus teb. Open () 'qhib qhov chaw nres nkoj. DiscardInBuffer ()' tshem qhov tsis nkag mus. Sau (DataPacket, 0, 18) 'xa cov datapacket array Hu Sleep (300)' 100 milliseconds yam tsawg kawg kom tos cov ntaub ntawv kom rov qab los thiab ntau dua yog cov ntaub ntawv xa mus ntev dua. Read (DataPacket, 0, 18) 'nyeem rov qab hauv cov ntaub ntawv pob ntawv array. Kaw ()' kaw qhov chaw nres nkoj txuas nrog Nrog rau kuv = 4 Txog 17 PicaxeRegisters (i - 4) = DataPacket (i) 'txav cov pob ntawv tshiab mus rau hauv cov npe sau npe Tom ntej PictureBox1. BackColor = Color. GreenYellow' ua haujlwm Catch ex Raws li Kev Tso Cai PictureBox1. BackColor = Color. Red 'tsis ua haujlwm Kawg Sim Xaus Sub Sub FTPUpload (ByVal Filename Raws Li Txoj Cai) Dim localFile Raws li Txoj hlua 'qhov chaw khaws cov ntaub ntawv Dim remoteFile Raws li Txoj hlua' filename yog cov ntaub ntawv rhiab qhov no yog qhov tseem ceeb heev Tus tswv tsev Raws li txoj hlua = "ftp://ftp.0catch.com" 'nco ntsoov 0 yog xoom tsis yog tus cim O Const username Raws li Txoj hlua = "picaxe.0catch.com" Tus lej zais li Txoj hlua = "picaxetester" Dim URI Raws li Txoj hlua localFile = Filename 'tej zaum tsis xav tau tab sis yog txhais qhov chaw piv txwv c: / mydirectory tuaj yeem ntxiv tau yooj yim li no remoteFile = "/" + Filename' cov ntaub ntawv ntawm ftp server xav tau "/" ntxiv rau pem hauv ntej URI = host + remoteFile Sim Dim ftp As System. Net. FtpWebRequest = CType (System. Net. FtpWebRequest. Create (URI), System. Net. FtpWebRequest) ftp. Credentials = Tshiab System. Net. NetworkCredential (username, password) 'nkag rau hauv ftp. KeepAlive = False' kev txuas ib zaug ua tiav ftp. UseBinary = True 'siv binary comms ftp. Timeout = 9000' sijhawm tas tom qab 9 vib nas this - muaj txiaj ntsig zoo li ftp qee zaum tuag 'sijhawm tas (thiab lub sijhawm zaus ntawm 20 secs) yuav xav tau qeeb rau kev sib txuas dialup ftp. Txoj kev = System. Net. WebRequestMethods. Ftp. UploadFile 'pib xa cov ntaub ntawv Dim fs Raws li Tshiab FileStream (localFile, FileMode. Open)' qhib cov ntawv hauv zos Dim filecontents (fs. Length) Raws li Byte 'nyeem rau hauv nco fs. Read (filecontents, 0, fs. Length) fs. Close () 'kaw cov ntaub ntawv Dim thovStream As Stream = ftp. GetRequestStream ()' pib ftp txuas thov ream. Write (filecontents, 0, filecontents. Length) 'xa nws thovStream. Close ()' kaw qhov txuas PictureBox2. BackColor = Color. GreenYellow 'hloov lub thawv rau ntsuab hais tias ua haujlwm tau zoo Label2. Text = "FTP Txuas" ntawv hais tias nws txuas Catch 'tsis tuaj yeem txuas PictureBox2. BackColor = Color. Red' lub thawv rau xim liab raws li tsis muaj kev sib txuas Label2. Text = "FTP Upload Fail" "cov ntawv hais tias kev txuas tsis ua tiav End Sim End Sub Sub FTPDownload (ByVal Filename As String) 'rub tawm remotefile mus rau localfile Dim localFile Raws li Txoj hlua' qhov chaw khaws cov ntaub ntawv Dim remoteFile Raws li Txoj hlua 'filename yog cov ntaub ntawv rhiab qhov no yog qhov tseem ceeb heev Const host Raws li Txoj hlua = "ftp://ftp.0catch.com" Const username As String = "picaxe.0catch.com "Txheeb tus password Raws li Txoj hlua =" picaxetester "Dim URI Raws li Txoj hlua 'localFile =" C: / " + Filename' khaws hauv cov npe hauv paus tab sis tuaj yeem hloov qhov localFile = Filename 'yog li tuaj yeem ntxiv c: / yog xav tau txhais qhov chaw nyob tiag tiag remoteFile = "/" + Filename 'ntxiv rau tej thaj chaw deb ftp qhov chaw URI = host + remoteFile' ua puv qhov chaw Sim Dim ftp Raws li System. Net. FtpWebRequest = CType (System. Net. FtpWebRequest. Create (URI), System. Net. FtpWebRequest) ftp. Credentials = Tshiab System. Net. NetworkCredential (username, password) 'nkag rau hauv ftp. KeepAlive = Cuav 'yuav raug txiav tawm tom qab ua tiav ftp. UseBinary = Muaj tseeb' hom binary hom ftp. Timeout = 9000 'sijhawm tas tom qab 9 vib nas this ftp. Method = System. Net. WebRequestMethods. Ftp. DownloadFile' rub tawm cov ntawv 'nyeem hauv daim li tsis paub tias cov ntaub ntawv loj npaum li cas siv Cov lus teb Raws li System. Net. FtpWebResponse = CType (ftp. GetResponse, System. Net. FtpWebResponse) Siv responseStream Raws li IO. Stream = response. GetResponseStream Siv fs Raws li Tshiab IO. FileStream (localFile, IO. FileMode. Create) Dim tsis (2047) Raws li Byte Dim nyeem Raws li Integer = 0 Ua kom nyeem = tebStream. Read (tsis, 0, tsis ntev. Length) 'daim ntawm ftp fs. Write (tsis, 0, nyeem)' thiab sau rau ntawv Loop Kom txog thaum nyeem = 0 'txog thaum tsis muaj ntau qhov lus tebStream. Close ()' kaw qhov ftp ntawv fs. Flush () 'yaug kom meej fs. Close ()' thiab kaw th e ntawv Kawg Siv responseStream. Close () 'kaw nws txawm tias tsis muaj dab tsi nyob ntawd Kawg Siv cov lus teb. Kaw () PictureBox2. BackColor = Color. GreenYellow' lub thawv ntsuab raws li nws ua haujlwm Label2. Text = "FTP Txuas" "thiab cov ntawv hais nws ua hauj lwm Xaus Siv Catch 'muab cov lej yuam kev ntawm no PictureBox2. BackColor = Color. Red' lub npov liab vim nws tsis ua haujlwm Label2. Text = "FTP Download Fail" "thiab cov lus los hais qhov no End Try End Sub Private Sub Timer1_Tick (ByVal sender Raws li System. Object, ByVal e Raws li System. EventArgs) Ua Haujlwm Timer1. Tick Yog ModifyFlag = Tsis Yog Li 'Yog tias tus neeg siv hloov pauv ib byte ces tsis txhob rub Label3. Text = "Rub Tawm" System. Windows. Forms. Application. DoEvents () 'yog li daim ntawv lo tshiab sau qhia Hu FTPDownload (TextBox3. Text)' rub cov ntaub ntawv nyob deb Label3. Text = "Rub tawm" System. Windows. Forms. Application. DoEvents () Hu rau ReadRemoteFileToRegisters () = "Tham nrog picaxe" System. Windows. Forms. Application. DoEvents () Lwm Yam ModifyFlag = Cuav 'rov pib dua tus chij Xaus Yog Hu Rau SerialTxRx () 'xa mus rau picaxe thiab nyeem nws rov qab Label3. Text = "Xa thiab tau txais los ntawm picaxe" System. Windows. Forms. Application. DoEvents () Hu rau DisplayPicaxeRegisters () Hu rau SaveRegistersToLocalFile () Label3. Text = "Uploading" System. Windows. Forms. Application. DoEvents () Hu rau FTPUpload (TextBox3. Text) 'xa rov qab mus rau ftp site npe raws li kuv lub npe Label3. Text = "So" Hu SaveFTPFilename ()' yog li nyeem nyob rau hauv thaum rov pib Xaus Sub Sub DisplayPicaxeRegisters () Dim Kuv Raws Li Tus lej Dim Dim tus lej Sau Raws Li Txoj Cai RichTextBox1. Multiline = Tseeb 'yog li tuaj yeem tso tawm ntau dua ib kab hauv kab ntawv RichTextBox1. Clear ()' tshem cov ntawv rau kuv = 0 Rau 13 registernumber = Trim (Str (i)) 'txiav tawm qhov chaw Yog tias kuv <10 Tom qab ntawv sau npe = "0" + registernumber' ntxiv 0 rau tus lej hauv qab 10 End Yog RichTextBox1. AppendText (registernumber + "=" + Str (PicaxeRegisters (i)) + Chr (13)) Tom ntej no 'chr (13) yog rov qab thauj khoom yog li kab tshiab Xaus Sub Tus Kheej Tus Kheej Sub1 Button1_Click (ByVal sender Raws li System. Object, ByVal e Raws li System. EventArgs) Handles Button1. Click Dim i As Integer 'kos tawm ntawm kab ua ntej kuv = Val (TextBox1. Text) Yog tias kuv <0 lossis i> 13 Ces TextBox1. Text = 0 End Yog i = Val (TextBox2. Text) Yog tias kuv <0 lossis i> 255 Ces TextBox2. Text = 0 End Yog PicaxeRegisters (Val (TextBox1. Text)) = Val (TextBox2. Text) 'hloov tus nqi Hu rau DisplayPicaxeRegisters ()' thiab rov ua dua cov zaub ModifyFlag = Tseeb 'thiab txuas ntxiv ftp txuas hla rub tawm End Sub Sub SaveRegistersToLocalFile ()' txuag sau npe array hauv cov ntawv xov xwm hauv zos Dim kuv Raws li FileOpen (1, TextBox3. Text, OpenMode. Output) 'qhib cov ntawv sau npe hauv kab ntawv Rau Kuv = 0 Rau 13 PrintLine (1, Str (PicaxeRegisters (i))) 'txuag 14 qhov txiaj ntsig Tom ntej FileClose (1)' kaw cov ntawv End Sub Sub ReadRemoteFileToRegisters () 'nyeem cov ntawv ntawv hauv zos rau hauv cov npe sau npe Dim Kuv Raws Li Qhov Sib Xws Dim LineOfText Raws Li Txoj Cai Sim FileOpen (1, TextBox3. Text, OpenMode. Input) 'nyeem cov npe cov ntaub ntawv nyob deb Rau Kuv = 0 Rau 13 LineOfText = LineInput (1)' nyeem hauv 14 lin es PicaxeRegisters (i) = Val (LineOfText) 'hloov cov ntawv rau qhov tseem ceeb Tom ntej FileClose (1) Catch ex As Exception FileClose (1)' file does not exist so do nothing End Try End Sub Sub ReadFTPFilename () 'yog li lub npe ntawm tej thaj chaw deb ftp cov ntaub ntawv yog tib lub sijhawm tom ntej qhov haujlwm no tau khiav Dim LineOfText Raws Li Txoj Cai Sim FileOpen (1, "FTPFilename.txt", OpenMode. Input) 'qhib cov ntawv LineOfText = LineInput (1) TextBox3. Text = LineOfText' nyeem npe FileClose (1) Catch ex As Exception FileClose (1) End Sim End Sub Sub SaveFTPFilename () FileOpen (1, "FTPFilename.txt", OpenMode. Output) 'tseg tej thaj chaw deb ftp cov ntaub ntawv npe PrintLine (1, TextBox3. Text) FileClose (1) Xaus SubEnd Class

Kauj Ruam 9: Khiav Txoj Haujlwm ntawm Ob Lub PCs

Khiav qhov program ntawm ob lub PCs
Khiav qhov program ntawm ob lub PCs

Pib khiav qhov haujlwm los ntawm txhaj rau daim duab peb sab ntsuab nyob rau sab saud ntawm qhov screen - lub pob 'Pib Debugging'. Tsis muaj dab tsi tshwm sim rau 20 vib nas this thiab tom qab ntawv qhov program yuav sim txuas rau ftp server thiab yuav sim txuas mus rau picaxe. Lub thawv duab yuav yog xim liab lossis ntsuab. Qhov chaw ftp yog lub vev xaib pub dawb thiab txhua tus tuaj yeem siv qhov no tab sis koj yuav tsum siv lwm qhov ftp ua haujlwm sib txawv (kuv yog DoctorAcula1) txwv tsis pub peb txhua tus tuaj yeem sib sau ua ke cov ntaub ntawv yog tias peb siv tib lub npe! Yog tias koj nyiam koj tuaj yeem thaum kawg tau txais koj tus kheej lub vev xaib ftp - tsuas yog hloov ftp qhov chaw, lub npe siv thiab tus lej nkag mus hauv ob qhov chaw hauv tus lej los ntawm kuv 0Catch lub vev xaib. Feem ntau cov vev xaib tso cai ftp. Ntau lub khoos phis tawj tuaj yeem nkag tau tib cov ntaub ntawv ftp - ftp fileserver txheeb tawm qhov kev txiav txim no tshwm sim li cas. Qee zaum muaj cov ntaub ntawv sib tsoo lossis dai thiab cov no zoo li tshwm sim txhua 20 daim ntawv nyeem. Muaj qhov siv sijhawm hauv cov cai yog tias qhov no tshwm sim yog li nws tsis rov qab cov ntaub ntawv ntau dua li cov ntaub ntawv tsis zoo. Ua kev siv txuas txuas txuas nrog 128kbs upload nrawm txhais tau tias cov ntaub ntawv xa tawm yuav siv sijhawm li 3 vib nas this tab sis qee zaum mus txog 8 vib nas this, feem ntau yog siv hauv kev tuav tes ntau dua li cov ntaub ntawv xa mus. Qhov no teeb tsa tus timer1 lub sijhawm tsawg kawg li ntawm 20 vib nas this coj mus rau hauv tus account rub tawm, upload thiab tham nrog picaxe. Nrog kev siv xov tooj cua nrawm heev koj tuaj yeem tuaj yeem ua rau lub sijhawm luv luv. Koj tuaj yeem hloov daim ntawv sau npe hauv VB txoj haujlwm. Yog tias koj ua, lub sijhawm teem sijhawm tom ntej hla kev rub tawm los ntawm ftp qhov chaw thiab xa cov ntaub ntawv tshiab mus rau picaxe thiab tom qab ntawd nyeem nws rov qab thiab upload nws. Cov ntaub ntawv tshiab yog li pom nws txoj hauv kev rau txhua picaxes txuas rau pawg no. Qhov no muaj txiaj ntsig zoo rau kev debugging thiab/lossis txuas PC software rau hauv microcontroller kho vajtse voj. Cov vev xaib tseem tuaj yeem nkag mus rau lub khoos phis tawj siv PERL tsab ntawv lossis zoo sib xws los sau cov ntaub ntawv tshiab rau ftp qhov chaw. Qhov screenshot no tau coj los ua haujlwm Tx nti, hloov tau thiab sau npe b0 = rau 1 tau xa mus rau Rx nti uas tau hloov pauv npe b1 rau 1 ib yam nkaus. Yog li cov coj tau teeb rau ntawm ob lub laug cam. Qhov no yog daim ntawv thov tsis tseem ceeb tab sis nws yooj yim tig rau lub 3.6Kw twj tso kua mis es tsis txhob coj. Qee cov tswv yim ntxiv yog nyob ntawm https://drvernacula.topcities.com/ suav nrog txuas picaxes ntawm lub hnub ci siv xov tooj cua txuas. Nrog xov tooj cua txuas nrog rau internet nws tuaj yeem ua rau 'Cov Machine' mus txog rau ntau lub ces kaum ntawm lub ntiaj teb. Muaj qee lub tswv yim nyob ib puag ncig ntawm picaxe rooj sab laj txog kev siv lub tswv yim no ntxiv thiab hloov lub PC thiab ftp qhov chaw nrog cov nplooj siab webserver uas txuas ncaj qha rau hauv router. Kom meej meej qhov no yuav txo qis kev siv hluav taws xob ntawm qhov txuas. Yog tias koj xav tau kev sib tham ntxiv thov tso rau ntawm Intstructable cov lus pom thiab/lossis ntawm lub rooj sib tham picaxe. Dr James MoxhamAdelaide, South Australia

Kauj ruam 10: Screenshots of Code

Screenshots ntawm Code
Screenshots ntawm Code

Los ntawm kev thov, ntawm no yog ntu cov duab ntawm vb.net code nrog txhua qhov kev teeb tsa hauv qhov chaw. Cov cai no tau theej tawm rov qab ntawm cov lus qhia no thiab cov txheej txheem rov tshwm sim tuaj. Nws yuav zoo dua los theej thiab muab cov ntawv sau dua li sim nyeem cov duab no tab sis cov no yuav muaj txiaj ntsig yog tias koj nyob hauv khw internet thiab tsis tuaj yeem nruab vb.net.

Kauj ruam 11: Screenshot2

Screenshot2
Screenshot2

Screenshot 2

Kauj ruam 12: Screenshot 3

Screenshot 3
Screenshot 3

Screenshot 3

Kauj ruam 13: Screenshot 4

Screenshot 4
Screenshot 4

Screenshot 4

Kauj ruam 14: Screenshot 5

Screenshot 5
Screenshot 5

Screenshot 5

Kauj ruam 15: Screenshot 6

Screenshot 6
Screenshot 6

Screenshot 6

Pom zoo: