Cov txheej txheem:

Sib cuam tshuam CMUCam2 rau OOPIC: 5 Cov Kauj Ruam
Sib cuam tshuam CMUCam2 rau OOPIC: 5 Cov Kauj Ruam

Video: Sib cuam tshuam CMUCam2 rau OOPIC: 5 Cov Kauj Ruam

Video: Sib cuam tshuam CMUCam2 rau OOPIC: 5 Cov Kauj Ruam
Video: NLP with Python! Term Frequency-Inverse Document Frequency (tf-idf) 2024, Hlis ntuj nqeg
Anonim

Los ntawm arsinioFollow Ntau los ntawm tus sau:

Txuas ob OOBoards ua ke siv I2C
Txuas ob OOBoards ua ke siv I2C
Txuas ob OOBoards ua ke siv I2C
Txuas ob OOBoards ua ke siv I2C

Txheej txheem cej luam ntawm yuav ua li cas cuam tshuam CMUCam2 rau thiab OOPIC.

Kauj Ruam 1: Ua Tus Adapter Cable

Ua tus Adapter Cable
Ua tus Adapter Cable

1. Mus rau radioshack thiab yuav 2 ntawm cov no: Txiv neej DB-9 Solder Cup Connector2. solder tus pin 5 ntawm tus txuas A rau tus pin 5 ntawm tus txuas B (yog tias koj saib zoo zoo ntawm tus txuas, lawv tau cim) 3. solder tus pin 2 ntawm tus txuas A rau tus pin 3 ntawm tus txuas B (yog tias koj ua tib zoo saib ntawm tus txuas, lawv tau cim) 4. solder tus pin 3 ntawm tus txuas A rau tus pin 2 ntawm tus txuas B (yog tias koj ua tib zoo saib ntawm lub txuas, lawv tau cim)

Kauj Ruam 2: Hloov Tus Nqi Baud ntawm CMUCam

Hloov Baud Tus Nqi ntawm CMUCam
Hloov Baud Tus Nqi ntawm CMUCam

Hloov tus nqi baud ntawm CMUCamera mus rau 9600 baud (ntxiv jumper rau txoj haujlwm 0).

Kauj Ruam 3: Txuas Tus Qauv Txuj Ci Cable thiab Tshaj Tawm Cov Cai

Txuas Tus Qauv Txuj Ci Cable thiab Tshaj Tawm Cov Cai
Txuas Tus Qauv Txuj Ci Cable thiab Tshaj Tawm Cov Cai

Txuas tus txheej txheem txheej txheem cable thiab xa koj cov cai. Nov yog qee qhov piv txwv piv txwv kom koj pib qhov chaws no yuav taug qab kev siv LF thiab FD cov lus txib. Nws yuav hloov IOLine 7 (nqes mus rau ib qho LED) thiab tsom iav qhov xwm txheej taug qab LED ntawm CMUCam.

