Hi Gus,
The Gi_Gate_Error_St does go true at the end of each period of the gate signal. That signal is a squarewave with a 1ms period and a 50% pulse width.
I'm using the Gi_Gate_St bit because I need to know the state of the gate and the moment when the state changes. I'm only reading the Gi_Gate_St bit.
I'm sending you the part of my code where I'm reading the G0_HW_Save_Registers, the Gi_Gate_St and the Gi_Gate_Error_St. The code is in C language.
Code:
/******************************************************************************************
val.reg.low_reg = DAQ_STC_Windowed_Mode_Read(base, G0_HW_Save_Registers_Low);
if (val.reg.low_reg < old_low_reg) {
val.reg.high_reg = DAQ_STC_Windowed_Mode_Read(base, G0_HW_Save_Registers_High);
} old_low_reg = val.reg.low_reg;
y[1] = (real_T) val.val;
y[2] = (DAQ_STC_Windowed_Mode_Read(base, G_Status_Register) & 0x4000)/16384;
if(y[2]>0){
STCWRITE16 DAQ_STC_Windowed_Mode_Write(base, Interrupt_A_Ack_Register, 0xC060);
}
y[0] = (DAQ_STC_Windowed_Mode_Read(base, Joint_Status_1_Register) & 0x0004)/4;
******************************************************************************************/
Description:
-base is the base address of the PCI-MIO-16E-4 board
-I'm using a union to get the two parts of the G0_HW_Save_Registers.
That union is define this way:
/****************************************
typedef union counter_tag {
struct reg_tag {
unsigned short low_reg;
unsigned short high_reg;
} reg;
unsigned int val;
} counter_val;
counter_val val;
****************************************/
-I'm reading the high part of the G0_HW_Save_Registers only when the low part roll over.
-I'm using the y[0] output to plot the Gi_Gate_St bit, the y[1] output to plot the G0_HW_Save_Registers and the y[2]output to plot the Gi_Gate_Error_St bit.
-I'm also reseting the Gi_Gate_Error_St bit when it comes true with the Gi_Gate_Error_Confirm bit.
Thanks
François Perreault