/Designs/MRAKOMER4/SW/irmrak4.c
1,17 → 1,8
/**** IR Mrakomer 4 ****/
#define VERSION "4.0"
#define ID "$Id$"
 
#include "irmrak4.h"
 
#bit CREN = 0x18.4 // USART registers
#bit SPEN = 0x18.7
#bit OERR = 0x18.1
#bit FERR = 0x18.2
 
#include <string.h>
#include "bloader.c" // Boot Loader driver
 
#CASE // Case sensitive compiler
 
#define MAXHEAT 20 // Number of cycles for heating
24,8 → 15,13
#define DOME PIN_B4 // Dome controll port
#define HEATING PIN_B3 // Heating for defrosting
 
#bit CREN = 0x18.4 // USART registers
#bit SPEN = 0x18.7
#bit OERR = 0x18.1
#bit FERR = 0x18.2
 
char VER[4]=VERSION; // Buffer for concatenate of a version string
char REV[50]=ID;
 
int8 heat; // Status variables
int8 open;
47,13 → 43,10
 
void welcome(void) // Welcome message
{
char REV[50]=ID; // Buffer for concatenate of a version string
 
if (REV[strlen(REV)-1]=='$') REV[strlen(REV)-1]=0;
printf("\n\r# Mrakomer %s (C) 2007 KAKL\n\r",VER); // Welcome message
printf("#%s\n\r",&REV[4]);
printf("# <sequence> <ambient[1/100 C]> <sky[1/100 C]> ");
printf("<heating[s]> <dome[s]> <check>\n\r\n\r");
printf("\n\r* Mrakomer %s (C) 2007 KAKL *\n\r",VER); // Welcome message
printf("* %s *\n\r",REV);
printf("<#sequence> <ambient [1/100 C]> <sky [1/100 C]> ");
printf("<heating [s]> <dome [s]>\n\r\n\r");
}
 
 
60,7 → 53,7
#include "smb.c" // System Management Bus driver
 
 
// Read sensor's RAM
// Read sensor RAM
// Returns temperature in °K
int16 ReadTemp(int8 addr, int8 select)
{
192,9 → 185,6
case 's':
repeat=FALSE; // Single measure mode
break;
 
case 'u':
load_program(); // Update firmware
}
}
// while(kbhit()) getc(); // Flush USART buffer
211,26 → 201,18
{ // printf
char output[8]; // Output buffer
int8 j; // String pointer
int8 check=0; // Checksum is calculated between '$' and '*'
 
delay(SEND_DELAY);
putc('$');
delay(SEND_DELAY);
sprintf(output,"M%s ",VER);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
sprintf(output,"%Lu ", seq);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
sprintf(output,"#%Lu ", seq);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
sprintf(output,"%Ld ", ta);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
sprintf(output,"%Ld ", to);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
sprintf(output,"%u ", heat);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
sprintf(output,"%u ", open);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j]); check^=output[j++]; }
sprintf(output,"*%X\n\r\0", check);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
delay(SEND_DELAY);
sprintf(output,"%u\n\r\0", open);
j=0; while(output[j]!=0) { delay(SEND_DELAY); putc(output[j++]); }
}
 
delay(MEASURE_DELAY); // Delay to a next measurement
238,3 → 220,4
restart_wdt();
}
}
 
/Designs/MRAKOMER4/SW/irmrak4.PJT
36,10 → 36,7
2=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\irmrak4.h
3=C:\Program Files\PICC\devices\16F88.h
4=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\smb.c
5=C:\Program Files\PICC_old\drivers\string.h
6=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\bloader.c
7=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\irmrak4.lst
8=
5=
[Units]
Count=1
1=C:\Dokumenty\MLAB\Designs\MRAKOMER4\SW\irmrak4.c (main)