Line 1... |
Line 1... |
1 |
/**** IR Mrakomer3 ****/ |
1 |
/**** IR Mrakomer3 ****/ |
2 |
#define VERSION "3.0" |
2 |
#define VERSION "3.0" |
3 |
#define ID "$Id: irmrak3.c 919 2007-12-12 23:39:01Z kakl $" |
3 |
#define ID "$Id: irmrak3.c 928 2007-12-24 09:52:55Z kakl $" |
4 |
#include "irmrak3.h" |
4 |
#include "irmrak3.h" |
- |
|
5 |
#bit SSPM3=0x14.3 |
5 |
|
6 |
|
6 |
#define SA 0x00 // Slave Address (0 for single slave / 0x5A<<1 default) |
7 |
#define SA 0x00 // Slave Address (0 for single slave / 0x5A<<1 default) |
7 |
#define RAM_Access 0x00 // RAM access command |
8 |
#define RAM_Access 0x00 // RAM access command |
8 |
#define RAM_Tobj1 0x07 // To1 address in the eeprom |
9 |
#define RAM_Tobj1 0x07 // To1 address in the eeprom |
9 |
#define RAM_Tamb 0x06 // Ta address in the eeprom |
10 |
#define RAM_Tamb 0x06 // Ta address in the eeprom |
Line 125... |
Line 126... |
125 |
setup_timer_2(T2_DISABLED,0,1); |
126 |
setup_timer_2(T2_DISABLED,0,1); |
126 |
setup_comparator(NC_NC_NC_NC); |
127 |
setup_comparator(NC_NC_NC_NC); |
127 |
setup_vref(FALSE); |
128 |
setup_vref(FALSE); |
128 |
setup_oscillator(OSC_4MHZ|OSC_INTRC); |
129 |
setup_oscillator(OSC_4MHZ|OSC_INTRC); |
129 |
|
130 |
|
- |
|
131 |
// SSPM3=1; |
- |
|
132 |
|
130 |
delay_ms(1000); |
133 |
delay_ms(1000); |
131 |
printf("\n\r* Mrakomer %s (C) 2007 KAKL *\n\r",VER); // Welcome message |
134 |
printf("\n\r* Mrakomer %s (C) 2007 KAKL *\n\r",VER); // Welcome message |
132 |
printf("* %s *\n\r\n\r",REV); |
135 |
printf("* %s *\n\r\n\r",REV); |
133 |
tempa=ReadTemp(SA, RAM_Tamb); // Dummy read |
136 |
tempa=ReadTemp(SA, RAM_Tamb); // Dummy read |
134 |
temp=ReadTemp(SA, RAM_Tobj1); |
137 |
temp=ReadTemp(SA, RAM_Tobj1); |
Line 138... |
Line 141... |
138 |
|
141 |
|
139 |
while(TRUE) |
142 |
while(TRUE) |
140 |
{ |
143 |
{ |
141 |
n++; |
144 |
n++; |
142 |
|
145 |
|
- |
|
146 |
if (kbhit()) |
- |
|
147 |
{ |
- |
|
148 |
delay_ms(200); |
143 |
if (kbhit()) if ('w'==getc()) i=0; // Would you like warmer? |
149 |
if ('w'==getc()) i=0; // Would you like warmer? |
- |
|
150 |
} |
144 |
|
151 |
|
145 |
tempa=ReadTemp(SA, RAM_Tamb); // Read temperatures from sensor |
152 |
tempa=ReadTemp(SA, RAM_Tamb); // Read temperatures from sensor |
146 |
temp=ReadTemp(SA, RAM_Tobj1); |
153 |
temp=ReadTemp(SA, RAM_Tobj1); |
147 |
|
154 |
|
148 |
if((0==tempa)||(0==temp)) // Transfer error? |
155 |
if((0==tempa)||(0==temp)) // Transfer error? |