请参阅QHYCCD API的帮助文档以执行基本图像操作。 以下是操作GPS部件的附加API。
调整VCOX频率。
VCOX输出为10MHz,但频率随温度和时间而变化。 为了获得准确的10MHz频率,您可以设置它。 首先,您需要知道它的当前频率。 您可以读取每两个PPS信号的时钟计数。 如果是10MHz,则计数为10,000,000。 (请注意,当GPS未锁定时,没有PPS信号且计数将为10,000,500,这是没有用的,请不要使用此值来校准VCOX)。
请不要将频率调整到超过10,000,500的计数器。 因为FPGA会认为10,000,500是PPS信号丢失的条件。
set_GPS_VCOX_Freq(unsigned short i); The input range of i is 0-4095
Set the Calibration LED Enable
set_GPS_LEDCAL_Mode(unsigned char i);
i=0:disable LED light 1:enable LED light
Set LED pulse position for shutter starting exposure
set_GPS_POSA(unsigned char is_slave,unsigned long pos,unsigned char width);
is_slave:0:主模式1:从模式。 应根据相机使用的模式设置此值。
pos:LED脉冲灯位置
宽度:LED脉冲光宽
当你改变曝光。 你必须设置这个位置。 测量电路将该位置用作快门开始时间。
Set LED pulse position for shutter ending exposure
set_GPS_POSB(unsigned char is_slave,unsigned long pos,unsigned char width);
is_slave:0:主模式1:从模式。 应根据相机使用的模式设置此值。
pos:LED脉冲灯位置
宽度:LED脉冲光宽
当你改变曝光。 你必须设置这个位置。 测量电路将此位置用作快门结束时间。
Set Master/Slave Mode
set_GPS_MasterSlave(unsigned char i);
i=0: Master mode 1:Slave mode
When in slave mode, set the parameter.
set_GPS_SlaveMode_Parameter(unsigned long target_sec,unsigned int target_us,unsigned int deltaT_sec,unsigned int deltaT_us,unsigned int expTime)
The target_sec is the “JS” that QHYCCD defined. It is reference to a time.
Image Heady的数据结构调用API:
相机记录GPS信息并插入每个帧的头部。 该功能可以通过API启用
ret=SetQHYCCDParam(g_hCam,CAM_GPS,1);
并可以通过调用API禁用:
ret=SetQHYCCDParam(g_hCam,CAM_GPS,0);
ImageHead Shift
序列号是帧的硬件计数器。 它将从零开始,每帧将添加一个。 它将从cmos相机开始工作开始
0 Sequence Number MSB
1 Sequence Number
2 Sequence Number
3 Sequence Number LSB
4 temporary Sequence Number (Normally no use)
5 Image Width MSB
6 Image Width LSB
7 Image Height MSB
8 Image Height LSB
Latitude is the current latitude report by GPS.
9 latitude MSB
10 latitude
11 latitude
12 latitude LSB
Latitude is the current longitude report by GPS.
13 longitude MSB
14 longitude
15 longitude
16 longitude LSB
17 Start_Flag
Shutter start time (JS)
18 Start Second MSB
19 Start Second
20 Start Second
21 Start Second LSB
22 Start micro second MSB
23 Start micro second
24 Start micro second LSB
25 End flag
Shutter end time (JS)
26 End Second MSB
27 End Second
28 End Second
29 End Second LSB
30 End micro second MSB
31 End micro second
32 End micro second LSB
33 now flag: this can be used for the GPS statu indicator bit[7..4] is the
The now time is the time that of the vertical sync of the CMOS sensor. It does not the precision time of shutter open or close
34 now second MSB
35 now second
36 now second
37 now second LSB
38 now micro second MSB
39 now micro second
40 now micro second LSB
The counter value of two PPS. it should be about 10,000,000. But since the temperature of the crystal. It is not exactly the 10,000,000. You can adjust the VCXO to let it close to it. And when the PPS signal lost, it will become 10,000,500. When exceed this value, FPGA will generate a second to instead of the GPS PPS signal to avoid the second counter lost one second.
41 count of PPS MSB
42 count of PPS
43 count of PPS LSB
Reference codes:
unsigned int seqNumber=0;
unsigned int seqNumber_old=0;
unsigned char tempNumber=0;
unsigned short width=0;
unsigned short height=0;
unsigned int latitude=0;
unsigned int longitude=0;
unsigned char start_flag=0;
unsigned int start_sec=0;
unsigned int start_us=0;
unsigned char end_flag=0;
unsigned int end_sec=0;
unsigned int end_us=0;
unsigned char now_flag=0;
unsigned int now_sec=0;
unsigned int now_us=0;
unsigned int max_clock=0;
seqNumber=256*256*256*imageHead[0]+256*256*imageHead[1]+256*imageHead[2]+imageHead[3];
tempNumber=imageHead[4];
width=256*imageHead[5]+imageHead[6];
height=256*imageHead[7]+imageHead[8];
latitude= 256*256*256*imageHead[9]+256*256*imageHead[10]+256*imageHead[11]+imageHead[12];
longitude=256*256*256*imageHead[13]+256*256*imageHead[14]+256*imageHead[15]+imageHead[16];
start_flag=imageHead[17];
start_sec=256*256*256*imageHead[18]+256*256*imageHead[19]+256*imageHead[20]+imageHead[21];
start_us =256*256*imageHead[22]+256*imageHead[23]+imageHead[24];
end_flag=imageHead[25];
end_sec=256*256*256*imageHead[26]+256*256*imageHead[27]+256*imageHead[28]+imageHead[29];
end_us =256*256*imageHead[30]+256*imageHead[31]+imageHead[32];
now_flag=imageHead[33];
now_sec=256*256*256*imageHead[34]+256*256*imageHead[35]+256*imageHead[36]+imageHead[37];
now_us =256*256*imageHead[38]+256*imageHead[39]+imageHead[40];
max_clock=256*256*imageHead[41]+256*imageHead[42]+imageHead[43];
decodeJS(start_sec,timeZone,JD,h,m,s); //this function can convert the JS to the JD time
and maybe you can use the following API(windows or Linux) to convert the JD time to local time.
JulianDateToDateTime(JD)
Void decodeJS(unsigned int JS,double timeZone,double &JD,unsigned char &h,unsigned char &m,unsigned char &s){
unsigned int k;
JD=JS/3600/24+2450000;
k=fmod(JS,3600*24);
h=k/3600;
k=fmod(k,3600);
m=k/60;
k=fmod(k,60);
s=k;
JD=double(JD)+ 0.5+ ((double)(h+timeZone)*3600+(double)m*60+(double)s)/3600/24;
}
如何使用从属模式同步所有QHY174GPS相机以一起开始曝光
无论相机位于何处,无论它们之间的距离有多长。 您可以获得所有QHY174GPS相机的同步曝光开始时间。 这是一个很棒的功能,你可以非常快速地建立你观察团队,并让他们获得同步捕获,高达1us精度,环绕整个地球。
激活从机模式非常简单。 只需使用两个API:
// set the parameters at first
set_GPS_SlaveMode_Parameter(target_sec,target_us,deltaT_sec,deltaT_us,expTime) ;
// switch camera to slave mode
set_GPS_MasterSlave(1);
the target_sec is the JS we defined in our system. The second you get from the image head is just this value.
expTime unit is us. Please note the deltaT must > expTime.
eg. Today is 2017.10.19 0:30 and we can get the JS=695925030
Now we want to let the camera start exposure at 0:40:000000 (10minutes later). The exposure time is 100ms per frame. The interval is 200ms per frame.
target_sec=695925030+600;
target_us=0;
deltaT_sec=0
deltaT_us=200*1000;
expTime=100*1000;
set_GPS_SlaveMode_Parameter(target_sec,target_us,deltaT_sec,deltaT_us,expTime) ;
If want to switch back from the slave mode to master mode ,just call:
set_GPS_MasterSlave(0);