苏州大学硕士学位论文基于单片机和PC串口通信的温度采集系统设计姓名:周建春申请学位级别:硕士专业:电子与通信工程指导教师:钱敏2010-11PCIIIPCA/DDALLASDS18B20/PC/DS18B20LCD1602RS-232PCAT89S52LCD1602RS-232AbstractDesignofATemperatureAcquisitionSystemBasedonSimpleChipMachine&RS232ofPCIIDesignofATemperatureAcquisitionSystemBasedonSingleChipMachine&RS232ofPCAbstractTemperatureisoneofthemostbasicenvironmentalparameters,anditusuallymustbemeasuredindailylifeandindustrial&agriculturalproduction.Withtherapiddevelopmentofsemiconductortechnology,moreandmore,digital&intelligenttemperaturemeasuringtechnologyiswidelyapplied.Soitisparticularlyimportanttomasterthetechonlogyofdesigningatemperaturemeasurement&controlsysteminhardwareandsoftware.ThetraditionalmodeofTemperaturemeasurementadoptedthermocoupleorthermistorwhoseoutputisanalogsignalsandmustbeconvertedtodigitalsignals,thentransmittedintoSCM(SimpleChipMachine).Soitisrathercomplexwithlittlehighercost.Inrecentyears,DS18B20(DALLASUSA),asarepresentativeofthenewdigitaltemperaturesensorwithsinglebus,iswidelyused.Inthisproject,atemperaturemeasuring&transmitionsystemcontrolledbySCMandPCisdesigned.Atfrontend,thereal-timetemperaturedataacquiredandconvertedtodigitaltypethroughDS18B20sensoraresentintoSCM,anditisdisplayedonLCD1602module.Inaddition,theacquiredtemperaturedataaretransmittedtobackendPCviaRS-232interfacesoastobedisplayed,storiedandcontinuedprocess.KeywordsAT89S52LCD1602RS-232DigitalTemperatureSensorWrittenbyZhouJianChunSupervisedbyQianMinPC11.1A/DDALLASDS18B20A/DDS18B20LCD1602VBPCPC1.21593(15641642)PC21.3PC32.12.1.1A/DA/DA/D2.1.2DS18B20DS18B20DS18B20AT89S52522.2PC4AT89S52DS18B20MAX232PCRS-2322.32.3.1803180528031RAMAT89S52CMOS8KFlashAtmel80C51FlashAT89S52AT89S52AT89S528KFlash256RAM32I/O216/62AT89S520Hz2CPURAM/RAM88KFlash1AT89S52CPU/PC5ROMRAMCPUT0T1T21AT89S52MCS-511AT89S528KbytesFlash64KAT89S52PC0000H0000HEAAT89S52EAVCC0000H~1FFFH2000H~FFFFH2AT89S52256128128AT89S52DATAIDATAXDATA/AT89S523161TMODPC62GATEC/TM1M0GATEC/TM1M0D7D6D5D4D3D2D1D0T1T02TMOD1GATE/INT0INT1T0T1GATE=0TCONTR0TR11T0T1GATE=1TCONTR0TR11P3INT0INT1T0T12C/TC/T=1C/T=03M1M0/11M1M000011011012313/16/813/T08T132TCON3D0~D3TF1TR1TF0TR0IE1IT1IE0IT0D7D6D5D4D3D2D1D03TCONTR0T110TF0T01CPU0PC7TR1T1TR0TF1T1TF0TMODTCON0AT89S521SBUFSBUFSBUF99H1PCON87HD7SMODSMOD0SMOD=11234SMODD7D6D5D4D3D2D1D04PCONTCON2SCON98H59F9E9D9C9B9A9998RITIRB8TB8RENSM2SM1SM05SCON1RI08RI=1CPU1SM2=1RI2TI08TI=1CPUPC83TB82394RB82391SM2=0RB80RB85REN6SM2237SM0SM122SM0SM18UART9UART9UART00011011fosc/12fosc/64fosc/320123SCONCPUCPUCPU1AT89S5262INT0INT1//T0T1T2TXDRXDSCONTIRISCON98H6TIRI6SCONPC92IE7EAET2ESET1EX1ET0EX07IEEAET22ESET11EX11ET00EX003IP8IPPT2PSPT1PX1PT0PX08IP4CPUPCPC3PC10300003H00000BH10013H1001BH0023H2/T2EX002BHRETICPUPC5AT89S52AT89S52XTAL1XTAL2XTAL2XTAL12.3.2DALLASDS18B20DALLASDS18B201DS18B2039DQ/GNDVDDGND123DS18B20DQVDD9DS18B202PC11DS18B201064ROMTHTL64ROM8CRCTLTH10DS18B2031I/O2DS18B20DS18B203DS18B2043.0~5.5V5)DS18B206-55~+1250.579~120.50.250.1250.06258CPUCRC91011DS18B20PC12DS18B2011121551101112011=02LSB/=0111DS18B20DS18B20164ROMROM64DS18B2064ROM828H48DS18B20856CRC=X8+X5+X4+1ROMDS18B20DS18B202DS18B20ConvertT[44h]DS18B20PC131612LSByteMSBytebit7bit6bit5bit4bit3bit2bit1bit0bit15bit14bit13bit12bit11bit10bit9bit8SSSSS202122232425262-12-22-32-412S=0S=1112160.0625/LSBS+12507D0H+25.06250191H-25.0625FF6FH-55FC90H44DS18B20TEMPERATUREDIGITALOUTPUTBinaryDIGITALOUTPUTHex+125+85+25.0625+10.125+0.5+0-0.5-10.125-25.0625-55000001111101000000000101010100000000000110010001000000001010001000000000000000000000000000000000111111111111100011111111010111101111111001101111111111001001000007D0h0550h0191h00A2h0008h0000hFFF8hFF5EhFE6FhFC90h3THTLDS18B20THTLTHTLTTHTTLDS18B20THTLEEPROMTHTL4PC14R0R151TMDS18B20DS18B200R1R06DS18B20125TMR1R0111116R1R000011011910111293.75ms187.5ms375ms750ms597345THTL617898CRC7DS18B20LSByteMSByteTHTLCRC012345678DS18B20DS18B20DS18B20ROMRAMDS18B20CPUPC15500DS18B20166060240CPUROMRAM898ROMROM33HDS18B20ROM6464ROMDS18B20DS18B20DS18B2064ROM64ROMDS18B2055H0FOH0CCH0ECHROMROMROM9RAMDS18B2012750ms993.75ms9RAMRAM9RAM34RAM34EEPROMEEPROMRAM34EEPROM44H0BEH4EH48H0B8H0B4H2.3.3LCD1602LCD1602LCDLCD1602160A01000001B41HPC1641HALCD1602ASCIIASCIILCDLCMPCBLCDCOBCOGCOGICPCBICCOBICLCDPCBLCDLCDLCDLCDLCDLCDLCD1602LCD16*116*220*220*4LCD1602LCD160216*24.5V~5V2.0mA5.0V5.0V2.95*4.35W*HmmLCD16021416PC17101012345678910111213141516//VSSVDDVEERSRWEDB0DB1DB2DB3DB4DB5DB6DB7LED+LED-LCD1.LCD1602LCD1602MPU84LCD160240*16LCD1602RAM(CGRAM)2LCD1602MPULCD1602MPU11111Vss0V2VDD5V3VOLCD0-5V4RSH/LLH5R/WH/LHMPULMPU6EH/LR/W=L,E=H7-10DB0-DB3H/LMPU4411-14DB4-DB7H/LMPU44MPU8DB0-DB73LCD1602PC18(IR)(DR)(BF)(AC)(DDRAM)ROM(CGROM)RAM(CGRAM)1(IR)(DR)(IR)(DR)/12IRIRDRDRDDRAMCGRAMDDRAMCGRAM12IRDR/RSRW0IR01BFAC(DB7-DB0)0DRDRDDRAMCGRAM11DRDB7-DB0DDRAMCGRAMDR2(BF)BF=1RS=0R/W=1E(H)BFDB73(AC)ACDDRAMCGRAMIRIRACDDRAMCGRAMAC11DRDDRAM/CGRAMDDRAM/CGRAMDRAC11RS=0R/W=1E(H)ACDB7-DB04(DDRAM)DDRAM80*880DDRAMDDRAM00H-4FHDDRAM00H-27H40H-67H5ROM(CGROM)CGRAM5*82045*11326RAM(CGRAM)PC19CGRAM4LCD1602LCD16021313LCD1602RSR/WDB7DB6DB5DB4DB3DB2DB1DB0000000000120HDDRAMDDRAMAC=01.53ms000000001-AC=0DDRAM1.53ms00