12-18-2019 04:00 PM
Hello!
I am using the USB-8451 OEM, and I am using the C library to control it. So far, I'm able to use SPI without issue, and the DIO inputs are working just fine. I've been trying to configure P0.1 and P0.2 as outputs, but they have not been functional so far. I have tried several things:
Here is simplified pseudo code for what I'm executing:
#include "nu845x.h"
#define PAIR_DIOLINE 0x02 // second DIO line
#define POWER_DIOLINE 0x04 // third DIO line
void main()
{
// Find the only NI device
char pFirstDevice[256];
if (ni845xFindDevice(pFirstDevice, NULL, NULL))
return;
// Open the device
NiHandle handle = 0;
if (ni845xOpen(pFirstDevice, handle))
return;
// Set P0.1 and P0.2 to outputs
uInt8 portMap = 0;
portMap |= (PAIR_DIOLINE & POWER_DIOLINE);
if (ni845xDioSetPortLineDirectionMap(handle, PORT_0, portMap))
return;
// Set our outputs high
uInt8 pWriteData = 0;
pWriteData |= (PAIR_DIOLINE & POWER_DIOLINE);
if (ni845xDioWritePort(handle, PORT_0, pWriteData))
return;
}
This problem seems similar to an old, unresolved thread:
We only have this one USB-8451 board now, but it is new and has only been used for this purpose.
I greatly appreciate any suggestions or help you can provide!
-Matt Riggs
10-21-2020 12:29 PM
Was this ever fixed? I have the USB8451 and I cannot get the digital output lines to respond to high/low settings. I'm using the LabVIEW pallet SPI tools.
10-21-2020 12:40 PM
In my case, the LabVIEW pallet VI write digital line doesn't configure the port for output. Despite being called "write" that has to be done prior to calling the write VI.