/Modules/TDC/GP201A/SW/PICinterface/main.c/main.c
28,24 → 28,28
 
TDC_reset();
MRange=TDC_MRANGE1;
hitin1=TDC_HITIN1_2;
hitin2=TDC_HITIN2_2;
/* MRange=TDC_MRANGE1;
hitin1=TDC_HITIN1_1;
hitin2=TDC_HITIN2_0;
hit1=TDC_MRANGE1_HIT1_START;
hit2=TDC_MRANGE1_HIT2_2CH1;
en_int= (TDC_INT_ALU | TDC_INT_ENDHIT | TDC_INT_TIMEOUT);
hit2=TDC_MRANGE1_HIT2_1CH1;
en_int=0x0; // (TDC_INT_ALU | TDC_INT_ENDHIT | TDC_INT_TIMEOUT);
en_err_val=TDC_ERRVAL_EN;
delval1=0x0;
delval2=0x0;
delval3=0x0;
calibrate=TDC_CALIBRATE_EN;
calibrate=TDC_CALIBRATE_DIS;
disautocal=TDC_AUTOCAL_EN;
firenum=TDC_FIRENUM_2;
div_fire=TDC_DIV_FIRE_3;
firenum=TDC_FIRENUM_0;
div_fire=TDC_DIV_FIRE_2;
Tcycle=TDC_TCYSLE_LONG;
portnum=TDC_TPORTNUM_2;
fakenum=TDC_TFAKENUM_2;
TDC_update_registers();
*/
output_low(START);
output_low(STOP1);
output_low(STOP2);
58,26 → 62,32
while(true)
{
temperature = ds1820_read();
temperature = ds1820_read();
TDC_reset();
hitin1=TDC_HITIN1_2;
hitin2=TDC_HITIN2_1;
en_err_val=1;
TDC_update_registers();
 
delay_ms(50);
TDC_init();
delay_ms(50);
printf("Temp: %f \r\n", temperature);
delay_ms(50);
printf("status: %LX \r\n", TDC_get_status());
 
TDC_start_cycle();
// TDC_start_cycle();
 
delay_us(10);
output_high(START);
// delay_us(1);
delay_us(10);
output_low(START);
// delay_us(1);
output_high(STOP1);
// output_high(STOP1);
// delay_us(10);
output_low(STOP1);
// delay_us(500);
// output_high(STOP1);
// delay_us(10);
86,21 → 96,26
// output_high(STOP1);
// delay_us(10);
// output_low(STOP1);
output_low(START);
 
output_high(STOP2);
// output_high(STOP2);
// delay_us(10);
output_low(STOP2);
// output_low(START);
// output_low(STOP1);
// output_low(STOP2);
// delay_us(500);
output_high(STOP2);
// output_high(STOP2);
// delay_us(10);
output_low(STOP2);
// output_low(STOP2);
// delay_us(500);
output_high(STOP2);
// output_high(STOP2);
// delay_us(10);
output_low(STOP2);
// output_low(STOP2);
 
output_low(START);
 
// delay_ms(10);
// TDC_start_temp();
 
delay_ms(10);
printf("status: %LX \r\n", TDC_get_status());
delay_ms(50);