Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

6602 DIO problem

Hello,
I have a 6602 counter/timer board.
I'm trying to use DIO with DDK on Windows system.
When I configure pins 0 to 7 in output, pins 0 (PFI_0) and 4 (PFI_4) goes to logic level "1".
If I write with DIO_Parallel_Data_Out a sequence of number, pins 0 and 4 never changes its state.

This is the code, based on gpct_ex*.cpp:

//DIO example code starts here
void test(iBus *bus)
{
tAddressSpace cardSpace;
tTIO *board;
int i;

cardSpace = bus->createAddressSpace(kPCI_BAR1);
board = new tTIO(cardSpace);

//Configure all 8 Digital lines as Output
board->IO_Pin_0_1_Configuration_Register.writeIO_Pin_0_Select(1);
board->IO_Pin_0_1_Configuration_Register.writeIO_Pin_1_Select(1);
board->IO_Pin_2_3_Configuration_Register.writeIO_Pin_2_Select(1);
board->IO_Pin_2_3_Configuration_Register.writeIO_Pin_3_Select(1);
board->IO_Pin_4_5_Configuration_Register.writeIO_Pin_4_Select(1);
board->IO_Pin_4_5_Configuration_Register.writeIO_Pin_5_Select(1);
board->IO_Pin_6_7_Configuration_Register.writeIO_Pin_6_Select(1);
board->IO_Pin_6_7_Configuration_Register.writeIO_Pin_7_Select(1);

//Write data to DIO, only one bit high at time.
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0x0);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(1);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(2);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0x0);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(4);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0x0);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(8);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0x0);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(16);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0x0);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(32);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0x0);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(64);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0x0);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(128);
board->DIO_Output_Register.writeDIO_Parallel_Data_Out(0x0);

//Configure all 8 Digital lines as Input
board->IO_Pin_0_1_Configuration_Register.writeIO_Pin_0_Select(0); //0='input'
board->IO_Pin_0_1_Configuration_Register.writeIO_Pin_1_Select(0);
board->IO_Pin_2_3_Configuration_Register.writeIO_Pin_2_Select(0);
board->IO_Pin_2_3_Configuration_Register.writeIO_Pin_3_Select(0);
board->IO_Pin_4_5_Configuration_Register.writeIO_Pin_4_Select(0);
board->IO_Pin_4_5_Configuration_Register.writeIO_Pin_5_Select(0);
board->IO_Pin_6_7_Configuration_Register.writeIO_Pin_6_Select(0);
board->IO_Pin_6_7_Configuration_Register.writeIO_Pin_7_Select(0);

delete board;
bus->destroyAddressSpace(cardSpace);
}


Does anyone know what is the problem with it?

Thank you
0 Kudos
Message 1 of 5
(8,333 Views)
See RLPM page 3-38, STC_DIO_Control register for enabling these outputs, then
see RLPM page 3-37, STC_DIO_Output register for setting the outputs.
It works.
Don't do this for both TIO's.
0 Kudos
Message 2 of 5
(8,333 Views)
Thanks a lot Ben, it works fine.
Another question: is possible to use more than 8 DIO?
0 Kudos
Message 3 of 5
(8,333 Views)
I do not have experience with more than 8 DIO.
The 6602 user manual page 4-10...4-13 gives the impression that it is possible.
But is not documentend in the RLPM, it should have been on page 3-43 of the RLPM, but 'Output Select' seems to be not fully documented there.
0 Kudos
Message 4 of 5
(8,333 Views)
I do not have experience with more than 8 DIO.
The 6602 user manual page 4-10...4-13 gives the impression that it is possible.
But is not documentend in the RLPM, it should have been on page 3-43 of the RLPM, but 'Output Select' seems to be not fully documented there.
0 Kudos
Message 5 of 5
(8,333 Views)