/Designs/Thermometer/SW/1wire.c
0,0 → 1,43
 
void onewire_reset()
{
output_low(ONE_WIRE_PIN);
delay_us(500);
output_float(ONE_WIRE_PIN);
delay_us(500);
output_float(ONE_WIRE_PIN);
}
 
 
void onewire_write(int data)
{
int count;
 
for (count=0; count<8; ++count)
{
output_low(ONE_WIRE_PIN);
delay_us( 2 );
output_bit(ONE_WIRE_PIN, shift_right(&data,1,1));
 
delay_us( 60 );
output_float(ONE_WIRE_PIN);
delay_us( 2 );
}
}
 
 
int onewire_read()
{
int count, data;
 
for (count=0; count<8; ++count)
{
output_low(ONE_WIRE_PIN);
delay_us( 2 );
output_float(ONE_WIRE_PIN);
delay_us( 8 );
shift_right(&data,1,input(ONE_WIRE_PIN));
delay_us( 120 );
}
return( data );
}
/Designs/Thermometer/SW/ds1820.c
0,0 → 1,25
#include "1wire.c"
 
float ds1820_read()
{
int8 busy=0, temp1, temp2;
signed int16 temp3;
float result;
 
onewire_reset();
onewire_write(0xCC);
onewire_write(0x44);
 
while (busy == 0) busy = onewire_read();
 
onewire_reset();
onewire_write(0xCC);
onewire_write(0xBE);
temp1 = onewire_read();
temp2 = onewire_read();
temp3 = make16(temp2, temp1);
 
result = (float) temp3 / 16.0; //calculation pro DS18B20 with 0.1 deg C
 
return(result);
}
/Designs/Thermometer/SW/macro.ini
--- Thermometer/SW/main.c (nonexistent)
+++ Thermometer/SW/main.c (revision 1944)
@@ -0,0 +1,39 @@
+#include "D:\MLAB\Designs\Thermometer\SW\main.h"
+
+#define LCD_ENABLE_PIN PIN_E0 ////
+#define LCD_RS_PIN PIN_E1 ////
+#define LCD_RW_PIN PIN_E2 ////
+#define LCD_DATA4 PIN_D4 ////
+#define LCD_DATA5 PIN_D5 ////
+#define LCD_DATA6 PIN_D6 ////
+#define LCD_DATA7 PIN_D7
+#include <lcd.c>
+
+#define ONE_WIRE_PIN PIN_C6
+#include "ds1820.c"
+
+void main()
+{
+ setup_adc_ports(NO_ANALOGS);
+ setup_adc(ADC_CLOCK_DIV_2);
+ setup_psp(PSP_DISABLED);
+ setup_spi(SPI_SS_DISABLED);
+ setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
+ setup_timer_1(T1_DISABLED);
+ setup_timer_2(T2_DISABLED,0,1);
+ setup_ccp1(CCP_OFF);
+ setup_comparator(NC_NC_NC_NC);
+ setup_vref(FALSE);
+
+ lcd_init();
+
+ lcd_putc("\fReady...\n");
+
+
+ while (TRUE)
+ {
+ lcd_gotoxy(1,2);
+ printf(lcd_putc,"T: %f K ",ds1820_read()+273.15);
+ Delay_ms(100);
+ }
+}
/Designs/Thermometer/SW/main.h
0,0 → 1,15
#include <16F877A.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOPUT //No Power Up Timer
#FUSES NOPROTECT //Code not protected from reading
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOBROWNOUT //No brownout reset
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
 
#use delay(clock=20000000)
 
