o: ActiveSupport::Cache::Entry :@compressedF:@value"Ä+"¾+
| main.c | ||
|---|---|---|
| 6 | 6 |
|
| 7 | 7 |
#CASE // Case sensitive compiler |
| 8 | 8 |
|
| 9 |
#define LCD_ENABLE_PIN PIN_E0 //// |
|
| 9 |
/*#define LCD_ENABLE_PIN PIN_E0 ////
|
|
| 10 | 10 |
#define LCD_RS_PIN PIN_E1 //// |
| 11 | 11 |
#define LCD_RW_PIN PIN_E2 //// |
| 12 | 12 |
#define LCD_DATA4 PIN_D4 //// |
| ... | ... | |
| 14 | 14 |
#define LCD_DATA6 PIN_D6 //// |
| 15 | 15 |
#define LCD_DATA7 PIN_D7 |
| 16 | 16 |
#include <lcd.c> |
| 17 |
|
|
| 17 |
*/ |
|
| 18 | 18 |
#define SEND_DELAY 50 // Time between two characters on RS232 |
| 19 | 19 |
|
| 20 | 20 |
char VER[4]=VERSION; // Buffer for concatenate of a version string |
| ... | ... | |
| 22 | 22 |
#define ONE_WIRE_PIN PIN_C7 |
| 23 | 23 |
#include "..\ds1820.c" |
| 24 | 24 |
|
| 25 |
#include "..\SHT.c" |
|
| 26 |
|
|
| 27 |
|
|
| 25 | 28 |
void welcome(void) // Welcome message |
| 26 | 29 |
{
|
| 27 | 30 |
char REV[50]=ID; // Buffer for concatenate of a version string |
| ... | ... | |
| 68 | 71 |
lcd_putc("www.mlab.cz");
|
| 69 | 72 |
Delay_ms(2000); |
| 70 | 73 |
*/ |
| 74 |
|
|
| 75 |
sht_init(); |
|
| 76 |
|
|
| 71 | 77 |
while (TRUE) |
| 72 | 78 |
{
|
| 73 |
lcd_gotoxy(1,2); |
|
| 79 |
char output[8]; // Output buffer |
|
| 80 |
int8 j; // String pointer |
|
| 81 |
int8 check=0; // Checksum is calculated between '$' and '*' |
|
| 82 |
float SHT_temp,SHT_hum; |
|
| 83 |
|
|
| 84 |
|
|
| 85 |
// lcd_gotoxy(1,2); |
|
| 74 | 86 |
// printf(lcd_putc,"T: %f K ",ds1820_read()+273.15); |
| 75 | 87 |
|
| 76 | 88 |
// printf("$T1.0 %f \r\n",ds1820_read()+273.15);
|
| 77 | 89 |
delay_ms(100); |
| 78 | 90 |
{ // printf
|
| 79 |
char output[8]; // Output buffer |
|
| 80 |
int8 j; // String pointer |
|
| 81 |
int8 check=0; // Checksum is calculated between '$' and '*' |
|
| 82 | 91 |
|
| 92 |
sht_rd(SHT_temp,SHT_hum); |
|
| 93 |
|
|
| 83 | 94 |
delay_us(SEND_DELAY); |
| 84 | 95 |
putc('$');
|
| 85 | 96 |
delay_us(SEND_DELAY); |
| ... | ... | |
| 89 | 100 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
|
| 90 | 101 |
sprintf(output,"%f \0", ds1820_read()+273.15); |
| 91 | 102 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
|
| 103 |
sprintf(output,"%f \0", SHT_temp + 273.15); |
|
| 104 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
|
|
| 105 |
sprintf(output,"%f \0", SHT_hum); |
|
| 106 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
|
|
| 92 | 107 |
sprintf(output,"*%X\r\n\0", check); |
| 93 | 108 |
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j++]); }
|
| 94 | 109 |
delay_us(SEND_DELAY); |