/Modules/TDC/GP201A/SW/PICinterface/GP2.c
54,7 → 54,7
void TDC_init()
{
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0x70);
spi_xfer(TDC_stream,0x70,8);
output_high(TDC_ENABLE);
}
 
61,7 → 61,7
void TDC_reset()
{
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0x50);
spi_xfer(TDC_stream,0x50,8);
output_high(TDC_ENABLE);
}
 
68,7 → 68,7
void TDC_start_cycle()
{
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0x01);
spi_xfer(TDC_stream,0x01,8);
output_high(TDC_ENABLE);
}
 
75,7 → 75,7
void TDC_start_temp()
{
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0x02);
spi_xfer(TDC_stream,0x02,8);
output_high(TDC_ENABLE);
}
 
82,7 → 82,7
void TDC_start_cal_resonator()
{
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0x03);
spi_xfer(TDC_stream,0x03,8);
output_high(TDC_ENABLE);
}
 
89,7 → 89,7
void TDC_start_cal()
{
output_low(TDC_ENABLE);
spi_xfer(TDC_stream,0x04);
spi_xfer(TDC_stream,0x04,8);
output_high(TDC_ENABLE);
}
 
/Modules/TDC/GP201A/SW/PICinterface/main.c
4,6 → 4,10
 
#define VERSION 0.1
 
#define START PIN_D4
#define STOP1 PIN_D5
#define STOP2 PIN_D6
 