& apos ******** qhov chaw nres nkoj cuam tshuam txog cov khoom ******** Dim serialPort Raws li tshiab oSerialPortDim txBuff Raws li tshiab oBuffer27 & aposchange 27 ua kom tsis txhob loj dua/me dua Tshiab oDIO1Dim toggleSerial_Event Raws li Tshiab oEventDim toggleSerial_Wire Raws li Tshiab oWireDim serialReceive_Event Raws li Tshiab oEventDim serialReceive_Wire Raws li Tshiab oWire & apos ******** debug cuam tshuam cov khoom ******** Dim dimLED li tshiab oDIO1 & apos ******** ************************************** & apos*Generic Subroutines*& apos ****** **************************************** Sub lub ntsiab & aposinitialize txhua yam main_init & aposset peb tso tawm daim npog rau tsuas yog ua raws qhov nruab nrab ntawm pawg CMUCAM_setOutputMask (2, 3) & aposload peb qhov pib sib txawv thav duab CMUCAM_loadDiffFrame () & aposstart qhov sib txawv suav CMUCAM_startDiffCalc (10) Xaus SubSub main_init & aposinitialize cov xwm txheej LED statLED. IOLine = 7 statLED. Direction = cvOutputial) Xaus Su b & aposprocesses tau txais pob ntawvSub txheej txheemPacket () Dim mx Raws li Byte Dim Kuv Raws Li Byte & aposcheck rau ob qho tib si Mx thiab Kuv yuav yog 0 & thov zam txim yog tias lawv tsis yog 0, qhov chaw yuav tawm (piv txwv li & aposT 12 34) & aposbut ces lawv yeej & cov thwjtim raws li 0 tus qauv rxBuff. Location = 2 mx = rxBuff. Value rxBuff. Location = 4 kuv = rxBuff. Value & tus thwjtim coj yuav tsum ntsais ntsais nrog kev taug qab LED ntawm lub koob yees duab Yog (mx = "0") Thiab (kuv = "0") statLED = 0 Lwm yam statLED = 1 Xaus IfEnd Sub & apos ********************************************* **** & apos*CMU Cam Ua Haujlwm*& apos *************************************** ******* & apossets qhov muab coj mus rau, tawm, tsis siv neeg & aposparam ledNum tus naj npawb ntawm coj (0, 1) & aposparam val tawm, rau, pib (0, 1, 2) Muaj nuj nqi CMUCAM_ledSet (ledNum Raws Li Byte, val As Byte) Raws li Byte & aposVString tsis yog & tus thwjtim ua haujlwm raug hauv tus neeg sau tshiab… & aposnot tsis paub meej txog qhov qub & ApostxBuff. VString = "L0 0" & apossetup peb cov kab lus txib manually txBuff. Location = 0 txBuff. Value = "L" txBuff. Location = 1 & aposthe s tr $ function sucks… tam sim no qhov no tshwm sim txBuff. Value = serial_toChar (ledNum) txBuff. Location = 2 txBuff. Value = "" txBuff. Location = 3 txBuff. Value = serial_toChar (val) txBuff. Location = 4 txBuff. Value = 13 & apossend qhov hais kom ua serial_SendBufferEnd Sub & aposloads qhov pib sib txawv frameSub CMUCAM_loadDiffFrame () & apossetup peb cov kab lus txib manually txBuff. Location = 0 txBuff. Value = "L" txBuff. Location = 1 txBuff. Value = "F" txBuff. Location = Tus nqi = 13 & apossend qhov hais kom ua serial_SendBufferEnd Sub & aposstarts xam cov kab sib txawv & aposparam pib qhov pib (0-9) Sub CMUCAM_startDiffCalc (thresh As Byte) Dim kaum Raws li Byte & apossetup peb cov lus txib manually txBuff. Location = 0 txBuff. Value = ". 1 txBuff. Value = "D" txBuff. Location = 2 txBuff. Value = "" txBuff. Location = 3 tens = thresh/10 txBuff. Value = serial_toChar (kaum) txBuff. Location = 4 tens = thresh/10 txBuff. Value = serial_toChar (thresh-tens) txBuff. Location = 5 txBuff. Value = 1 3 & apossend qhov hais kom ua serial_SendBufferEnd Sub & apossets tso tawm daim npog ntsej muag & aposparam pob ntawv Hom hom pob ntawv los npog (0, 1, 2, thiab lwm yam) saib nplooj 46 & aposparam daim npog ntsej muag tus nqi thov (0-255) Sub CMUCAM_setOutputMask (pob ntawvType As Byte, daim npog Aste) As Byte Dim ten As Byte & apossetup our command string manually txBuff. Location = 0 txBuff. Value = "O" txBuff. Location = 1 txBuff. Value = "M" txBuff. Location = 2 txBuff. Value = "" & apospacket type txBuff. Location = 3 txBuff. Value = serial_toChar (packetType) txBuff. Location = 4 txBuff. Value = "" & aposmask to apply txBuff. Location = 5 175 = mask/100 txBuff. Value = serial_toChar (pua pua) txBuff. Location = 6 tens = (mask-175)/10 txBuff. Value = serial_toChar (kaum) txBuff. Location = 7 txBuff. Value = serial_toChar (mask-hundred-tens) & aposcarriage return txBuff. Location = 8 txBuff. Value = 13 & apossend the command serial_SendBufferEnd Sub & ********************************************* & apos*General Serial Subroutines *& npo s **************************************************** & aposinitializes cov ntawv portSub serial_init () & aposinitialize ib lub pob kom qhib thiab tawm ntawm qhov chaw nres nkoj txuas (tig rau khiav, tua rau program) toggleSerial_Button. IOLine = 5 toggleSerial_Button. Direction = cvInput toggleSerial_Wire. Input. Link (toggleSerial_Button. Value) toggle. Txuas (toggleSerial_Event. Operate) toggleSerial_Wire. Operate = cvTrue & aposinitialize ib qho kev tshwm sim rau buffer peb cov ntaub ntawv serialReceive_Wire. Input. Link (serialPort. Received) = 0 & aposinitialize peb qhov chaw nres nkoj serialPort. Baud = cv9600 & aposinitialize peb cov xwm txheej xwm txheej LED serialActive_LED. IOLine = 6 serialActive_LED. Direction = cvOutput & aposwait ntawm no kom txog thaum peb qhov chaw nres nkoj txuas tau qhib thaum serialPort. Operate = cvFalse WendEnd Sub thiab tshawb xyuas cov ntaub ntawv pob ntawv ua tiavSub serialRe ceive_Event_Code () & apos.received dhau los ua tsis tseeb thaum 4byte buffer tsis muaj dab tsi Thaum (serialPort. Received = cvTrue) & aposcopy byte rau peb tsis rxBuff. Value = serialPort. Value & aposcheck rau qhov kawg ntawm pob ntawv Yog rxBuff. Value = 13 & cov txheej txheem & aposreset qhov tsis mus rau qhov pib rxBuff. Location = 0 Lwm yam rxBuff. Location = rxBuff. Location + 1 EndIf WendEnd Sub & aposturns rau thiab tawm ntawm qhov chaw nres nkoj rau kev sau npe programming serialPort. Operate = cvFalse serialActive_LED = 0 End IfEnd Sub & aposconverts ib tus lej tus lej rau tus cim Function serial_toChar (inVal As Byte) As Byte Dim retVal As Byte Xaiv Case inVal Case 0 retVal = "0" Case 1 retVal = "1" Case 2 retVal = "2" Case 3 retVal = "3" Case 4 retVal = "4" Case 5 retVal = "5" Case 6 retVal = "6" Case 7 retVal = "7" Case 8 retVal = "8" Case 9 retVal = "9" Xeem Xaiv serial_toChar = retValEnd Function & apos sen ds cov ntaub ntawv muaj nyob hauv txBuff & apos Nco tseg: xyuas kom tsis muaj cov thauj rov qab (13) thaum kawg !! Sub serial_SendBuffer () & apositerate los ntawm, xa txhua byte, kawg ntawm carriage rov txBuff. Location = 0 Thaum 1 serialPort. Value = txBuff. Value ooPIC. Delay = 1 & aposmight tsis xav tau qhov no & apossee yog tias nws yog tsheb thauj khoom rov qab Yog txBuff. Value = 13 & aposbreak tawm ntawm peb lub voj rov qab Xaus Yog & aposgo rau tus cim tom ntej txBuff. Location = txBuff. Location + 1 WendEnd Sub

