/Modules/TDC/GP201A/SW/PICinterface/GP2.c
1,47 → 1,3
 
//struct {
unsigned int8 firenum;
unsigned int8 div_fire;
unsigned int8 calresnum :2;
unsigned int8 clkhsdiv ;
unsigned int8 start_clkhs:1;
unsigned int8 portnum :1;
unsigned int8 Tcycle :1;
unsigned int8 fakenum :1;
unsigned int8 selclkT :1;
unsigned int8 calibrate :1;
unsigned int8 disautocal :1;
unsigned int8 MRange :1;
unsigned int8 neg_stop2 :1;
unsigned int8 neg_stop1 :1;
unsigned int8 neg_start :1;
//}reg0;
 
//struct {
unsigned int hit2 :4;
unsigned int hit1 :4;
unsigned int fast_init :1;
unsigned int sc :1;
unsigned int hitin2 :3;
unsigned int hitin1 :3;
//}reg1;
 
//struct {
unsigned int en_int :3;
unsigned int rfedge2 :1;
unsigned int rfedge1 :1;
unsigned int delval1 :3;
//}reg2;
 
//struct {
unsigned int en_err_val :1;
unsigned int tim0_mr2 :2;
unsigned int32 delval :7;
//}reg3;
 
//}TDC_registers;
 
 
void TDC_init()
{
output_low(TDC_ENABLE);
117,14 → 73,14
return ret;
}
 
void TDC_update_registers()
void TDC_setup_reg1()
{
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0x81,8);
spi_xfer(TDC_stream,reg1.*,24);
spi_xfer(TDC_stream,0x224000,24);
output_high(TDC_ENABLE);
 
/* output_low(TDC_ENABLE);
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0xB1);
output_high(TDC_ENABLE);
 
138,10 → 94,5
 
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0xB4);
output_high(TDC_ENABLE); */
output_high(TDC_ENABLE);
}
 
void TDC_set_firenum()
{
reg0.Tcycle=TDC_TCYCLE_SHORT;
}
/Modules/TDC/GP201A/SW/PICinterface/GP2.h
1,5 → 1,5
#include "GP2.c"
 
 
//register 0
#define TDC_NEG_START_INV 1
#define TDC_NEG_START 0
146,4 → 146,3
#define TDC_STARTNOISE_EN 1
#define TDC_STARTNOISE_DIS 0
 
