Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing full 32 DIO lines on PCI-6602 in C++

Hi,
 
I have seen a couple of posts on this topic, but none seem to contain an answer to the question, and the documentation in the Register Level Programming Manual appears to be incomplete.
 
We need to access the full 32 DIO lines on the PCI-6602 card; however, only the first 8 lines (those driven by the STC) are documented.  Is there any example code or further info that would allow us to use this functionality? 
 
We are programming in C++, using the Driver Development Kit, in QNX.
 
Any help would be much appreciated.
 
Cheers,
 
Monte
0 Kudos
Message 1 of 2
(7,289 Views)

The 32-bit digital port registers were not included in the chipobject (by mistake).  The digital intput register is at offset 0x414 and the digital output register is at 0x510.  To access them you can use the tAddressSpace object directly:

u32 value;
value = Bar1.readU32(0x414); // read digital 32-bit port
Bar1.writeU32 (0x510, value); // write digital 32-bit port

For configuration, use the IO_Pin_x_x_Configuration_Register registers to configure the line for input or output. 

For example,  to configure line 0 and 1 for input

tio->IO_Pin_0_1_Configuration_Register.setIO_Filter_0_Select (0); // no filter
tio->IO_Pin_0_1_Configuration_Register.setIO_Pin_0_Select (0); //input
tio->IO_Pin_0_1_Configuration_Register.setIO_Filter_1_Select (0); // no filter
tio->IO_Pin_0_1_Configuration_Register.setIO_Pin_1_Select (0); //input
tio->IO_Pin_0_1_Configuration_Register.flush (0);

or lines 29, 30 and 31 for output:

tio->IO_Pin_28_29_Configuration_Register.setIO_Filter_29_Select (0); //no filter
tio->IO_Pin_28_29_Configuration_Register.setIO_Pin_29_Select (2); // digital output
tio->IO_Pin_28_29_Configuration_Register.flush (0);

tio->IO_Pin_30_31_Configuration_Register.setIO_Filter_30_Select (0); //no filter
tio->IO_Pin_30_31_Configuration_Register.setIO_Pin_30_Select (2); // digital output
tio->IO_Pin_30_31_Configuration_Register.setIO_Filter_31_Select (0); //no filter
tio->IO_Pin_30_31_Configuration_Register.setIO_Pin_31_Select (2); // digital output
tio->IO_Pin_30_31_Configuration_Register.flush (0);

valid values for the select field are:

0 - input
1 - counter output
2 - digital output

 

I hope this helps.

Message 2 of 2
(7,273 Views)