/Modules/TDC/GP201A/SW/Pulzni_generator/main.c
0,0 → 1,82
#include "main.h"
 
#use fast_io (D)
 
#define START PIN_D4
#define STOP1 PIN_D5
#define STOP2 PIN_D7
 
#define FIRE_DETECT PIN_D6
 
#define MODE_SELECT PIN_A4 //switch measurement (pulse generator) modes
 
void main()
{
 
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_CLOCK_DIV_2);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_timer_3(T3_DISABLED|T3_DIV_BY_1);
setup_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
 
SET_TRIS_D( 0b00000100 );
 
while(true)
{
delay_ms(50);
output_low(START);
output_low(STOP1);
output_low(STOP2);
 
// Mode 1
if(input(MODE_SELECT))
{
while(!input(FIRE_DETECT));
output_high(START); // start of time measurement
 
output_high(STOP2);
output_high(STOP1);
output_low(START);
output_low(STOP2);
output_low(STOP1);
 
output_high(STOP2);
output_high(STOP1);
output_low(STOP2);
output_low(STOP1);
 
}
// mode 2
 
if(!input(MODE_SELECT))
{
output_high(STOP2); // Merime jenom jednim kanalem (druhy musi byt v H)
while(!input(FIRE_DETECT));
 
output_high(START);
output_low(START);
delay_us(150);
output_high(STOP1);
output_low(STOP1);
delay_us(1);
output_high(STOP1);
output_low(STOP1);
delay_us(10);
output_high(STOP1);
output_low(STOP1);
}
}
}
/Modules/TDC/GP201A/SW/Pulzni_generator/main.h
0,0 → 1,35
#include <18F4550.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HSPLL //High Speed Crystal/Resonator with PLL enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV20 //Brownout reset at 2.0V
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES PBADEN //PORTB pins are configured as analog input channels on RESET
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOCPB //No Boot Block code protection
#FUSES MCLR //Master Clear pin enabled
#FUSES LPT1OSC //Timer1 configured for low-power operation
#FUSES NOXINST //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES PLL5 //Divide By 5(20MHz oscillator input)
#FUSES CPUDIV1 //No System Clock Postscaler
#FUSES USBDIV //USB clock source comes from PLL divide by 2
#FUSES VREGEN //USB voltage regulator enabled
#FUSES ICPRT //ICPRT enabled
 
#use delay(clock=48000000)
 
/Modules/TDC/GP201A/SW/Pulzni_generator/main.hex
0,0 → 1,24
:1000000028EF00F0EA6A050EE96EEF500EE00F0EE1
:10001000016E006A002EFED7012EFBD78F0E006EF8
:10002000002EFED70000EF2EF2D762EF00F0010E97
:10003000055E0CE3EA6A050EE96EEF5007E0020E7A
:10004000006E002EFED700D0EF2EF9D77FEF00F024
:10005000F86AD09EEA6AE96AC150C00B0F09C16E06
:10006000070EB46EC150C00B0F09C16EC090C09294
:10007000C094C09EC2809698C69A949E9380939294
:10008000010EC66E000EC76ED190800ED56ECD6A81
:10009000000ECA6E000ECB6EB16A9484BD6AB76A58
:1000A000B66A070EB46E9250926E270E006E002E46
:1000B000FED700D0B450A19CB56A040E956E320EE6
:1000C000056EA0D78C988C9A8C9E928880A80CD0B4
:1000D00083ACFED78C888C8E8C8A8C988C9E8C9A64
:1000E0008C8E8C8A8C9E8C9A928880B818D08C8E3C
:1000F00083ACFED78C888C98960E056E98D78C8A28
:100100008C9A030E006E002EFED700D08C8A8C9A3B
:10011000270E006E002EFED700D08C8A8C9ACFD787
:020120000300DA
:020000040030CA
:0E00000024CE390E0087A1000FC00FE00F4084
:00000001FF
;PIC18F4550
;CRC=27DF CREATED="09-9-11 13:00"
/Modules/TDC/GP201A/SW/Pulzni_generator/main.pjt
0,0 → 1,26
[PROJECT]
Target=main.hex
Development_Mode=
Processor_Text=PIC18F4550
ToolSuite=CCS
Processor=0x4550
[main]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
[mru-list]
1=main.c
[Windows]
0=0000 %S 0 0 796 451 3 0
[Units]
Link=0
Count=1
1=main
[Opened Files]
1=main.c
2=
3=..\..\..\..\..\..\..\..\..\Program Files (x86)\PICC\devices\18F4550.h
4=