Hello everybody,
I'm using the RealTime OS CeWin from KukaControls to access an E-Series NI DAQ Card.
I've read the Register Programming Manual and the STC Technical Reference Manual, but it doesn't seem to work. Here's my simple C++ example:
#define STC BaseAddressSTC
#define MITE BaseAddressMITE
class CNICard
{
public:
char PCIInit();
void WriteByte(DWORD Addr, WORD Offset, BYTE Data);
BYTE ReadByte(DWORD Addr, WORD Offset);
WORD ReadWord(DWORD Addr, WORD Offset);
void WriteWord(DWORD Addr, WORD Offset, WORD Data);
DWORD ReadDWord(DWORD Addr, WORD Offset);
void WriteDWord(DWORD Addr, WORD Offset, DWORD Data);
void DOTest();
private:
DWORD BaseAddressSTC;
DWORD BaseAddressMITE;
};
char CNICard::PCIInit()
{
BOOL Result;
DWORD VirtAddress;
CEWINPCIINFO PciInfo;
DWORD BaseAddressBAR0;
DWORD BaseAddressBAR1;
DWORD Reg;
DWORD Value;
Result = CeWinPciGetInfo(NIDAQ_NAME, &PciInfo);
if(!Result)
{
return 1;
}
//Mapping of BAR0
VirtAddress = CeWinPciMapMemory(&PciInfo, NIDAQ_MEM_INDEX_BAR0);
if (VirtAddress == 0)
{
return 1;
}
BaseAddressBAR0 = (volatile) VirtAddress;
//Mapping of BAR1
VirtAddress = CeWinPciMapMemory(&PciInfo, NIDAQ_MEM_INDEX_BAR1);
if (VirtAddress == 0)
{
return 1;
}
BaseAddressBAR1 = (volatile) VirtAddress;
BaseAddressMITE = BaseAddressBAR0;
BaseAddressSTC = BaseAddressBAR1;
WriteDWord(MITE,0xc0,(PciInfo.Window.memWindows[0x1].dwBase & 0xffffff00) | 0x80);
Value = ReadDWord(MITE,0x300); //For Testing only, here it returns the correct device and vendor id
//PCI-Karte gefunden
return 0;
}
void CNICard::DOTest()
{
WriteByte(STC,0x0b,0xff); //Config as outputs
for (int port_val = 0; port_val< = 255; port_val++)
{
WriteByte(STC,0x0a, port_val);
}
}
As is already wrote in the comment, the MITE returns the correct values for device and vendor id, so it's adresses correctly.
The adresses are Bar0(MITE) 0xE8201000 and Bar1(STC) 0xE8200000, which is masked and written back to the MITE.
But on the digital output lines of the card i can't see anything. Can anybody help? Is there any test I can perform to check that the STC is adressed correctly?
Thanks and greetings from Germany,
Thomas
Message Edited by ThomasF on 03-08-2006 05:46 AM
Message Edited by ThomasF on 03-08-2006 05:48 AM