Question

1. Design a digital thermometer using PIC 16F877A microcontroller and suitable I/O devices. Your system should...

1. Design a digital thermometer using PIC 16F877A microcontroller and suitable I/O devices. Your system should display the temperature in both degree Celsius and degree Fahrenheit.

-> The simulation file and all other files needed to run the simulation.
-> The code of your PIC program. (mikroC PRO for PIC)
-> The compiled HEX file of the program. (mikroC PRO for PIC)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the code for digital; temp. using thermister temp. sensor.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#define DISPLAY_FREQ 25000
#define FLIP_DISP_FREQ 1000
#define BOUNCE_DELAY 200

#define LED_ON 0
#define LED_OFF 1

unsigned int CurrentTemp,SetPoint_High,SetPoint_Low;
unsigned int ADCVal=0;
unsigned int DisplayCount=0;

// Lcd pinout settings
sbit LCD_RS at RC5_bit;
//sbit LCD_CHECK at RD2_bit;
sbit LCD_EN at RC7_bit;

sbit LCD_D7 at RD7_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D4 at RD4_bit;


// Pin direction
sbit LCD_POWER at RB2_bit;

sbit LCD_POWER_Direction at TRISB2_bit;
sbit LCD_RS_Direction at TRISC5_bit;
//sbit LCD_CHECK_Direction at TRISD2_bit;
sbit LCD_EN_Direction at TRISC7_bit;

sbit LCD_D7_Direction at TRISD7_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD4_bit;


const code unsigned int Res_1[] = {
28160,
26920,
25760,
24650,
23600,
22600,
20740,
19870,
19050,
18270,
17510,
16800,
16120,
15470,
14850,
14260,
13700,
13160,
12640,
12160,
11680,
11230,
10800,
10390,
10000,
9624 ,
9265 ,
8921 ,
8591 ,
8276 ,
7973 ,
7684 ,
7406 ,
7140 ,
6885 ,
6641 ,
6406 ,
6181 ,
5965 ,
5758 ,
5559 ,
5368 ,
5185 ,
5008 ,
4839 ,
4676 ,
4520 ,
4370 ,
4225 ,
4086 ,
3953 ,
3824 ,
3700 ,
3581 ,
3467 ,
3356 ,
3250 ,
3147 ,
3049 ,
2954 ,
2862 ,
2774 ,
2689 ,
2607 ,
2528 ,
2451 ,
2378 ,
2306 ,
2238 ,
2172 ,
2108 ,
2046 ,
1986 ,
1929 ,
1873 ,
1820 ,
1768 ,
1717 ,
1669 ,
1622 ,
1577 ,
1533 ,
1490 ,
1449 ,
1410 ,
1371 ,
1334 ,
1298 ,
1263 ,
1229 ,
1197 ,
1165 ,
1134 ,
1105 ,
1076 ,
1048 ,
1021 ,
995 ,
969 ,
945 ,
};

void MakeLCDOff(void)
{
Lcd_Cmd(_LCD_CLEAR); // Clear display
LCD_POWER=0;
}

unsigned int LCDDisplayCount=0;
void MakeLCDON(void)
{
LCD_POWER=1;
LCDDisplayCount=0;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
}

