Discussion:
question about M series DIO
(too old to reply)
david2k
2008-04-08 14:40:12 UTC
Permalink
In the dioex2.cpp, what does the PFI_Output_Select_(n) mean? n = 1,2,3,4,5,6

 

If I want to program every pin, should I  use PFI function?

Does the board->PFI_DI represent the P0.0~p0.5?

Does the board->PFI_DO represent the P1.0~p1.3?
Tom W [DE]
2008-04-08 19:40:10 UTC
Permalink
Hi David-
The PFI_Output_Select registers are used to determine which lines are routed to the PFI outputs on the STC-II (and which eventually route to the I/O connector of the device).
Each PFI_Output_Select register contains three PFI lines.  These are:
PFI_Output_Select_1: PFI2, PFI1, PFI0PFI_Output_Select_2: PFI5, PFI4, PFI3PFI_Output_Select_3: PFI8, PFI7, PFI6PFI_Output_Select_4: PFI11, PFI10, PFI9PFI_Output_Select_5: PFI14, PFI13, PFI12PFI_Output_Select_6: PFI15
The layout of the register is three 5-bit enum values, right-justified (i.e. PFI0 is bits 0-4, PFI1 is bits 5-9, etc) with any unused bits being "don't care".  The enum values for each PFI line are:

? 0 : Default

? 1 : AI_Start1_PFI

? 2 : AI_Start2_PFI

? 3 : AI_CONVERT

? 4 : G1_selected_SRC

? 5 : G1_selected_GATE

? 6 : AO_UPDATEn

? 7 : AO_Start1_PFI

? 8 : AI_START_Pulse

? 9 : G0_selected_SRC

? 10: G0_selected_GATE

? 13: G0_out

? 14: G1_out

? 15: Freq_Out

? 16: PFI_DO

? 17: Analog_Trig

? 18: RTSI0

? 19: RTSI1

? 20: RTSI2

? 21: RTSI3

? 22: RTSI4

? 23: RTSI5

? 24: RTSI6

? 25: RTSI7

? 29: CDI_SAMPLE_CLK

? 30: CDO_SAMPLE_CLK

? 31: Logic low
Which M Series devices are you planning to use?  In another post you mention the 6230 and 6232.  Neither of these are supported by the MHDDK, but they should be easy enough to program.  I would recommend setting all of the PFI lines to PFI_DO if you are planning to use the device for static DIO operations.  The board will power up with the line directions set correctly as either input or output.  Then you can either write data to PFI_DO or read from PFI_DI and mask out values as specified here:
PFI0-PFI5 = inputPFI6-PFI9 = output
 
Hopefully this helps-Message Edited by Tom W [DE] on 04-08-2008 02:36 PM
david2k
2008-04-09 00:40:07 UTC
Permalink
Nw I have five kind fo card, they are 6230,6232,6723,7831 and 7811. I have do well with the 78XX seriels cards.  but feel comfused with the M serials card.  Using the NI ddk. The DAC of the 6230 and 6232 can work properly, but the 6723 doesn?t work.does it not belong to the M serials ? so How can I make it to D/A ? and this morning I will try to use the DIO of the 6230 and 6232 following your words.

Thanks a lot!
david2k
2008-04-09 03:10:06 UTC
Permalink
These are the codes I used to program the PFI lines of 6230 and 6232, but it just can?t work properly:

// Is this necessary to set the directions of the PFI lines ?

board->IO_Bidirection_Pin. writeRegister (0x3c0);

// Set all the ten PFI lines as PFI_DO

board->PFI_Output_Select_1. writeRegister (0x4210); board->PFI_Output_Select_2. writeRegister (0x4210);

board->PFI_Output_Select_3. writeRegister (0x4210);

board->PFI_Output_Select_4. writeRegister (0x10);

//now set PFI 6~9 to High 

board->PFI_DO.writeLowerPort (0x3c0);  //does the function work?

board->PFI_DO.writeUpperPort (0x3c0);  // or the function work?

board->PFI_DO.writeRegister (0xff00);   // or the function work?

// ---- Read-back value ----

u16 value;

value = (u16) (board->PFI_DI. readRegister()); // does the function work?

 

Would you tell why the codes just can?t work? What is the problem?

Can you just tell me the offset of all the registers needed to program the DIO and the sequence to set the registers?
Tom W [DE]
2008-04-09 14:10:11 UTC
Permalink
Hi David-
 
As I mentioned in my previous post, for the 623x devices the board will power up with the line directions set correctly as either input or output.  It is not necessary to adjust the line directions with a call to set the IO_Bidirection_Pin register.
 
The LowerPort for PFI_DO refers to the lower 8 PFI lines, namely PFI0-PFI7.  The UpperPort refers to PFI8-PFI15.  In my earlier post I mentioned that the input lines are PFI0-PFI5 and output are PFI6-PFI9.  So, for the output lines you need to write (0xC0 & value) to PFI_DO.LowerPort and (0x3 & value) to PFI_DO.UpperPort.  For input, you can simply read PFI_DI and then determine value = (0x3F & board->PFI_DI.readRegister()).
Loading...