/Designs/Measuring_instruments/AWS01A/SW/PIC16F887/main.c
6,7 → 6,7
 
#CASE // Case sensitive compiler
 
#define LCD_ENABLE_PIN PIN_E0 ////
/*#define LCD_ENABLE_PIN PIN_E0 ////
#define LCD_RS_PIN PIN_E1 ////
#define LCD_RW_PIN PIN_E2 ////
#define LCD_DATA4 PIN_D4 ////
14,7 → 14,7
#define LCD_DATA6 PIN_D6 ////
#define LCD_DATA7 PIN_D7
#include <lcd.c>
 
*/
#define SEND_DELAY 50 // Time between two characters on RS232
 
char VER[4]=VERSION; // Buffer for concatenate of a version string
22,6 → 22,9
#define ONE_WIRE_PIN PIN_C7
#include "..\ds1820.c"
 
#include "..\SHT.c"
 
 
void welcome(void) // Welcome message
{
char REV[50]=ID; // Buffer for concatenate of a version string
68,18 → 71,26
lcd_putc("www.mlab.cz");
Delay_ms(2000);
*/
 
sht_init();
 
while (TRUE)
{
lcd_gotoxy(1,2);
char output[8]; // Output buffer
int8 j; // String pointer
int8 check=0; // Checksum is calculated between '$' and '*'
float SHT_temp,SHT_hum;
 
 
// lcd_gotoxy(1,2);
// printf(lcd_putc,"T: %f K ",ds1820_read()+273.15);
 
// printf("$T1.0 %f \r\n",ds1820_read()+273.15);
delay_ms(100);
{ // printf
char output[8]; // Output buffer
int8 j; // String pointer
int8 check=0; // Checksum is calculated between '$' and '*'
 
sht_rd(SHT_temp,SHT_hum);
 
delay_us(SEND_DELAY);
putc('$');
delay_us(SEND_DELAY);
89,6 → 100,10
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
sprintf(output,"%f \0", ds1820_read()+273.15);
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
sprintf(output,"%f \0", SHT_temp + 273.15);
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
sprintf(output,"%f \0", SHT_hum);
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j]); check^=output[j++]; }
sprintf(output,"*%X\r\n\0", check);
j=0; while(output[j]!=0) { delay_us(SEND_DELAY); putc(output[j++]); }
delay_us(SEND_DELAY);