#include "GP2.c"
/Modules/TDC/GP201A/SW/PICinterface/main.hex
1,40 → 1,43
:10000000B9EF00F07265743A20254C58200A0000C0
:100010000E50200807E00F6E0A360B360C360D36F0
:100020000F2EFAD79382939093948A940EC00FF078
:100030008A840DAE8A900DBE8A800A360B360C3645
:100040000D368A94003601360236033681A20090BE
:1000500081B200800F2EECD7000C93968A960D6A21
:100060000C6A0B6A500E0A6E200E0E6ED1DF93964C
:100070008A86F4EF00F0EA6A0A0EE96EEF500DE0AE
:10008000060E016E006A002EFED7012EFBD77B0EF6
:10009000006E002EFED7EF2EF3D7F9EF00F0939607
:1000A0008A960D6A0C6A0B6AB50E0A6E080E0E6E01
:1000B000AFDF0D6A0C6A0B6A0A6A080E0E6EA8DFC3
:1000C000015000C009F093968A8609C001F0FCEF48
:1000D00000F0939E8A9E080E016E00D00000018EF3
:1000E0000ED0019E0D32D8B08A8ED8A08A9E018C87
:1000F00006D0019C012EF6D700D000008A8EA70EF4
:10010000E96EE92EFED700D001BEEBD701BCF1D7D6
:10011000000C0900F6CF0BF0F7CF0CF0F5CF0DF087
:10012000D8DF0BC0F6FF0CC0F7FF0A2EF2D705EFA1
:1001300001F00BBE0FD00F0E006E0A3800160A0E2B
:10014000005C03E2300E002602D00B50002600C0F7
:100150000DF0BFDF0F0E0A160A0E0A5C02E2300E27
:1001600002D00B9E0B500A260AC00DF0B2DF0AEF38
:1001700001F0F86AD09EEA6AE96A939E8A8E9382B9
:10018000939093948A94C150C00B0F09C16E070ECF
:10019000B46EC150C00B0F09C16EC090C092C09424
:1001A000C09EC2809698C69A949E93809392010EA8
:1001B000C66E000EC76ED190800ED56ECD6A000E51
:1001C000CA6E000ECB6E9484BD6AB76AB66A070E1B
:1001D000B46E9250926E100E006E002EFED700008C
:1001E000B450A19CB56A39D7020E096EFA0E0A6E98
:1001F00042D7092EFBD753D701C009F0040EF66E83
:10020000000EF76E050E0A6E84D709C00AF0370E8D
:100210000B6E8FD7200E0D6E5CDF0A0E0D6E59DF50
:04022000E3D703001D
:10000000D0EF00F07265743A20254C58200A0000A9
:100010000A50200807E00B6E063607360836093608
:100020000B2EFAD79382939093948A940AC00BF084
:100030008A8409AE8A9009BE8A8006360736083659
:1000400009368A94003601360236033681A20090C2
:1000500081B200800B2EECD7000C93968A96096A29
:10006000086A076A500E066E200E0A6ED1DF93965C
:100070008A860BEF01F093968A96096A086A076AE6
:10008000810E066E080E0A6EC3DF096A220E086E24
:10009000400E076E066A180E0A6EBADF93968A86BD
:1000A0000CEF01F0EA6A060EE96EEF500DE0060E65
:1000B000016E006A002EFED7012EFBD77B0E006E6C
:1000C000002EFED7EF2EF3D711EF01F093968A960C
:1000D000096A086A076AB50E066E080E0A6E98DF8E
:1000E000096A086A076A066A080E0A6E91DF0150FB
:1000F00000C005F093968A8605C001F014EF01F068
:10010000939E8A9E080E016E00D00000018E0ED0D4
:10011000019E0932D8B08A8ED8A08A9E018C06D062
:10012000019C012EF6D700D000008A8EA70EE96E42
:10013000E92EFED700D001BEEBD701BCF1D7000CF1
:100140000900F6CF07F0F7CF08F0F5CF09F0D8DFB8
:1001500007C0F6FF08C0F7FF062EF2D71DEF01F02B
:1001600007BE0FD00F0E006E063800160A0E005C98
:1001700003E2300E002602D00750002600C009F02E
:10018000BFDF0F0E06160A0E065C02E2300E02D02A
:10019000079E0750062606C009F0B2DF22EF01F0E5
:1001A000F86AD09EEA6AE96A939E8A8E9382939057
:1001B00093948A94C150C00B0F09C16E070EB46EA0
:1001C000C150C00B0F09C16EC090C092C094C09EB8
:1001D000C2809698C69A949E93809392010EC66EA2
:1001E000000EC76ED190800ED56ECD6A000ECA6E1D
:1001F000000ECB6E9484BD6AB76AB66A070EB46E01
:100200009250926E100E006E002EFED70000B45079
:10021000A19CB56A22D72FD7020E056EFA0E066E84
:1002200041D7052EFBD752D701C005F0040EF66E5C
:10023000000EF76E050E066E83D705C006F0370E6A
:10024000076E8ED7200E096E5BDF0A0E096E58DF2F
:04025000E3D70300ED
:020000040030CA
:0E00000027CC390E0087A1000FC00FE00F4083
:00000001FF
;PIC18F4550
;CRC=0372 CREATED="02-1-11 18:11"
;CRC=1441 CREATED="02-1-11 15:23"
/Modules/TDC/GP201A/SW/PICinterface/main.c
2,8 → 2,6
 
#include "GP2.h"
 
#define VERSION 0.1
 
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
20,6 → 18,7
 
TDC_reset();
//TDC_init();
TDC_setup_reg1();
while(true)
{
26,6 → 25,5
delay_ms(500);
printf("ret: %LX \n", TDC_get_reg1());
// printf("ret: %LX \n", TDC_get_measurement(1));
 
};
}