Hello
I am new to lab jack and i am using it for my Ece final project.
I know there're more than one way to write an output digital syntax but I was wondering if these two below are the same assuming i am using the same number of bits.
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 0, 0, 0); %FIO0 Port0
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 1, 1, 0); %FIO1 Port1
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 2, 1, 0); %FIO2 Port2
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 3, 1, 0); %FIO3 Port3
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 4, 1, 0); %FIO4 Port4
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 5, 0, 0); %FIO5 Port5
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 6, 1, 0); %FIO6 Port6
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 7, 1, 0); %FIO7 Port7
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 8, 0, 0); %EIO1 Port8
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 9, 1, 0); %EIO2 Port9
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 10, 1, 0); %EIO3 Port10
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_BIT, 11, 0, 0); %EIO4 Port11
AND
Error = ljud_ePut (ljHandle, LJ_ioPUT_DIGITAL_PORT, 0, 1758, 12);
%Here i am summing up the decimal values of the active ports together and combining the 12 bit lines into one port line.
I hope what I did made sense.
Yes, your set of LJ_ioPUT_DIGITAL_BIT ePut calls and the one LJ_ioPUT_DIGITAL_PORT ePut call are doing the same thing. The LJ_ioPUT_DIGITAL_PORT call is more efficient when setting multiple digital I/O lines. With your LJ_ioPUT_DIGITAL_PORT call, you are configuring FIO0-EIO4 (12 digital I/O lines starting at FIO0) to b011011011110 (d1758). Each bit represents the high (1) or low (0) output setting of the digital line. Setting digital I/O using the UD driver is documented in the U3 datasheet here:
https://labjack.com/support/datasheets/u3/high-level-driver/example-pseu...