/Designs/Thermometer/SW/main.hex
0,0 → 1,239
:1000000006308A009B2E00000A108A100A1182070F
:1000100028340C34013406340C29E530E43C2E1726
:100020002E050000541DA01266104B102000353024
:1000300084008313000803192A280630F800F7010A
:10004000F70B2028F80B1F287B30F700F70B26282A
:10005000800B1D2808003C182F280812302808168D
:10006000831608128312BC1837288812382888167D
:100070008316881283123C193F280813402808175A
:10008000831608138312BC19472888134828881739
:100090008316881300008312091483160910033095
:1000A000F700F70B512883120910831609108312E9
:1000B0000800BD018316081600308312081A0130AB
:1000C000BD048316881600308312881A0130F700A9
:1000D0000310F70D7708BD0483160817003083124C
:1000E000081B0130F700F70DF70DFC30F705770816
:1000F000BD048316881700308312881B0130F70077
:10010000F70DF70DF70DF830F7057708BD043D083A
:10011000F80008008316091089100911831289104C
:100120008316891008168816081788178312091570
:1001300083160911000083120914831609100000A8
:10014000831259207808BC0009108316091000009A
:100150008312091483160910AD28AE2800008312FB
:1001600059207808BB00091083160910081288125C
:100170000813881383123C0EF700F030F705770858
:100180003B04F8007808BB00BB1FC82883169228E0
:10019000B908031DCD288910CE288914831689102B
:1001A000000083120911831609110000831209103F
:1001B0008316091083123A0EBB000F30BB053B08B3
:1001C000BC002B203A080F39BB00BC002B200800D4
:1001D0008316081288120813881309108910091150
:1001E000831289108316891083120911831609114D
:1001F00083120910831609100F308312B5001720DF
:100200000130A1002108033C031C0E290330BC006F
:100210002B200530B5001720A10A02290230BC00AE
:100220002B20A1012108033C031C1F2921080420C5
:10023000A200B9012208BA008A20A10A12298A1153
:100240000A12F22E360B252928294030B700292919
:10025000B70101303502B70737088038B800B90157
:100260003808BA008A2008003408073A03194229DE
:100270000B3A03194729063A03194F29023A031981
:1002800055295A290130B500B60022216029B9014B
:100290000130BA008A200230B500172060290130F1
:1002A000B5000230B60022216029B9011030BA0031
:1002B0008A2060290130B9003408BA008A206029F8
:1002C0000800831603178C170C140000000083121B
:1002D0000C087F390319A5290313A10003170D0882
:1002E0000313A20003170F080313A3002108B4008F
:1002F0003421220803178D000313230803178F00EE
:1003000083168C170C140000000083120C0D0E0DC8
:100310007F390319A5290313A10003170D0803133F
:10032000A20003170F080313A3002108B40034210F
:10033000220803178D000313230803178F008D0A6B
:1003400003198F0A03136129031703138A110A1271
:10035000F92E0330AB02031CB7292B308400831322
:1003600000080319B729B529B529800BB42908005D
:100370002013200883168700831207130230AA0077
:10038000F930AB00A921AA0BC02920172008831639
:10039000870002308312AA00F930AB00A921AA0B12
:1003A000CC29201720088316870083120800AB0190
:1003B0002B08073C031C022A201320088316870001
:1003C000831207130330F700F70BE4290314AA0C78
:1003D0000318EC290713ED290717201320088316AB
:1003E00087006330F700F70BF329F62983122017F3
:1003F0002008831687000330F700F70BFD298312CE
:10040000AB0AD8290800AA012A08073C031C2D2A98
:100410002013200883168700831207130330F70088
:10042000F70B102A20172008831687000D30F700DD
:10043000F70B182A831220172008831687008312CF
:10044000071B242A0310252A0314AB0CC730F7001E
:10045000F70B282A2B2AAA0A042A2B08F8000800DE
:10046000A101B821CC30AA00D7214430AA00D7215D
:10047000A108031D3F2A03227808A100382AB821C9
:10048000CC30AA00D721BE30AA00D7210322780899
:10049000A20003227808A3002308A5002208A400D4
:1004A0002508AB002408AA008E30F7002B08F800BE
:1004B0002A08F900FA01AB1F622AF809F909F90ABA
:1004C0000319F80AF808031D6F2A7908F800F901E2
:1004D0000830F702F808031D6F2AF701782A031085
:1004E000F81B762AF90DF80DF7036F2AAB1FF813E6
:1004F0007708AA007808AB007908AC007A08AD004C
:100500002D08B1002C08B0002B08AF002A08AE005F
:10051000B501B401B3018330B2002E080319522B88
:10052000BA0032080319522BBA02031C9C2A7F30EE
:10053000BA070318522BA22A8130BA02031C522B8D
:100540000319522B3A08F700F801F901FA01B90131
:100550002F08B800B8173008B7003108B6001930B6
:10056000BA003508B6020318C52A0130B7020318CD
:10057000C52AB8020318C52AB9020318C52AB90A40
:10058000B80AB70A3508B607F72A3408B7020318BD
:10059000E02A0130B8020318E02AB9020318E02A61
:1005A000B90AB80A3408B7073508B607031CF72A92
:1005B000B70A031DF72AB80A031DF72AB90AF72A52
:1005C00033088038B8020318F62A0130B90203183C
:1005D000F62AB90A33088038B8073408B707031C6D
:1005E000D42AB80A031DD42AB90AD42A7A14BA0B19
:1005F000FA2A052B0310B60DB70DB80DB90D03106F
:10060000FA0DF90DF80DBB0DB12A3B1C0D2B031093
:10061000F80CF90CFA0CBB0C102BF7030319522B36
:10062000BB1B392B0310B60DB70DB80DB90D35082E
:10063000B6020318252B0130B7020318252BB80288
:100640000318252BB902031C482B3408B7020318E2
:10065000302B0130B8020318302BB902031C482B91
:1006600033088038B8020318392B0130B902031C53
:10067000482BFA0A031D482BF90A031D482BF80AD8
:10068000031D482BF70A0319522BF80CF90CFA0C2E
:100690002F08BA003308BA06BA1F502BF817562B8A
:1006A000F813562BF701F801F901FA017A08A900AD
:1006B0007908A8007808A7007708A6002608F700A0
:1006C0002708F8002808F9002908FA008A110A12F8
:1006D000FF2E80308318AC06B101B2012808B000AB
:1006E0002C08B00627080319592CAF00F7002B0877
:1006F0000319622CAF020319FE2B031CBC2B2C0820
:10070000B500B5172D08B4002E08B300B2010310D0
:10071000B50CB40CB30CB20CAF0B862BB01F932BE3
:100720003114762C31102F1031162A3084008313A7
:100730008B2C3112B01BA62B2F1CB12BB50CB40C7B
:10074000B30CB20CF70A0319712CB12BB51BB42BE7
:100750000310B20DB30DB40DB50DF7030319712CD1
:10076000A62B31171E2C31132808B000B01FBA2B4E
:10077000B5176A2CB5136A2C2B08AF00F7002708B1
:10078000AF022808B500B5172908B4002A08B3003D
:10079000B2010310B50CB40CB30CB20CAF0BC82BE8
:1007A000B01FD52BB114762CB1102F10B1162E30EE
:1007B000840083138B2CB112B01BE82B2F1CF32B5E
:1007C000B50CB40CB30CB20CF70A0319712CF32B53
:1007D000B51BF62B0310B20DB30DB40DB50DF70319
:1007E0000319712CE82BB1171E2CB1132C08B00083
:1007F000B01FFC2BB5176A2CB5136A2C2C08B5005A
:10080000B5172D08B4002E08B300B01F0B2CB5137C
:100810003115762C3111B2012F102A308400831348
:100820008B2CB01B342C2808B0002F1C1E2CB50CB0
:10083000B40CB30CB20CF70A0319712CB21F2F2C95
:10084000B30A031D2F2CB40A031D2F2CB50A031D58
:100850002F2CB50CB40CB30CF70A0319712C311BF7
:10086000B32BB11BF52B532C8030B506B51F3C2C98
:10087000762C2C08B000492C2808B000B508031DC0
:10088000492CB408031D492CB308031D492CF7015A
:100890006A2CB51B532C0310B20DB30DB40DB50D5E
:1008A000F70B492C712CB01F572CB5176A2CB513B8
:1008B0006A2C2B08F7002C08B5002D08B4002E0870
:1008C000B3006A2C2708F7002808B5002908B400EF
:1008D0002A08B3003508F8003408F9003308FA0094
:1008E000A92CF701F801F901FA01A92CB201B30909
:1008F000B409B509B209B20A031D842CB30A031D59
:10090000842CB40A0319B50A3118922BB118D42BD0
:1009100031190A2C392C0008B307031C952CB40A92
:10092000031D952CB50A03192F1484030008B4077E
:10093000031C9D2CB50A03192F1484030008801F83
:10094000803AB50703182F14311A992BB11ADB2BF3
:10095000112C8A110A121F2FF701F801F901FA016F
:10096000BC01BD01BE01BF013B083A043904380493
:100970000319EA2C2030C0000310B40DB50DB60DDC
:10098000B70DBC0DBD0DBE0DBF0D3B083F02031DD5
:10099000D32C3A083E02031DD32C39083D02031D17
:1009A000D32C38083C02031CE42C3808BC0239085C
:1009B000031C390FBD023A08031C3A0FBE023B0864
:1009C000031C3B0FBF020314F70DF80DF90DFA0DD0
:1009D000C00BBC2C3C308400831308000408AC001E
:1009E0002B08AE000319802D2A08B7002908B6008D
:1009F0002808B5002708B400BB01BA012030B900AF
:100A00008230B80034080319722DBC00380803196D
:100A1000722DBC070318132D7F30BC02031C722DEE
:100A20000319722D172D8130BC070318722D3C0855
:100A3000F700F801F901FA013508C000C0173608BF
:100A4000BF003708BE001830BC00BD013E1C402D61
:100A50003B08FA07031C322DF90A031D322DF80A50
:100A60000319BD173A08F907031C392DF80A0319B1
:100A7000BD173908B600B6173608F8070318BD17B2
:100A8000BD0DF80CF90CFA0CC00CBF0CBE0C031019
:100A9000BC0B252D0130F7070318722DF81B572DBD
:100AA000C00DFA0DF90DF80DF7030319722DC01FD3
:100AB000682DFA0A031D682DF90A031D682DF80A2E
:100AC000031D682DF80CF90CFA0CF70A0319722DA6
:100AD0003508BD003908BD06BD1F702DF817762DED
:100AE000F813762DF701F801F901FA017A08AA0046
:100AF0007908A9007808A8007708A700AE0BF42CA5
:100B00002A08B7002908B6002808B5002708B4004D
:100B10003408B63CB400FA013508B800B517031024
:100B2000B50CB60CB70CFA0CF90CF80CF70CB40BAE
:100B30008F2DB81FA62DF709F809F909FA09F70A48
:100B40000319F80A0319F90A0319FA0A7A08AA001C
:100B50007908A9007808A8007708A700AA1FBD2D6A
:100B6000AC03AC16A709A809A909AA09A70A031981
:100B7000A80A0319A90A0319AA0A3B30B3009A303C
:100B8000B200CA30B100B0010A30AE002B08031920
:100B9000AC0A2A08B7002908B6002808B5002708BB
:100BA000B4003308BB003208BA003108B90030087D
:100BB000B800AC240008A700840A0008A800840A32
:100BC0000008A900840A0008AA00FD308407F7087D
:100BD000031DFD2D2B0A2E020319FD2D2C080319D0
:100BE000FF2D0F392E020319F72D03182F2EAC1BE2
:100BF0002F2E2C1BFF2D20302B2E2030AC05AC1EB1
:100C00000D2EAC122B08031DAC037708AC002D3061
:100C1000B40034212C08F700AC012B082E02031D70
:100C20001B2E7708AC002E30B40034212C08F700BE
:100C30002030AC0500303030AC1E2B2EAC122B080F
:100C4000031DAC037708AC002D30B40034212C0810
:100C5000F700AC013030F7077708B40034213308CF
:100C6000B7003208B6003108B5003008B400BB0147
:100C7000BA01B9010A30B800AC247A08B300790887
:100C8000B2007808B1007708B000AE0BC92D8A1108
:100C90000A12422F831603178C170C140000000051
:100CA0000318792E83120C087F390313A800031749
:100CB0000D080313A90003170F080313AA0028083F
:100CC000B4003421290803178D0003132A080317E1
:100CD0008F0083168C170C1400000000831203137E
:100CE000A70B732E762E83160317792E982E831654
:100CF000031783120C0D0E0D7F390313A800031781
:100D00000D080313A90003170F080313AA002808EE
:100D1000B4003421290803178D0003132A08031790
:100D20008F008D0A03198F0A03100313A70B4A2E95
:100D30008A110A124C2F840183131F3083058316F6
:100D40001F149F141F159F1107309C00FF30831242
:100D5000A00083161F149F141F159F111F138312C9
:100D60001F139F1383169F1383121F1483160912D8
:100D700083129412A0122008831687008312201673
:100D80002008831687008312A0112008831687008D
:100D90000130831294000030831694000108C73993
:100DA00008388100831290010030F8009200003072
:100DB0008316920083122015200883168700831261
:100DC0009701073083169C00050885001030F70056
:100DD000F70BE82E00001C0883120D1383169D01EB
:100DE0008312E8280C3003178D0000308F000313A6
:100DF00061290130B5000230B6002221302A77087F
:100E0000A1007808A2007908A3007A08A400A6012E
:100E10000408A5002610831B261483107A08AA0054
:100E20007908A9007808A8007708A7003330AE0039
:100E30009330AD000830AC008730AB00692B25083B
:100E400084008313261883177708A1007808A2006E
:100E50007908A3007A08A4005430B40034213A3051
:100E6000B40034212030B4003421893084002408B7
:100E7000AA002308A9002208A8002108A700023020
:100E8000AB00EE2C143003178D0000308F000314DC
:100E900004300313A7004A2E6430B5001720F92E42
:020EA0006300ED
:02400E003A3F37
:00000001FF
;PIC16F877A
;CRC=6654 CREATED="18-IV-11 15:47"
/Designs/Thermometer/SW/main.pjt
0,0 → 1,33
[PROJECT]
Target=D:\MLAB\Designs\Thermometer\SW\main.hex
Development_Mode=
Processor_Text=PIC16F877A
ToolSuite=CCS
Processor=0x877A
[D:\MLAB\Designs\Thermometer\SW\main]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
[mru-list]
1=D:\MLAB\Designs\Thermometer\SW\main.c
[Windows]
0=0000 %S 0 0 796 451 3 0
[Opened Files]
1=main.c
2=..\..\..\Modules\TDC\GP201A\SW\PICinterface\main.c
3=main.h
4=C:\Program Files\PICC\devices\16F877A.h
5=C:\Program Files\PICC\drivers\lcd.c
6=ds1820.c
7=1wire.c
8=..\..\Tools\reflow2\SW\reflow.c
9=
[Target Data]
OptionString=-p +FM
FileList=D:\MLAB\Designs\Thermometer\SW\main.c
[Units]
Count=1
1=main (main)