06-04-2008 05:39 PM - edited 06-04-2008 05:40 PM
06-05-2008 06:17 PM
06-06-2008 07:21 AM
The code snipet below shows how I am configuring a 16 bit port (Ports 0 and 1). Just for a bit more detail, the Radar system that the 6537
is attached to is programmed with a simple I/O board. There is no driver involved, so I manually watch the handshake lines to know how
and when to transfer data to the 6537 device. The radar does the following:
1) Wait for ACK1 LOW
2) Put 16 bits of data on lines
3) Pull REQ1 HIGH
4) Wait ACK1 HIGH
5) Pull REQ1 LOW
6) Wait ACK1 LOW
7) Put 16 bits of data on lines
😎 Pull REQ1 HIGH
and so on for a finite number of samples.
--------------------------------------
/*******************************************************************/
BOOL InitDio_32HS ()
/*******************************************************************/
{
static short iDevice = 1;
static short iGroup1 = 1;
static short iGroup2 = 2;
static short iGroupSize2 = 2;
static short iMode = 0;
static short iPort0 = 0;
static short iDirIn = 0;
static short iDirOut = 1;
static short iLatched = 1;
static short iIgnoreWarning = 0;
static short iYieldON = 1;
static short iProtocol = 1; // 0=Level-ACK
// 1=Pulsed-ACK
// 2=Pulsed-ACK (long pulse)
// 3=Burst
// 4=8255 emulation
static short iEdge = 0; // 0=Leading edge
// 1=Trailing edge
static short iReqPol = 0; // 0=Active high
// 1=Active low (inverted)
static short iAckPol = 0; // 0=Active high
// 1=Active low (inverted)
static short iAckDelayTime = 0; // 0= 0 ns
// 1=100 ns
// |
// 7=700 ns
// DMA Setup
// Configure group of ports (A, B) as input, with handshaking.
iStatus = DIG_Grp_Config(iDevice, iGroup1, iGroupSize2, iPort0, iDirIn);
iRetVal = NIDAQErrorHandler(iStatus, "DIG_Grp_Config",iIgnoreWarning);
iStatus = DIG_Grp_Mode(iDevice, iGroup1, iProtocol, iEdge,
iReqPol, iAckPol, iAckDelayTime);
iRetVal = NIDAQErrorHandler(iStatus, "DIG_Grp_Mode",iIgnoreWarning);
iStatus = Set_DAQ_Device_Info(iDevice, ND_DATA_XFER_MODE_DIO_GR1,
ND_UP_TO_1_DMA_CHANNEL); // PCI-DIO32HS
iRetVal = NIDAQErrorHandler(iStatus, "Set_DAQ_Device_Info",iIgnoreWarning);
iStatus = Config_DAQ_Event_Message(iDevice, 1, "DI0", 2, 0, 0, 0, 0, 0,
0, 0, (LPARAM)Event_Proc);
iRetVal = NIDAQErrorHandler(iStatus, "DIG_Prt_Config",iIgnoreWarning);
}
-------------------------------------------------
Thanks for any insight.
06-06-2008 06:30 PM
Hi CQuestOrlando,
Unfortunately, the PCI-6537 does not support Level-Ack Handshaking and therefore, we are stuck with using the 8255 protocol. Since this handshaking is done in hardware, there is nothing we can do to change the handshaking behavior. If you take a look in chapter 5 of the following document, you will notice slight differences between the Level-Ack and the 8255 protocols.
Because of the similarity in behavior in behavior between the two protocols, I cannot be sure that the 8255 handshaking will not work with your radar. I would recommend trying the C example program for 8255 Handshaking found in the following directory:
...\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Handshaking\8255\Input-8255 with Delays
Because your PCI-6533 can also operate using 8255 handshaking, you can use this example program to see if your radar can communicate with this protocol. If that is the case, then there should be no problems moving on to the 6537. However, since this program will be written in DAQmx, you must make sure to have the drivers installed before running this program. Note that since the naming conventions have changed between DAQmx and Traditional DAQ, you may have to make slight modifications to the code. Please refer to the following link for details.
http://digital.ni.com/public.nsf/allkb/39F8242E2553F63E86256FE3007BF69F?OpenDocument
S_Hong
04-02-2010 12:10 AM
04-02-2010 01:12 AM