void main(void)
{
unsigned int TempChar,FinalTemperature,TResistance,Tempt=0,FlipDispCount=0,dCnt=0,Flag=1;
unsigned long Temp,Qt,Rem,Tr;
TRISE = 0x00;
TRISD=0x00;
TRISC=0x00;
TRISB = 0x03;
TRISA = 0x0F;
ADC_Init();
LCD_POWER=1;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off


DisplayCount=DISPLAY_FREQ;

while(1)
{
Temp = ADC_Read(0);
Qt = ((Temp *10)/(1024 - Temp))*1000;
Rem = (Temp *10)%(1024 - Temp);
Tr = Qt + Rem;
Lcd_Out(1,1,"TEMP. = C");

for(dCnt=0;(dCnt < 99 && Flag==1);dCnt=dCnt+1)
{
if(Flag==1 && Tr > Res_1[dCnt+1] && Tr <= Res_1[dCnt])
{
Flag=0;
FinalTemperature = dCnt+1;
}
}
TempChar = 0x30 + (FinalTemperature/10); Lcd_Chr(1,13,TempChar);
TempChar = 0x30 + (FinalTemperature%10); Lcd_Chr(1,14,TempChar);
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Hex File:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

:020000004D2B86
:080006000000000000000800EA
:10000E00163083120313FC006C30FD00FD0B0D281F
:08001E00FC0B0D280000080096
:10002600313083120313FD00FD0B1728000000007A
:020036000800C0
:1000380083120313D61B2228881323288817561BDC
:100048002728081328280817D61A2C2888122D289C
:100058008816561A31280812322808162718362802
:10006800871637288712871703208713D6193E2843
:1000780088133F2888175619432808134428081757
:10008800D618482888124928881656184D28081264
:100098004E280816271852288716532887128717BC
:1000A80003208713271C5A2807205B2813200800E1
:0E00B8008312031329088A002808820008001A
:1000C600153083120313FD00FD0B672800000000A6
:0200D600080020
:1000D8008312031327105508D6001C202714080084
:1000E80083120313FB01FA01F901F801A001730D52
:1000F800F80D7408F8027508031C750FF9027608E4
:10010800031C760FFA027708031C770FFB02000125
:10011800031C0130A002F30D0730FC00730DF80D2D
:10012800F90DFA0DFB0DA00D7408731CAD28F8022B
:100138007508031C750FF9027608031C760FFA027E
:100148007708031C770FFB020001031C0130A00293
:10015800BE28F80775080318750FF90776080318FD
:10016800760FFA0777080318770FFB0700010318C3
:100178000130A007F30DFC0B9228720DF80DF90D54
:10018800FA0DFB0DA00D7408731CDC28F802750825
:10019800031C750FF9027608031C760FFA0277081C
:1001A800031C770FFB020001031C0130A002ED289D
:1001B800F80775080318750FF90776080318760FFE
:1001C800FA0777080318770FFB07000103180130B7
:1001D800A007F20D0730FC00720DF80DF90DFA0DAD
:1001E800FB0DA00D7408721C0B29F8027508031C7E
:1001F800750FF9027608031C760FFA027708031CBC
:10020800770FFB020001031C0130A0021C29F8072C
:1002180075080318750FF90776080318760FFA079B
:1002280077080318770FFB07000103180130A007B0
:10023800F20DFC0BF028710DF80DF90DFA0DFB0D00
:10024800A00D7408721C3A29F8027508031C750F72
:10025800F9027608031C760FFA027708031C770F59
:10026800FB020001031C0130A0024B29F8077508A6
:100278000318750FF90776080318760FFA07770839
:100288000318770FFB07000103180130A007F10DD1
:100298000730FC00710DF80DF90DFA0DFB0DA00DDE
:1002A8007408711C6929F8027508031C750FF90296
:1002B8007608031C760FFA027708031C770FFB02F7
:1002C8000001031C0130A0027A29F80775080318F9
:1002D800750FF90776080318760FFA0777080318D9
:1002E800770FFB07000103180130A007F10DFC0B85
:1002F8004E29700DF80DF90DFA0DFB0DA00D7408BF
:10030800711C9829F8027508031C750FF902760804
:10031800031C760FFA027708031C770FFB02000113
:10032800031C0130A002A929F80775080318750FE6
:10033800F90776080318760FFA0777080318770F76
:10034800FB07000103180130A007F00D0730FC007F
:10035800700DF80DF90DFA0DFB0DA00D7408701C49
:10036800C729F8027508031C750FF9027608031CE3
:10037800760FFA027708031C770FFB020001031CB3
:100388000130A002D829F80775080318750FF90776
:1003980076080318760FFA0777080318770FFB0714
:1003A800000103180130A007F00DFC0BAC297018F0
:1003B800EB297408F80775080318750FF90776080C
:1003C8000318760FFA0777080318770FFB0708005A
:1003D80083160313871387120812881208138813C9
:1003E80083128713871288130813881208120720AC
:1003F8000720072088160816871703208713072069
:1004080087170320871307208717032087130720E0
:1004180008128717032087130720871703208713DD
:100428008812881787170320871307208813081650
:1004380087170320871308128717032087130720BD
:1004480087170320871308168717032087130720A9
:1004580008128717032087138817081788160816A5
:0C046800871703208713072027140800C3
:1004740083120313F801F9011030FC00710DF80D1B
:10048400F90D7408F8027508031C750FF9020318B6
:10049400522A7408F80775080318750FF907031032
:0A04A400F00DF10DFC0B402A0800DA
:1004AE00831203132230FC00F801F901FA01FB015B
:1004BE00FC0303198D2A0310FB0CFA0CF90CF80C33
:1004CE00F30CF20CF10CF00C031C5F2AFC03031965
:1004DE007F2A7408F80775080318750FF907760850
:1004EE000318760FFA0777080318770FFB07632AAE
:1004FE007408F80775080318750FF90776080318BE
:0E050E00760FFA0777080318770FFB0708002F
:10051C005C208A110A128000840AA80A0319A90A0D
:08052C00F003031D8E2A0800F4
:10053400AC2A803083120313D100BF2AC030D1000B
:10054400BF2A9430D100BF2AD430D100BF2A8030D2
:10055400D100BF2A831203135108013A03199B2ABD
:100564005108023A0319A02A5108033A0319A32A8D
:100574005108043A0319A62AA92A5203F000510883
:10058400F0077008D10027147008D6001C2027102B
:0A0594005308D6001C2027140800AD
:10059E00E12A803083120313D100F42AC030D10037
:1005AE00F42A9430D100F42AD430D100F42A8030C9
:1005BE00D100F42A831203135108013A0319D02AE9
:1005CE005108023A0319D52A5108033A0319D82AB9
:1005DE005108043A0319DB2ADE2A5203F0005108AF
:1005EE00F0077008D1007008D6001C202710D40127
:1005FE00540853078400000803190D2B54085307A1
:10060E0084000008D5006C20D40AFF2A27140800A5
:10061E00FF3083120313A400FF30A500FF30A600A5
:10062E00FF309F01C0309F042309F000700883162D
:0C063E009F051F179F1783121F14080050
:10064A00831203139F01C0309F042309F00070082E
:10065A0083169F051F179F1783125108F000F00D8C
:10066A007010F00D7010F00D701070089F041F14B8
:10067A0063201F151F1D432B00003F2B1F101E0850
:10068A00F100F00183161E08F0040030F10408009E
:10069A009C2583120313C101C2010130C30000303B
:1006AA00C4008316890188018701033086000F3050
:1006BA0085000F230615EC210130D6001C200C30D2
:1006CA00D6001C20A830A1006130A200D101252348
:1006DA0070088312AC007108AD00AE01AF012C089E
:1006EA00F0002D08F1002E08F2002F08F3000A305E
:1006FA00F400F501F601F70157227008CD007108E0
:10070A00CE007208CF007308D0000030F000043029
:10071A00F100F201F3017008C9007108CA007208F9
:10072A00CB007308CC002C08C9022D08031C2D0F1E
:10073A00CA022E08031C2E0FCB022F08031C2F0FF0
:10074A00CC024908F4004A08F5004B08F6004C08A8
:10075A00F7004D08F0004E08F1004F08F20050086B
:10076A00F3007420E830F4000330F500F601F701D5
:10077A0057227008C5007108C6007208C7007308BE
:10078A00C8004908F4004A08F5004B08F6004C086E
:10079A00F7004D08F0004E08F1004F08F20050082B
:1007AA00F30074207808F0007908F1007A08F20062
:1007BA007B08F3004508B0004608B1004708B200BC
:1007CA004808B3007008B00771080318710FB10721
:1007DA0072080318720FB20773080318730FB3076E
:1007EA000130D1000130D2005430B4004530B50098
:1007FA004D30B6005030B7002E30B8002030B90066
:10080A003D30BA002030BB002030BC002030BD0093
:10081A002030BE004330BF00C0013430D300CF22A5
:10082A00C101C20100304202031D1D2C6330410286
:10083A0003189D2C00304406031D252C0130430665
:10084A00031D9D2C00304406031D2D2C0130430648
:10085A00031D992C4108013EF30000300318013EA4
:10086A004207F4007308F0007408F100F00DF10D6E
:10087A007010D030F00704300318013EF1077008F9
:10088A00A8007108A9005C208A110A12F200A80ABD
:10089A000319A90A5C208A110A12F3003308003CE2
:1008AA00031D612C3208003C031D612C31087302C0
:1008BA00031D612C300872020318992C4108F000BC
:1008CA004208F100F00DF10D7010D030F00704303D
:1008DA000318013EF1077008A8007108A9005C20FE
:1008EA008A110A12F200A80A0319A90A5C208A11BD
:1008FA000A12F3003308003C031D8D2C3208003C19
:10090A00031D8D2C31087302031D8D2C30087202D1
:10091A00031C992CC301C4014108013EAA000030FE
:10092A000318013E4207AB00C10A0319C20A172C79
:10093A000A30F4000030F5002A08F0002B08F10014
:10094A003A223030F0070318F10A0130D1000D3095
:10095A00D2007008D3009A220A30F4000030F50061
:10096A002A08F0002B08F1003A227808F0007908EA
:10097A00F1003030F0070318F10A0130D1000E30CF
:0C098A00D2007008D3009A226B2BCA2CFC
:100B380021308400033083120313F0009830A8009A
:080B48000530A9008E2208000F
:1009A00000346E3428346934A03464344A346034FA
:1009B00030345C3448345834043451349E344D342B
:1009C0006A344A345E34473466344434A0344134A3
:1009D000F8343E346E343C3402343A34B434373470
:1009E00084343534683433346034313480342F34D3
:1009F000A0342D34DE342B3430342A349634283469
:100A0000103427349834253431342434D934223402
:100A10008F3421345434203425341F3404341E34AC
:100A2000EE341C34E4341B34E5341A34F134193414
:100A300006341934253418344D3417347E341634C2
:100A4000B7341534F8341434413414349034133436
:100A5000E734123444341234A834113412341134CB
:100A600081341034F6340F3471340F34F0340E34D2
:100A700074340E34FD340D348B340D341C340D3489
:100A8000B2340C344B340C34E9340B348A340B3428
:100A90002E340B34D6340A3481340A342F340A34D9
:100AA000E0340934933409344A34093402340934C3
:100AB000BE3408347C3408343C340834FE34073403
:100AC000C234073489340734513407341C340734B2
:100AD000E8340634B53406348534063456340634E6
:100AE00029340634FD340534D2340534A9340534B0
:100AF000823405345B34053436340534123405341D
:100B0000EF340434CD340434AD3404348D3404343F
:100B10006E3404345134043434340434183404341A
:100B2000FD340334E3340334C9340334B1340334BF
:040B30000034003459
:020B34000F347C
:02400E004A2F37
:00000001FF
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Add a comment
Know the answer?
Add Answer to:
1. Design a digital thermometer using PIC 16F877A microcontroller and suitable I/O devices. Your system should...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Design a way of using the pushbutton to trigger an interrupt to your system. Your system,...

    Design a way of using the pushbutton to trigger an interrupt to your system. Your system, upon receiving this interrupt, responds by reading and displaying the temperature in Fahrenheit degrees on the LCD display in the format of xxx.x. The system must resume displaying the digital clock. Build your circuit and include all the required information about your hardware design in your lab report. 4. Based on the hardware you designed, choose an interrupt/timer tool from mbed to update the...

  • design a C program to control the stock of books of a small bookstore. Part 1:...

    design a C program to control the stock of books of a small bookstore. Part 1: for the cout, it should be printf(" "); should write like that When a client orders a book, the system should check if the bookstore has the book in stock. If the bookstore keeps the title and there is enough stock for the order, the system should inform the price per copy to the client, as well as the total price of the purchase....

  • Question2 uses structured design implemented in C. Array of records (structs) with file I/O is needed....

    Question2 uses structured design implemented in C. Array of records (structs) with file I/O is needed. The program takes two inputs at a time. The name of a person, and, the coin value as an integer in the range 5 to 95. Input coin values should always be divisible by 5 (integer division). Names are one word strings. An example input is: Jane 30 This input line indicates that 30 cents change is to be given to Jane. Output change...

  • I need help using python ( spyder) only use files , loops if needed is statement do not use , def...

    i need help using python ( spyder) only use files , loops if needed is statement do not use , def function or any other. Exercise 1: Daily temperature is recorded for some weeks in files (templ.txt", temp2.txt, and temp3.txt; provided in the MOODLE). The first line contains number of weeks and the rest of the lines each represent the week number followed by temperature on the seven days of that week (see samples input files below). Write a python...

  • just the extra credit part please Your customer needs an automated system to patrol the highways....

    just the extra credit part please Your customer needs an automated system to patrol the highways. The job of the system is to collect the following information on vehicles traveling down a certain stretch of highway: license plate number, current speed, and speed limit. A program is required to determine if a speeding ticket is needed for each set of data. Ticket will only be issued when number of miles per hours (mph) over the speed limit is at least...

  • Option 1: Authentication System For security-minded professionals, it is important that only the appropriate people gain...

    Option 1: Authentication System For security-minded professionals, it is important that only the appropriate people gain access to data in a computer system. This is called authentication. Once users gain entry, it is also important that they only see data related to their role in a computer system. This is called authorization. For the zoo, you will develop an authentication system that manages both authentication and authorization. You have been given a credentials file that contains credential information for authorized...

  • 1 Objective Build a hashing algorithm that is suitable for use in a Bloom Filter. Please...

    1 Objective Build a hashing algorithm that is suitable for use in a Bloom Filter. Please note that while a cryptographic hash is quite common in many Bloom Filters, the hashing algorithm to be implemented is a mix of the the following algorithmic models, specifically, a multiply & rotate hash colloquially known as a murmur hash, and an AND, rolale, & XOR hash colloquially known as an ARX hash. 2 Requirements • Inputs. Read the input file which contains strings...

  • C++ -- Event processing simulation using a transaction queue Hi! it is queue simulation please read...

    C++ -- Event processing simulation using a transaction queue Hi! it is queue simulation please read the instructions, write codes, and explain the code with comments. Thank you Transactions enter the system and are stored in a queue. Each transaction represents some work that needs to be accomplished. Servers exist which process transactions. Servers take transactions off the queue and process them. you’re building the simulation framework. The idea is that somebody would take your framework, and add the specifics...

  • 1 Overview The goal of this assignment is to help you understand caches better. You are...

    1 Overview The goal of this assignment is to help you understand caches better. You are required to write a cache simulator using the C programming language. The programs have to run on iLab machines. We are providing real program memory traces as input to your cache simulator. The format and structure of the memory traces are described below. We will not give you improperly formatted files. You can assume all your input files will be in proper format as...

  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT