/Designs/Measuring_instruments/GM_counter/SW/counter/main.c |
---|
0,0 → 1,90 |
#include ".\main.h" |
//#include <LCD.C> |
#define LED1 PIN_C6 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5 |
#define LED2 PIN_C5 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5 |
#define LED3 PIN_C4 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5 |
#define LED4 PIN_D3 //CHANGE PIN_XX TO YOUR LED PIN NUMBER, EX: PIN_A5 |
#int_EXT |
void EXT_isr(void) |
{ |
output_toggle(LED3); |
} |
//#define LCD_TYPE 1 |
//#include <lcd.c> |
void main() |
{ |
unsigned int setpoint; |
unsigned int napeti; |
unsigned int16 plneni=0; |
/* lcd_init(); |
lcd_putc("\fReady...\n"); |
while (TRUE) { |
k=kbd_getc(); |
if(k!=0) |
if(k=='*') |
lcd_putc('\f'); |
else |
lcd_putc(k); |
} |
*/ |
setup_adc_ports(sAN0|VSS_VDD); |
setup_adc(ADC_CLOCK_DIV_32); |
setup_spi(SPI_SS_DISABLED); |
setup_timer_0(RTCC_EXT_L_TO_H|RTCC_DIV_1); |
setup_timer_1(T1_DISABLED); |
setup_timer_2(T2_DIV_BY_1,255,1); |
setup_ccp1(CCP_PWM); |
setup_ccp2(CCP_PWM); |
setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard |
setup_oscillator(OSC_8MHZ); |
set_pwm1_duty(0); |
set_pwm2_duty(0); |
output_high(LED1); |
output_high(LED2); |
output_high(LED3); |
output_high(LED4); |
ext_int_edge( L_TO_H ); // Sets up EXT |
enable_interrupts(INT_EXT); |
enable_interrupts(GLOBAL); |
// lcd_init(); |
setpoint = 43; |
while(true) |
{ |
set_adc_channel(1); |
delay_us(100); |
napeti = read_adc(); |
if (napeti <= setpoint) |
{ |
if (plneni < 300) plneni++; |
output_low(LED2); |
} |
else |
{ |
if (plneni > 0) plneni--; |
output_high(LED2); |
} |
set_pwm1_duty(plneni); |
set_pwm2_duty(1023-plneni); |
output_toggle(LED1); |
delay_ms(10); |
} |
} |
/Designs/Measuring_instruments/GM_counter/SW/counter/main.h |
---|
0,0 → 1,20 |
#include <16F887.h> |
#device adc=10 |
#FUSES NOWDT //No Watch Dog Timer |
#FUSES INTRC //Internal RC Osc |
#FUSES NOPUT //No Power Up Timer |
#FUSES MCLR //Master Clear pin enabled |
#FUSES NOPROTECT //Code not protected from reading |
#FUSES NOCPD //No EE protection |
#FUSES NOBROWNOUT //No brownout reset |
#FUSES IESO //Internal External Switch Over mode enabled |
#FUSES FCMEN //Fail-safe clock monitor enabled |
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O |
#FUSES NODEBUG //No Debug mode for ICD |
#FUSES NOWRT //Program memory not write protected |
#FUSES BORV40 //Brownout reset at 4.0V |
#use delay(clock=8000000) |
#use rs232(baud=9600,parity=N,xmit=PIN_B6,rcv=PIN_B7,bits=5) |
/Designs/Measuring_instruments/GM_counter/SW/counter/main.hex |
---|
0,0 → 1,48 |
:1000000000308A0050280000FF00030E8301A10089 |
:100010000A08A0008A010408A2007708A300780853 |
:10002000A4007908A5007A08A600831383120B1E8A |
:100030001B288B182C28220884002308F70024088A |
:10004000F8002508F9002608FA0020088A00210E89 |
:100050008300FF0E7F0E09008A110A122F28271233 |
:100060002708831687001030831287068B108A11A9 |
:100070000A121B282C3084008313000803194D2812 |
:100080000230F800F701F70B4328F80B42289730AD |
:10009000F700F70B4928800B40288A110A125929CA |
:1000A000840183131F308305713083168F000F087E |
:1000B000061383120617831603170908C03989002F |
:1000C00003131F129F120030031788008312870149 |
:1000D00088018901FF300313A700AB01AA01831631 |
:1000E00003170908C039890003131F129F1201303A |
:1000F00003178800831203131F139F1783169F177C |
:1001000083121F149412A7122708831687008312E4 |
:1001100027162708831687008312A711270883163E |
:100120008700013083129400003083169400010888 |
:10013000C73928388100831290010030F800043854 |
:100140009200FF308316920083122711270883162E |
:10015000870083120711831609130C30831297004E |
:1001600083169B019C0101309D008312A710270874 |
:1001700083168700831287100C309D0001308000A9 |
:1001800003178701880189017130831603138F00DB |
:100190000F08831295019B012713270883168700F8 |
:1001A00083120717A7122708831687008312871662 |
:1001B00027122708831687008312071683168811D3 |
:1001C000831288158316011783120B16C0308B0417 |
:1001D0002B30A8000430F8001F08C33978049F00B2 |
:1001E0004230F700F70BF22800009F149F18F62802 |
:1001F00083161E088312A90029082802031C14294B |
:100200002B08013C031C0D29031D0A292A082B3C3D |
:10021000031C0D29AA0A0319AB0AA7122708831683 |
:100220008700831287122429AA08031D1A29AB0804 |
:1002300003191E292A080319AB03AA03A7122708CA |
:1002400083168700831287162B08F9002A08F80006 |
:10025000F90CF80CF90CF80CF90C78089500F90C6D |
:10026000790C3039F7001708CF39770497002A083E |
:10027000FF3CAC000330AD002B08031C2B0FAD027C |
:10028000AD0CAC0CAD0CAC0CAD0C2C089B00AD0C4B |
:100290002D0C3039F7001D08CF3977049D00271346 |
:1002A0002708831687004030831287060A30AC0087 |
:0602B0003A28EA28630071 |
:04400E00F52CFF3F4F |
:00000001FF |
;PIC16F887 |
;CRC=C04F CREATED="09-II-13 19:58" |
/Designs/Measuring_instruments/GM_counter/SW/counter/main.pjt |
---|
0,0 → 1,27 |
[PROJECT] |
Target=D:\MLAB\Designs\Measuring_instruments\GM_counter\SW\main.hex |
Development_Mode= |
Processor_Text=PIC16F887 |
ToolSuite=CCS |
Processor=0x887F |
[D:\MLAB\Designs\Measuring_instruments\GM_counter\SW\main] |
Type=4 |
Path= |
FileList= |
BuildTool= |
OptionString= |
AdditionalOptionString= |
[mru-list] |
1=D:\MLAB\Designs\Measuring_instruments\GM_counter\SW\main.c |
[Windows] |
0=0000 %S 0 0 796 451 3 0 |
[Opened Files] |
1=main.c |
2= |
3= |
[Target Data] |
OptionString=-p +FM |
FileList=D:\MLAB\Designs\Measuring_instruments\GM_counter\SW\main.c |
[Units] |
Count=1 |
1=main (main) |