/Modules/TDC/GP201A/SW/PICinterface/GP2.c
0,0 → 1,72
void TDC_init()
{
spi_xfer(TDC_stream,0x70);
}
 
void TDC_reset()
{
spi_xfer(TDC_stream,0x50);
}
 
void TDC_start_cycle()
{
spi_xfer(TDC_stream,0x01);
}
 
void TDC_start_temp()
{
spi_xfer(TDC_stream,0x02);
}
 
void TDC_start_cal_resonator()
{
spi_xfer(TDC_stream,0x03);
}
 
void TDC_start_cal()
{
spi_xfer(TDC_stream,0x04);
}
 
unsigned int32 TDC_get_measurement(int num)
{
spi_xfer(TDC_stream,0xB0 + num - 1);
return spi_xfer(TDC_stream,0,32);
}
 
unsigned int16 TDC_get_status()
{
spi_xfer(TDC_stream,0xB4);
return spi_xfer(TDC_stream,0,16);
}
 
unsigned int8 TDC_get_reg1()
{
spi_xfer(TDC_stream,0xB5);
return spi_xfer(TDC_stream,0,8);
}
 
void TDC_setup_reg1()
{
spi_xfer(TDC_stream,0xB0);
}
 
void TDC_setup_reg2()
{
spi_xfer(TDC_stream,0xB1);
}
 
void TDC_setup_reg3()
{
spi_xfer(TDC_stream,0xB2);
}
 
void TDC_setup_reg4()
{
spi_xfer(TDC_stream,0xB3);
}
 
void TDC_setup_reg5()
{
spi_xfer(TDC_stream,0xB4);
}
/Modules/TDC/GP201A/SW/PICinterface/GP2.h
0,0 → 1,0
#include "GP2.c"
/Modules/TDC/GP201A/SW/PICinterface/main.c
0,0 → 1,27
#include "main.h"
 
#include "GP2.h"
 
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_ccp1(CCP_OFF);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
 
//TDC_reset();
//TDC_init();
while(true)
{
delay_ms(500);
printf("ret: %LX \n", TDC_get_reg1());
};
}
/Modules/TDC/GP201A/SW/PICinterface/main.h
0,0 → 1,39
#include <18F4550.h>
#device adc=8
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES HS //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#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 PLL12 //Divide By 12(48MHz oscillator input)
#FUSES CPUDIV1 //System Clock by 1
#FUSES USBDIV //USB clock source comes from PLL divide by 2
#FUSES VREGEN //USB voltage regulator enabled
#FUSES ICPRT //ICPRT enabled
 
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_B7,rcv=PIN_B6,bits=8)
#use spi(DI=PIN_B1, DO=PIN_B0, CLK=PIN_B2, ENABLE=PIN_B3, stream=TDC_stream) // uses software SPI
 
 
 
/Modules/TDC/GP201A/SW/PICinterface/main.hex
0,0 → 1,38
:10000000A7EF00F07265743A20254C58200A0000D2
:10001000EA6A060EE96EEF500DE0060E016E006A08
:10002000002EFED7012EFBD77B0E006E002EFED7D2
:10003000EF2EF3D7E8EF00F00950200807E00A6E32
:1000400005360636073608360A2EFAD7938293907D
:1000500093948A9493968A9609C00AF08A8408AE8B
:100060008A9008BE8A8005360636073608368A9496
:10007000003601360236033681A2009081B200803C
:100080000A2EECD78A86000C086A076A066AB50E43
:10009000056E200E096ED0DF086A076A066A056AD7
:1000A000080E096EC9DF00C001F0EBEF00F0939E6F
:1000B0008A9E080E016E00D00000018E0ED0019EB7
:1000C0000932D8B08A8ED8A08A9E018C06D0019CB5
:1000D000012EF6D700D000008A8EA70EE96EE92E19
:1000E000FED700D001BEEBD701BCF1D7000C090050
:1000F000F6CF07F0F7CF08F0F5CF09F0D8DF07C04B
:10010000F6FF08C0F7FF062EF2D7F4EF00F007BEA7
:100110000FD00F0E006E063800160A0E005C03E2C8
:10012000300E002602D00750002600C009F0BFDFC5
:100130000F0E06160A0E065C02E2300E02D0079E73
:100140000750062606C009F0B2DFF9EF00F0F86AA2
:10015000D09EEA6AE96A939E8A8E938293909394E2
:100160008A9493968A96C150C00B0F09C16E070EF0
:10017000B46EC150C00B0F09C16EC090C092C09444
:10018000C09EC2809698C69A949E93809392010EC8
:10019000C66E000EC76ED190800ED56ECD6A000E71
:1001A000CA6E000ECB6E9484BD6AB76AB66A070E3B
:1001B000B46E9250926E100E006E002EFED70000AC
:1001C000B450A19CB56A020E056EFA0E066E20D7D9
:1001D000052EFBD759D701C005F0040EF66E000EB0
:1001E000F76E050E066E83D705C006F0370E076E54
:1001F0008ED7200E096E5BDF0A0E096E58DFE3D73B
:020200000300F9
:020000040030CA
:0E00000027CC390E0087A1000FC00FE00F4083
:00000001FF
;PIC18F4550
;CRC=5083 CREATED="27-12-10 01:06"
/Modules/TDC/GP201A/SW/PICinterface/main.pjt
0,0 → 1,28
[PROJECT]
Target=C:\Users\kakl\Documents\MLAB\Modules\TDC\GP201A\SW\PICinterface\main.hex
Development_Mode=
Processor_Text=PIC18F4550
ToolSuite=CCS
Processor=0x4550
[C:\Users\kakl\Documents\MLAB\Modules\TDC\GP201A\SW\PICinterface\main]
Type=4
Path=
FileList=
BuildTool=
OptionString=
AdditionalOptionString=
[mru-list]
1=C:\Users\kakl\Documents\MLAB\Modules\TDC\GP201A\SW\PICinterface\main.c
[Windows]
0=0000 %S 0 0 796 451 3 0
[Units]
Link=0
Count=1
1=C:\Users\kakl\Documents\MLAB\Modules\TDC\GP201A\SW\PICinterface\main
[Opened Files]
1=main.c
2=main.h
3=..\..\..\..\..\..\..\..\..\Program Files\PICC\Devices\18F4550.h
4=GP2.c
5=GP2.h
6=