void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
21,16 → 25,66
TDC_reset();
hit1=TDC_MRANGE2_HIT1_START;
hit2=TDC_MRANGE2_HIT2_1CH1;
hit2=TDC_MRANGE2_HIT2_2CH1;
hitin1=TDC_HITIN1_2;
hitin2=TDC_HITIN1_0;
en_int= 0xFF; //TDC_INT_ALU | TDC_INT_ENDHIT | TDC_INT_TIMEOUT;
en_err_val=TDC_ERRVAL_EN;
delval1=0x0;
delval2=0x0;
delval3=0x0;
TDC_update_registers();
output_low(START);
output_low(STOP1);
output_low(STOP2);
TDC_start_cal();
delay_ms(50);
while(true)
{
 
/* delay_ms(500);
hit2=0x00;
hit1=0x00;
TDC_update_registers();
printf("reg1: %X \n", TDC_get_reg1());
 
TDC_reset();
delay_ms(50);
printf("reg1: %X \n", TDC_get_reg1());
*/
TDC_init();
delay_ms(50);
printf("status: %LX \n", TDC_get_status());
delay_us(10);
TDC_start_cycle();
delay_us(10);
output_high(START);
delay_us(1);
output_low(START);
delay_us(500);
output_high(STOP1);
delay_us(10);
output_low(STOP1);
delay_us(500);
output_high(STOP1);
delay_us(10);
output_low(STOP1);
delay_us(500);
output_high(STOP1);
delay_us(10);
output_low(STOP1);
 
delay_ms(100);
printf("status: %LX \n", TDC_get_status());
delay_ms(50);
printf("measured: %LX, %LX, %LX, %LX \n", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4));
delay_ms(500);
printf("measured: %LX, %LX, %LX, %LX \n", TDC_get_measurement(1), TDC_get_measurement(2), TDC_get_measurement(3), TDC_get_measurement(4));
};
}
/Modules/TDC/GP201A/SW/PICinterface/main.hex
1,119 → 1,149
:1000000077EF02F06D656173757265643A20254C77
:10001000582C20254C582C20254C582C20254C5849
:10002000200A00003750200807E0386E3336343697
:1000300035363636382EFAD79382939093948A9435
:1000400037C038F08A8436AE8A9036BE8A8033361E
:100050003436353636368A94003601360236033663
:1000600081A2009081B20080382EECD7000C9396CC
:100070008A96366A356A346A500E336E200E376EB1
:10008000D1DF93968A86DFEF02F093968A96366ADE
:10009000356A346A800E336E080E376EC3DF366AF7
:1000A000356A346A04C033F0040E376EBBDF366A3B
:1000B000356A346A05C033F0040E376EB3DF366A32
:1000C000356A346A06C033F0020E376EABDF366A2B
:1000D000356A346A07C033F0020E376EA3DF366A22
:1000E000356A346A08C033F0020E376E9BDF000EAB
:1000F00009B0010E366A356A346A336E010E376E06
:1001000091DF000E09B2010E366A356A346A336E29
:10011000010E376E87DF000E09B4010E366A356AAC
:10012000346A336E010E376E7DDF000E09B6010EA4
:10013000366A356A346A336E010E376E73DF000E2D
:1001400009B8010E366A356A346A336E010E376EAD
:1001500069DF000E09BA010E366A356A346A336EF9
:10016000010E376E5FDF000E09BC010E366A356A7C
:10017000346A336E010E376E55DF000E09BE010E74
:10018000366A356A346A336E010E376E4BDF000E05
:100190000AB0010E366A356A346A336E010E376E64
:1001A00041DF000E0AB2010E366A356A346A336ED8
:1001B000010E376E37DF93968A8693968A96366A53
:1001C000356A346A810E336E080E376E2BDF366A5D
:1001D000356A346A0BC033F0040E376E23DF366A9B
:1001E000356A346A0CC033F0040E376E1BDF000E24
:1001F0000AB4010E366A356A346A336E010E376E00
:1002000011DF366A356A346A010E336E376E0ADFE3
:10021000366A356A346A0DC033F0030E376E02DF7A
:10022000366A356A346A0EC033F0030E376EFADE72
:10023000366A356A346A336A080E376EF3DE93968F
:100240008A8693968A96366A356A346A820E336E47
:10025000200E376EE7DE366A356A346A0FC033F037
:10026000030E376EDFDE000E0AB6010E366A356AFF
:10027000346A336E010E376ED5DE000E0AB8010EF9
:10028000366A356A346A336E010E376ECBDE13C0C0
:1002900036F012C035F011C034F010C033F0130E38
:1002A000376EC0DE93968A8693968A96366A356A4A
:1002B000346A830E336E200E376EB4DE366A356ACA
:1002C000346A336A020E376EADDE000E0ABA010ED2
:1002D000366A356A346A336E010E376EA3DE366ACB
:1002E000356A346A14C033F0020E376E9BDE18C0D4
:1002F00036F017C035F016C034F015C033F0130EC9
:10030000376E90DE93968A8693968A96366A356A19
:10031000346A840E336E200E376E84DE366A356A98
:10032000346A040E336E050E376E7CDE1CC036F068
:100330001BC035F01AC034F019C033F0130E376EFD
:1003400071DE93968A8693968A96366A356A346AFF
:10035000850E336E200E376E65DE366A356A346A76
:100360001DC033F0030E376E5DDE000E0ABC010EB9
:10037000366A356A346A336E010E376E53DE000E0C
:100380000ABE010E366A356A346A336E010E376E64
:1003900049DE366A356A346A1EC033F0030E376EA2
:1003A00041DE366A356A20C034F01FC033F0100ECB
:1003B000376E38DE93968A86E6EF02F093968A9639
:1003C000366A356A346A700E336E200E376E2ADE56
:1003D00093968A86E7EF02F0EA6A220EE96EEF5002
:1003E0000DE0060E016E006A002EFED7012EFBD72F
:1003F0007B0E006E002EFED7EF2EF3D7ECEF02F04F
:1004000093968A96B00E2D24FF0F326E366A356AA7
:10041000346A336E200E376E05DE366A356A346A0A
:10042000336A200E376EFEDD015003C031F002C08A
:1004300030F001C02FF000C02EF093968A862EC0B7
:1004400000F02FC001F030C002F031C003F0000C0A
:10045000939E8A9E080E016E00D00000018E0ED081
:10046000019E3432D8B08A8ED8A08A9E018C06D0E4
:10047000019C012EF6D700D000008A8EA70EE96EEF
:10048000E92EFED700D001BEEBD701BCF1D7000C9E
:100490000900F6CF32F0F7CF33F0F5CF34F0D8DFE4
:1004A00032C0F6FF33C0F7FF312EF2D721EF03F051
:1004B00032BE0FD00F0E006E313800160A0E005CEF
:1004C00003E2300E002602D03250002600C034F085
:1004D000BFDF0F0E31160A0E315C02E2300E02D081
:1004E000329E3250312631C034F0B2DF000CF86A4F
:1004F000D09EEA6AE96A939E8A8E9382939093943F
:100500008A94046A056A066A076A010E086E098001
:100510000992099409860988099A098C099E0A900A
:100520000A92050E0B6E0C6E0A940D6A0E6A010E8D
:100530000F6E0A960A98136A126A116A106A0A9A6A
:10054000030E146E186A176A166A156A1C6A1B6A0B
:100550001A6A196A1D6A0A9C0A8E1E6AC150C00B6B
:100560000F09C16E070EB46EC150C00B0F09C16EEA
:10057000C090C092C094C09EC2809698C69A949E25
:1005800093809392010EC66E000EC76ED190800EBE
:10059000D56ECD6A000ECA6E000ECB6E9484BD6A15
:1005A000B76AB66A070EB46E9250926E100E006E65
:1005B000002EFED70000B450A19CB56A58D5010E9C
:1005C0000C6E020E0B6E0E6E0D6A5FD5F7D6020E24
:1005D000216EFA0E226E00D7212EFBD7010E2D6E52
:1005E0000FDF03C024F002C023F001C022F000C0DE
:1005F00021F0020E2D6E04DF03C028F002C027F0A8
:1006000001C026F000C025F0030E2D6EF9DE03C0F8
:100610002CF002C02BF001C02AF000C029F0040E1B
:100620002D6EEEDE03C030F002C02FF001C02EF0C0
:1006300000C02DF0040EF66E000EF76E0A0E316E3D
:1006400027D724C031F0370E326E32DF23C031F0AD
:10065000370E326E2DDF22C031F0370E326E28DFBA
:1006600021C031F0370E326E23DF2C0E346EF0DEF7
:10067000200E346EEDDE28C031F0370E326E18DFFA
:1006800027C031F0370E326E13DF26C031F0370E3F
:10069000326E0EDF25C031F0370E326E09DF2C0EC0
:1006A000346ED6DE200E346ED3DE2CC031F0370E21
:1006B000326EFEDE2BC031F0370E326EF9DE2AC00C
:1006C00031F0370E326EF4DE29C031F0370E326E63
:1006D000EFDE2C0E346EBCDE200E346EB9DE30C080
:1006E00031F0370E326EE4DE2FC031F0370E326E4D
:1006F000DFDE2EC031F0370E326EDADE2DC031F083
:10070000370E326ED5DE200E346EA2DE0A0E346E47
:060710009FDE5CD7030030
:10000000C9EF02F07374617475733A20254C58205F
:100010000A007374617475733A20254C58200A00E5
:100020006D656173757265643A20254C582C2025E6
:100030004C582C20254C582C20254C58200A0000C8
:100040003750200807E0386E3336343635363636CA
:10005000382EFAD79382939093948A9437C038F0CD
:100060008A8436AE8A9036BE8A8033363436353648
:1000700036368A94003601360236033681A2009065
:1000800081B20080382EECD7000C93968A96366A9F
:10009000356A346A500E336E080E376ED1DF939690
:1000A0008A8631EF03F093968A96366A356A346A07
:1000B000800E336E080E376EC3DF366A356A346AD7
:1000C00004C033F0040E376EBBDF366A356A346A1B
:1000D00005C033F0040E376EB3DF366A356A346A12
:1000E00006C033F0020E376EABDF366A356A346A0B
:1000F00007C033F0020E376EA3DF366A356A346A02
:1001000008C033F0020E376E9BDF000E09B0010EFF
:10011000366A356A346A336E010E376E91DF000E2F
:1001200009B2010E366A356A346A336E010E376ED3
:1001300087DF000E09B4010E366A356A346A336E01
:10014000010E376E7DDF000E09B6010E366A356A84
:10015000346A336E010E376E73DF000E09B8010E7C
:10016000366A356A346A336E010E376E69DF000E07
:1001700009BA010E366A356A346A336E010E376E7B
:100180005FDF000E09BC010E366A356A346A336ED1
:10019000010E376E55DF000E09BE010E366A356A54
:1001A000346A336E010E376E4BDF000E0AB0010E5B
:1001B000366A356A346A336E010E376E41DF000EDF
:1001C0000AB2010E366A356A346A336E010E376E32
:1001D00037DF93968A8693968A96366A356A346AAA
:1001E000810E336E080E376E2BDF366A356A346A3D
:1001F0000BC033F0040E376E23DF366A356A346A7B
:100200000CC033F0040E376E1BDF000E0AB4010E73
:10021000366A356A346A336E010E376E11DF366A1C
:10022000356A346A010E336E376E0ADF366A356A14
:10023000346A0DC033F0030E376E02DF366A356A5A
:10024000346A0EC033F0030E376EFADE366A356A52
:10025000346A336A080E376EF3DE93968A86939675
:100260008A96366A356A346A820E336E200E376E8D
:10027000E7DE366A356A346A0FC033F0030E376E34
:10028000DFDE000E0AB6010E366A356A346A336E56
:10029000010E376ED5DE000E0AB8010E366A356AD9
:1002A000346A336E010E376ECBDE13C036F012C0E7
:1002B00035F011C034F010C033F0130E376EC0DECD
:1002C00093968A8693968A96366A356A346A830E3E
:1002D000336E200E376EB4DE366A356A346A336A9E
:1002E000020E376EADDE000E0ABA010E366A356AAE
:1002F000346A336E010E376EA3DE366A356A346AAD
:1003000014C033F0020E376E9BDE18C036F017C0F3
:1003100035F016C034F015C033F0130E376E90DE92
:1003200093968A8693968A96366A356A346A840EDC
:10033000336E200E376E84DE366A356A346A040EF8
:10034000336E050E376E7CDE1CC036F01BC035F0F8
:100350001AC034F019C033F0130E376E71DE939665
:100360008A8693968A96366A356A346A850E336E23
:10037000200E376E65DE366A356A346A1DC033F08A
:10038000030E376E5DDE000E0ABC010E366A356A5A
:10039000346A336E010E376E53DE000E0ABE010E54
:1003A000366A356A346A336E010E376E49DE366A54
:1003B000356A346A1EC033F0030E376E41DE366A8A
:1003C000356A20C034F01FC033F0100E376E38DEAF
:1003D00093968A8648EF03F093968A96366A356A32
:1003E000346A040E336E080E376E2ADE93968A86C0
:1003F0004FEF03F0EA6A220EE96EEF500DE0060EB1
:10040000016E006A002EFED7012EFBD77B0E006E18
:10041000002EFED7EF2EF3D7000C93968A96366AFD
:10042000356A346A700E336E080E376E09DE9396A5
:100430008A8653EF03F093968A96366A356A346A51
:10044000B40E336E080E376EFBDD366A356A346AD9
:10045000336A100E376EF4DD015001C022F000C087
:1004600021F093968A8621C001F022C002F0000C90
:10047000939E8A9E080E016E00D00000018E0ED061
:10048000019E3432D8B08A8ED8A08A9E018C06D0C4
:10049000019C012EF6D700D000008A8EA70EE96ECF
:1004A000E92EFED700D001BEEBD701BCF1D7000C7E
:1004B0000900F6CF32F0F7CF33F0F5CF34F0D8DFC4
:1004C00032C0F6FF33C0F7FF312EF2D7000C32BE38
:1004D0000FD00F0E006E313800160A0E005C03E2DA
:1004E000300E002602D03250002600C034F0C0DFAB
:1004F0000F0E31160A0E315C02E2300E02D0329E2F
:100500003250312631C034F0B3DF000C93968A9616
:10051000366A356A346A010E336E080E376E90DD26
:1005200093968A8678EF03F0030E225E09E3EA6A67
:10053000220EE96EEF5004E001D000D0EF2EFDD77F
:10054000000C93968A96B00E2D24FF0F326E366AF9
:10055000356A346A336E200E376E72DD366A356A5C
:10056000346A336A200E376E6BDD015003C031F000
:1005700002C030F001C02FF000C02EF093968A86A2
:100580002EC000F02FC001F030C002F031C003F0E7
:10059000000CF86AD09EEA6AE96A939E8A8E93827A
:1005A000939093948A94046A056A066A076A010E16
:1005B000086E09800992099409860988099A098CAC
:1005C000099E0A900A92050E0B6E0C6E0A940D6A33
:1005D0000E6A010E0F6E0A960A98136A126A116A61
:1005E000106A0A9A030E146E186A176A166A156A58
:1005F0001C6A1B6A1A6A196A1D6A0A9C0A8E1E6A9C
:10060000C150C00B0F09C16E070EB46EC150C00BB4
:100610000F09C16EC090C092C094C09EC2809698CF
:10062000C69A949E93809392010EC66E000EC76E7A
:10063000D190800ED56ECD6A000ECA6E000ECB6EC4
:100640009484BD6AB76AB66A070EB46E9250926E11
:10065000100E006E002EFED70000B450A19CB56AAB
:1006600014D5010E0C6E030E0B6E020E0E6E0D6A8B
:10067000FF0E0F6E0A8A136A126A116A106A186AEC
:10068000176A166A156A1C6A1B6A1A6A196A0BD5F8
:1006900095988C98959A8C9A959C8C9C9DD6320EA8
:1006A000226EA8DEBAD6320E226EA4DEC4DE02C0EE
:1006B00022F001C021F0040EF66E000EF76E080E57
:1006C000316EF6DE22C031F0370E326E00DF21C00F
:1006D00031F0370E326EFBDE200E346EC9DE0A0EAC
:1006E000346EC6DE100E006E002EFED700000ED750
:1006F000100E006E002EFED7000095988C8800D05A
:1007000000D0000095988C98020E216EF90E226E92
:100710000BDF212EFBD7959A8C8A100E006E002ECF
:10072000FED70000959A8C9A020E216EF90E226E69
:10073000FBDE212EFBD7959A8C8A100E006E002EC0
:10074000FED70000959A8C9A020E216EF90E226E49
:10075000EBDE212EFBD7959A8C8A100E006E002EB0
:10076000FED70000959A8C9A640E226E43DE63DEFB
:1007700002C022F001C021F0120EF66E000EF76EDC
:10078000080E316E95DE22C031F0370E326E9FDEDC
:1007900021C031F0370E326E9ADE200E346E68DEE4
:1007A0000A0E346E65DE320E226E24DE010E2D6ED0
:1007B000C8DE03C024F002C023F001C022F000C054
:1007C00021F0020E2D6EBDDE03C028F002C027F01E
:1007D00001C026F000C025F0030E2D6EB2DE03C06E
:1007E0002CF002C02BF001C02AF000C029F0040E4A
:1007F0002D6EA7DE03C030F002C02FF001C02EF036
:1008000000C02DF0200EF66E000EF76E0A0E316E4F
:100810004FDE24C031F0370E326E59DE23C031F086
:10082000370E326E54DE22C031F0370E326E4FDE9C
:1008300021C031F0370E326E4ADE2C0E346E18DED7
:10084000200E346E15DE28C031F0370E326E3FDEDA
:1008500027C031F0370E326E3ADE26C031F0370E47
:10086000326E35DE25C031F0370E326E30DE2C0EA2
:10087000346EFEDD200E346EFBDD2CC031F0370E01
:10088000326E25DE2BC031F0370E326E20DE2AC0EC
:1008900031F0370E326E1BDE29C031F0370E326E6A
:1008A00016DE2C0E346EE4DD200E346EE1DD30C039
:1008B00031F0370E326E0BDE2FC031F0370E326E54
:1008C00006DE2EC031F0370E326E01DE2DC031F063
:1008D000370E326EFCDD200E346ECADD0A0E346E29
:1008E000C7DD020E216EFA0E226E84DD212EFBD7AB
:0408F000D9D6030052
:020000040030CA
:0E00000027CC390E0087A1000FC00FE00F4083
:00000001FF
;PIC18F4550
;CRC=E935 CREATED="02-1-11 20:39"
;CRC=0D52 CREATED="02-1-11 23:48"