/****************************************************************************
COFFEE_01.C
This program is a coffee pot manager.
+5
|
14
----------
| |
| |
| |
| |
MCLR --4-| 16F628 |-17-- OUT
| |
| |
| |
6MHz XTAL-15-| |
XTAL-16-| |
----------
5
|
Gnd
***************************************************************************/
#include < 16F628.h >
#include < jonsinc.h >
#fuses HS, NOPROTECT, PUT, NOWDT, BROWNOUT, MCLR, NOLVP
#use standard_io ( A )
#use delay ( clock = 6000000 )
#define OUT PIN_A0
// delay in minutes
#define BREW_PERIOD 3
void DelayMinutes ( char cMin );
void main ( void )
{
char cX;
delay_ms ( 200 ); // let stabilize
// switch contactor several times to show unit is on and working
for ( cX = 0; cX < 5; cX++ )
{
output_high ( OUT );
delay_ms ( 500 );
output_low ( OUT );
delay_ms ( 500 );
}
while ( TRUE )
{
output_high ( OUT );
DelayMinutes ( BREW_PERIOD );
output_low ( OUT );
DelayMinutes ( BREW_PERIOD );
}
}
void DelayMinutes ( char cMin )
{
char cX;
for ( cX = 0; cX < cMin; cX++ )
{
delay_ms ( 60000 ); // one minute
}
}