New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Vito Kilback

ConcurrentProgramming CS361

Marketplace > Drexel University > ComputerScienence > CS361 > ConcurrentProgramming
Vito Kilback
GPA 3.88


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 35 page Class Notes was uploaded by Vito Kilback on Wednesday September 23, 2015. The Class Notes belongs to CS361 at Drexel University taught by WilliamMongan in Fall. Since its upload, it has received 28 views. For similar materials see /class/212437/cs361-drexel-university in ComputerScienence at Drexel University.

Similar to CS361 at Drexel

Popular in ComputerScienence


Reviews for ConcurrentProgramming


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/23/15
Measuring Temperature with Thermistors Academic Workshop Lab q lllll w quotW PERFORM Objective Exploit PSoC topology to build inexpensive digital thermometer Understand the operation of a negative temperature coefficient NTC thermistor Understand how to calculate Steinhart Hart constants for a specific thermistor Calculate temperature using the Steinhart amp Hart equation Calculate temperature using a look up table llllll quots CY P E R F O R M i 2 Hardware Overview CY8C3210PSOCEvaI I board MiniProg Thermistor 10k resistor Breadboard wire CYPRESS llll lli w P E R F O RM Reference Material AN2028 Ohmmeter AN2017 Thermistor Based Thermometer AN2239 ADC Selection CYPRESS llll lli w P E R F O RM Measuring Resistance Unlike measuring voltage or current measuring V a a passive characteristic like resistance requires stimulus A Classic method is to push current into a resistor and measure the developed voltage Only as accurate as Current Source ADC Gain and Offsets Resistance limited to ADC range Requires different current values for wide range of resistors Very popular when cost of accurate current sources was less than the cost of computation response test V 7396Sp01 lS6 I stim ADC PERFORM P800 and Measuring Resistance For this circuit the following equation holds V V V V P800 12 1 1R 2 V0 QREFHI ref test Solving for Rtest results in Rre i V K V2 L Rtest Rref V V Rtesgt Atten 0 1 V2 4 REFLO Offset errors removed by difference Measurement offset voltages subtract out Gain errors removed by quotient Measurement path errors divide out Accuracy determined by an external reference resistor PERFORM PSoC and Measuring Resistance And ADC resolution For an n bit ADC the number of counts seen across aR is a 2quot Allen 1 i NIH 01 The reading is accurate to 5 counts Overall resolution tolerance is to Z 1a2 2 Atten a o For 14 bits and an attenuation of 1516 the equation simplifies to 1 391a2 30720 a PSoC v 1 Atten V2 4 REFLO VV m 239 AA v Tol a 0332 001 00399 01 0013 1 00399 10 0332 100 PERFORM Thermistors A negative temperature coefficient thermistor NTC is a semiconductor device that becomes less resistive as its temperature increases The change in resistance is roughly expressed by the equation below RT1 ATl T2 R T Where 2 A is some empirical value less than one for negative temperature coefficient NTC thermistors T1 amp T2 are temperatures measured in Kelvin RT1 amp RT2 are the thermistor s resistances at these temperatures llllllll lul 5 CYPRESS P E R F ORM I AT1 T2 NTC Thermlstors 123 quotRoughlyquot is defined as a good approximation for an academic introduction to thermistors It shows the temperatureresistance relationship to be ideally exponential It won t hold up for real world temperature measuring application But for small temperature differences the following holds T T 13sz 511303 2 llllllll CYPRESS P E R F o R M SteinhartHart Equation The SteinhartHart equation describes the resistance change of a thermistor as related to its temperature The equation below shows it to be a 3rcl order logarithmic polynomial using three constants iAB1nRC1nR3 K Where A B and C are empirical constants TK amp is temperature in Kelvin R is the thermistor s resistance in Ohms llllll CYPRESS SteinhartHart Equation Many thermistors come with these three parameters de ned For this particular thermistor they are in the datasheet If not they must be calculated This is done by taking three points in the conversion table and solving for these constants It makes most sense to use the minimum maximum and a middle value for the temperature range for which you are interested From the Thermistor Table Tc Resistance 0 C 32660 ohms 40 C 5325 ohms 80 C 1257 ohms Note This is an example and not for the thermistor we are using PERFORM SteinhartHart Equation Apply the three data points to the following equation ABlnRC1nR3 TC 27315 To get the three following equations 36609962 A 103939 B 112289 C 31933662 A 858017 B 631666 C 28316662 A 713648 B 363456 C Solve to get A 011261637e2 B 023461776e3 C 085700804e7 5 CYPRESS llllllll39l Thermistors The cost of thermistors is primarily determined by the accuracy of the thermistor s resistance This is where the exponential nature of thermistors works out to your advantage A thermistor s resistance tolerance shows up as a temperature shift This can be calibrated out with a single point calibration ln test bring the thermistorto 25 C and measure its temperature Suppose it reads 262 C Software needs to store a 12 offset in memory PERFORM Thermistors In consumer products this calibration is many times left to the user The user interface allows access to the temperature offset register The user sets this if they think the temperature is a bit low or a bit high A good rule of thumb is that a thermistor resistance uncertainty of n works out to a temperature shift of approximately n3 C This will help determine if any calibration is needed Temperature calculations are only as accurate as the resistance measurement of the thermistor PERFORM Let s Get Started PSoC DeSIred Topology V0Out P05 buf1 REFHI Connect 10k Ohm from P05 to P01 10k Connect10k Ohm thermistor Inputmen from P01 to P03 V1In Start Designer Buffer Therm 15R v2 Out p03 REFLO Name the Project Therm PERFORM EVAL1 Connections Q Q o 0 II D o t a g 39E39T Starting a New Project Thermistor2 Psoc Designer 50 Eile reject interconnect guild C lShiftN Open PSoC Designer Open Proiect l39liorkspace CtrlShiFt0 Ch39N gpen File CtrO EL EH Close Workspace Select tart new project Sale Workspace Sa39u39e Jorksgace As g Save All ctrlshlft5 Recent Files gt Recent Projects gt Eit PERFORM Starting a New Project m Select Q Project Type c5355 This is a classic v4x F39SoC Designer project selecting and placing user modules Marne IPle39ILab O N e Location ICDocuments and Se ingsnloMy Ducumer39ntsPSoCCY3214SB rowse Workspace name IPWMLBD i7 Create girecloryfor workspace P Workspace ICraa te newl Workspace VI Qancel PERFORM Starting a New Project Select Device and Coding Method CY802946624PXI lgtltJ C Eelect iject Type K Clone project Bath Browse gala elt vz came Cigar path P l ce 5 same 3293 53 le Select Target Device Qevice YBCZMBBZAPVXI Mew Catalogquot I O Generate 39Mein file using 4 Q I Assembler PERFORM Global Resource Settings Global Resourca defaultlavout i Power Setting Vb3 SysCllc freq 1 CF LClol 32KSelect PLLli39locle SleepTimer VC I SyECIMN W32 quotu39 1 9quotC3 Source W33 Divider SysClk Source SysCIk E Disable Analog Power Raf Mux AGndBypass ClipAmp Bias AEluffPower Swi lcl lModeF ump Trip Voltage LVD 5MPH LquotuquotDTbrottle Ela ck la u39atcbdog Enable SJDV 24M Hz SysClka Intemal Disable zLHz 6 3 SyaCIlcquot1 2395 lrltamal Yes SC OnquotFlef High Pv ddquot2h BandGap Disable Low Low 0 FF 431quot 503 Disable Disable PERFORM Select PGA UM Select PGA and name it lnputAtten l Insert into ACBOO gt J In ut itter39i Set the PGA parameters to p Viv ELL I 39 I I I I x A 0quot le 3 Input nalogColuannputl39v39lLlXJ Reference AG N D Analog Bus Disable LL Atten Value set to 1516 Reference to AGND Input connected to column MUX to read all three points on the resistor string 39 Tlil39i Select Second PGA UM Select PGA and name it Buffer Insert into ACB01 Set the PGA parameters to quot7 Properties 351 Mw n nm M w T39Mr Tum mm m amps m BUFFER f Gain 1DE E Input ACBDD Reference AGND AnalngBus Disable Mame Indicates the name used to Identify this User Module instance This UM generate API in multiplex the input lines Select AMUX4 UM Select an AMUX4 and rename it ADCMUX Set its parameter has shown Properti ADCMUX 7 7 m ADCMUX LIPET 31 e if U 1 Analog Column Mux AlnMuzgl Mama 7 Indicates the name used to identify this User Module instance 41 MLIH ADCMUX PERFORM Select ADCINC UM Select an ADCINC UM and rename it ADC Select a single modulator and place it in ASC10 Select the clock to be VC2 Place the digital block in DBBO g DataFon39nat Resolution Date Clock ClockF hase Poslnput Neglnpu l NeglanrtGair Disconnected PulseWidlh 12B PWM Output None Signed M Bit quotu C2 Normal ACE Input connects to Buffer PWM is not used Select LCD UM Select and LCD UM and name it LCD Connect to Port 2 BarGraph is not needed Properti LED 7 35 LCD thequot 33 LI Fi 3quot j g LCDPort Pon2 BBFGIBDh Disable Name Indicates the name used to identify this User Module instance LCD PERFORM Rename Buffers and Pins Connect the AnalogOutBuf1 to P05 Rename this pin V0Out Connect the AnalogOutBufO to P03 Rename V2Out Change P01 to be an Analoglnput Rename it V1n Pinont v thermistor2 FEM PortDU StdCPU High 2 F nEIog Disabtelnt El FDH VLlri Analoginput High ZF nang Disabielrrt V1In Select Anaioglnput Drive High Z Anaiog interrupt Disableint PD QI P0 02 StdCPU High Z Analog Disabielnl El F013 VLOm AnaiugOuthj High ZAnaiug Disableint Name V2Out Select AnatogOmBufJ Drive High Z Anaiog quot interrupt Disableim PUP POLO StdCPU High Z Analog Disabielm El FOE V LOut AnatogOutBufj High ZAnaiog Elisableinr Name V0Out Select natogOutBu y J Drive High Z Anaiog interrupt Disableint P m Forth AE StdCPU High Z Analug Disabielm PERFORM Cut and Paste from File Add Initialization Code onCD In the Initialization Section x Add code to start Buffer 39quotputAtteW ADC and 2132 23125 LCD 2 122 inc 1V2 Add code to connect m Mus char pTemplZ unslgned their hTempValue const unalgned int wThermTable31El l 30265 23775 27366 260339 24782 23593 22463 analog bUS 2139920359194291552517570155501505515351y 14555 13995 13372 12777 12212 11577 11157 10552 COde to connect 10223 9754 9355 5959 0591 5230 7055 7550 7245 5951 5555 5395 5140 5593 5555 5434 t0 the COIUmnO 5219 5015 4620 4633 4455 4254 4120 3954 3514 3571 3534 3403 3275 3157 3042 2932 analog bUS 2525 2725 2527 2534 2444 2359 2275 2197 2121 2045 1975 1911 1545 1753 1724 1555 DeCIare IVO IV1 IV2 1511 1555 1507 1457 1410 1354 1320 1275 D IRvalue to be global 11555155 252710000 V0101 CalculateRlvoidl V0101 mainl t Enable gIObal InterrUpt InputlctenjtartInput14ttenlIIGHPOIJERJ InputAttenjAIN CRZ UNIS r K CmmEvz t REFLO to 2115101 0011005 I o D ecl a re bTe m u e to Bufferjtarc BufferHIGHPOBlERl BufferGMIlCR2 Dxlc s memect REFHI 00 141151057 501111012 1 be a global 8 bit variable 464mm ADCS5E014DCHIGHPOIJER3 Add LookUp table Inmmum I PERFORM LookUp Table Temperature Conversion The SteinhartHart equation requires using the floating point math library Floating point is slow and uses buckets more ROM compared to integer math An alternative is to use a look up table For any particular thermistor the manufacturer either supplies a RT conversion table or supplies the three SteinhartHart coefficients If only the coefficients are supplied a table can be generated from them This particular thermistor has a RT conversion table that suppHed llllllllr w CYPRESS o R M Create a Look Up Table Excel file ThermTablexs contains the 81 resistance values for temperature for 0 C to 80 C Calculate half values for 12 C to 79 12 C using the following equation Rn WRlnlRln1l 12 degrees are used for rounding Add the value zero at the end iii CYPRESS P E R F o R M 29 Create a Look Up Table These values are used to make an ROM array WThermTabe containing 81 values 153 cans unsigned int mThermTable J3154030255257752735525037247522359322453 J 2139920359194291552517570155501505515351 1455513995133721277712212115771115710552 J 10223 9754 9355 5959 5591 5230 7555 7550 7245 5951 5555 5395 5140 5593 5555 5434 5219 5015 4520 4533 4455 4254 4120 3954 3514 3571 3534 3403 3275 3157 3042 2932 2525 2725 2527 2534 2444 2359 2275 2197 2121 2045 1975 1911 1545 1753 1724 1555 1511 1555 1507 1457 1410 1354 1320 1275 0 LI PERFORM Add Code Control Loop In the Control Loop Set ADCMUX to P05 Run ADC Wait for data Place in NO Set ADCMUX to P01 Run ADC Wait for data Place in iV1 Set ADCMUX to P03 Run ADC Wait for data Place in NZ Calculate Resistance Display on LCD whlle 1 l A JUJXJ ADCMUXInputSelecn ADCMUXPORTEIS lDCGeSamples 1 whileADCfIaDataAvailableEI iVU ADCiClearFlagGetDataE ADCMUXInpuSe1ecc ADCMUXPORTU1 ADCGecSamples 1 mhlleADCfIaDaallvallablei0 1 Ni ADCiClearFlagGetDatal ADCllUXInputSelect ADCMUXPORTD3 ADCGetSamplea 1 whileADCfIaDaaAvailablei0 1V2 ADCiClearFlagGetDatal Calculate LCDFDsit10nDDj LCDFCStringEquot quotl LCDPoaltlonDDl ltoatpTemp lealue l i LCDPrStr1ng pTemp farthTempValue U unsigned intllealuellt mThermTablehTempValuebTempValueH LCDPoaiciDn1Dl LCDPrCStringquot quotl LCDPosi10n1U IEDEEPTEmp hTempValue 10 LCDPEStringpTemp PERFORM Add Code CalculateR If iVOltiV1 Open Circuit marina lealue 1 Else If iV1 lt iV2 Short Circuit iRvaIue O Else Calculate Resistance Add half denominator to numeratorto implement round off ivcid CalculateRvoidJ 7 ifliUD lt iUIJl lealuE l ElSE ifiiVl lt lealuE D ElSE lealue REEF lealuE i longitiVl iVZj lealue longlltiUU ivljgt1 lealue I lungltiVD iVl fOpen Circuit iVZJt f no negative resistance PERFORM Run Build the Project Record RAM and ROM Usage Download to the Eval board and run Using the look up table determine the temperature CYPRESS lllllllll quotll P E R F O RM Summary PSoC makes measure resistance a cost effective option Temperature can easily be measure using thermistor with the SteinhartHart equation or look up table iii CYPRESS P E R F O RM Questions CYPRESS qmllll llt


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Jennifer McGill UCSF Med School

"Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.