Kauj Ruam 4: Txheeb cais qhov Programming Connector

Disconect Programming Connector
Disconect Programming Connector
Disconect Programming Connector
Disconect Programming Connector

Thaum lub tshuab txuas txuas raug txuas, txuas cov kab sib txuas tshiab raws li qhia hauv qab no. Tus adapter ua hauv theem 1 yuav tsum tso cai rau CMUCam txuas ncaj qha rau hauv OOPIC

Kauj Ruam 5: Nias Lub Pob kom Pib Pib Kev Sib Txuas Lus

Lub pob ntawm IOLine 5 yuav pib kev sib txuas lus ntawm CMUCam thiab OOPIC. Txij li qhov chaw nres nkoj txuas tau siv rau ob qho kev ua haujlwm thiab CMUCam, tej zaum yuav tsum muaj txoj hauv kev tswj hwm ntawm ob qho tib si.

Qhov kev zov me nyuam yuav tsis ua haujlwm kom txog thaum lub pob nyem no. Yog tias koj nias lub pob dua, qhov chaw nres nkoj txuas yuav tsis ua haujlwm, tso cai rau koj ua haujlwm rau nws. LED ntawm IOLine 6 qhia txog tam sim no chaw nres nkoj xwm txheej (ntawm txhais tau tias nquag, tawm txhais tau tias npaj rau kev ua haujlwm).

Pom zoo: