/Designs/ohradnik/SW/main.c |
---|
0,0 → 1,63 |
#include "main.h" |
#define LED PIN_B2 |
#define TRAFO1 PIN_B1 |
#define TRAFO2 PIN_A2 |
#define ALERT PIN_B5 |
#define OPTRON PIN_A0 |
void main() |
{ |
output_high(ALERT); |
setup_adc_ports(NO_ANALOGS|VSS_VDD); |
setup_adc(ADC_CLOCK_DIV_2); |
setup_spi(SPI_SS_DISABLED); |
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); |
// setup_wdt(WDT_1152MS|WDT_DIV_16); |
setup_wdt(WDT_288MS); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DISABLED,0,1); |
setup_ccp1(CCP_OFF); |
setup_comparator(NC_NC_NC_NC); |
setup_vref(FALSE); |
setup_oscillator(OSC_1MHZ|OSC_TIMER1); |
restart_wdt(); |
while(true) |
{ |
int8 n; |
for(n=0;n<165;n++) // 20ms |
{ |
output_low(TRAFO1); |
output_high(TRAFO2); |
delay_us(28); // 121us |
output_high(TRAFO1); |
output_low(TRAFO2); |
} |
restart_wdt(); |
output_high(TRAFO1); |
output_high(TRAFO2); |
output_toggle(LED); |
delay_ms(100); |
restart_wdt(); |
int16 i; |
for(i=0;i<3000;i++) |
{ |
delay_ms(1); |
restart_wdt(); |
if(input(OPTRON)==0) |
{ |
output_low(ALERT); |
while(TRUE) restart_wdt(); |
} |
} |
} |
} |
/Designs/ohradnik/SW/main.h |
---|
0,0 → 1,18 |
#include <16F88.h> |
#device adc=8 |
#FUSES WDT //Watch Dog Timer |
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT |
#FUSES PUT //Power Up Timer |
#FUSES MCLR //Master Clear pin enabled |
#FUSES NOBROWNOUT //No brownout reset |
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
#FUSES NOCPD //No EE protection |
#FUSES NOWRT //Program memory not write protected |
#FUSES NODEBUG //No Debug mode for ICD |
#FUSES NOPROTECT //Code not protected from reading |
#FUSES FCMEN //Fail-safe clock monitor enabled |
#FUSES IESO //Internal External Switch Over mode enabled |
#use delay(clock=1000000) |
/Designs/ohradnik/SW/main.pjt |
---|
0,0 → 1,26 |
[PROJECT] |
Target=C:\Users\kakl\Documents\MLAB\Designs\ohradnik\SW\main.hex |
Development_Mode= |
Processor_Text=PIC16F88 |
ToolSuite=CCS |
Processor=0x688F |
[C:\Users\kakl\Documents\MLAB\Designs\ohradnik\SW\main] |
Type=4 |
Path= |
FileList= |
BuildTool= |
OptionString= |
AdditionalOptionString= |
[mru-list] |
1=C:\Users\kakl\Documents\MLAB\Designs\ohradnik\SW\main.c |
[Windows] |
0=0000 %S 0 0 796 451 3 0 |
[Units] |
Link=0 |
Count=1 |
1=C:\Users\kakl\Documents\MLAB\Designs\ohradnik\SW\main |
[Opened Files] |
1=main.c |
2=main.h |
3=..\..\..\..\..\..\..\Program Files\PICC\Devices\16F88.h |
4= |