# LabVIEW

cancel
Showing results for
Did you mean:

## DIGITAL I/O SETTINGS

Are the DIGITAL I/O Settings, Port 1, Port 2, Port 3 and Port 4 same as Pin 25,27,29 & 31 of the connector block to the 6025E DAQ card?
Message 1 of 42
(3,679 Views)

## Re: DIGITAL I/O SETTINGS

Hi there,

-If you consider port 1 as the standard DIO Port, ie, present on 6025,6023 and 6024 the eight digital lines DIO<0..7> composing that port are PINs 25 to 32 + DGND 924 for eg.0
- Port 2 would be PA<0..7> ie pins 97,95,93,91,89,87,85,83
+ DGND
- Port 3 would be PB<0..7> ie pins 81,79,77,75,73,71,69,67
+ DGND
- Port 4 would be PC<0..7> ie pins 65,63,61,59,57,55,53,51
+ DGND

Regards,
Cyril Bouton
Active LabVIEW Developper
Message 2 of 42
(3,664 Views)

## Re: DIGITAL I/O SETTINGS

Hello Cyril,

If port 1 has 8 digital lines, how does the Computer knows that DIO 25 is STEP, DIO 27 DIRECTION, DIO 29 is PRESET and DIO 31 is CLOCK? Is it done through MAX AUTOMATION?
Message 3 of 42
(3,638 Views)

## Re: DIGITAL I/O SETTINGS

The computer does not care what you call your lines. Your program has to deal with it. Each port has 8 bits. You have to extract the individual bits from the byte that is returned by the DIO Read. For instance, if line 25 is the least significant bit (A0), you would use the AND function, the received byte AND 0x01. If the bit is hi, the AND will produce a 1. If the bit is low, the AND will produce a 0. This would be your STEP bit. Your DIRECTION bit (A1) would be obtained by the received byte AND 0x02. A high bit would produce a 2, a low bit will produce a 0. The third bit (A2) would be obtained by received byte AND 0x04, and would produce a 4 if hi, 0 if low.... and so on.
Example: Received byte = 00110011. Then 00110011 AND 00000010 will produce 00000010, which is 2, and your DIRECTION bit would be high.
- tbob

Inventor of the WORM Global
Message 4 of 42
(3,637 Views)

## Re: DIGITAL I/O SETTINGS

Can you guide me to a website that explains PORT and LINES, HI and LOW etc. in plain ENGLISH. If not a good book will sufice.
Message 5 of 42
(3,624 Views)

## Re: DIGITAL I/O SETTINGS

Hello tbob,

I have part of a program that controls a stepper given to me that is suppose to work. Can you explain why pattern is sometime 80 and sometime 90? The VI is attached.
Message 6 of 42
(3,617 Views)

## Re: DIGITAL I/O SETTINGS

You have a lot of background to learn first before tackling DIOs. First of all, DIOs deal with TTL levels. This means 5 volts represent a logic high (or 1 or ON), and 0 volts represent a logic low (or 0 or OFF). In actuality, a high level can be anywhere from 3.8 volts to 5 volts. A logic low can be from 0 volts to 0.8 volts. You need to learn the Binary numbering system, where there are only two states, either On or Off (also represented by True/False or 1/0 or Hi/Lo). A binary number consists of only ones and zeroes. Instead of my trying to give a lesson here, it would be better if you searched the internet for a tutorial on the Binary and Hexidecimal numbering systems. Then you will be better prepared to understand about Ports and Lines and DIOs.
Your question about 80 and 90, these are hex values that are written to the port. The value determines which lines go hi (5V) and which lines go lo (0V). You must change the number to one that suits your applications. But first you need to learn the binary and hex numbering system. After you have a good understanding of this, post again and I can help you with the DIO Ports and Lines.
- tbob

Inventor of the WORM Global
Message 7 of 42
(3,603 Views)

## Re: DIGITAL I/O SETTINGS

I have foolowed your advice. I understand decimal(base=10), binary(base=2) and hexidecimal(base=16) numbers.

Here's the number 137:

65536 4096 256 16 1
8 9

0 X 65536 = 0 (0 sixty-five thousand five hundred thirty-sixes)
0 X 4096 = 0 (0 four thousand ninety-sixes)
8 X 16 = 128
9 X 1 = 9
0 + 0 + 128 + 9 = 137

Decimal 137 = 89h (Hexidecimal

How does it relate to 80 or 90 pattern?
Message 8 of 42
(3,551 Views)

## Re: DIGITAL I/O SETTINGS

Okay, say you have 8 digital lines (1 port). You want bits 0, 3, and 7 to logic 1 and all others to be logic 0. You would represent this in binary as 10001001. Now, you want a shorthand way to express this. You can convert this binary number to hex. Now, the number is 89. In the example you posted, the author was a bit rude and did not display the radix of the numbers input to the digital I/O function. Do this yourself by right clicking on the numbers and selecting Visible Items>Radix. The hex number 80 is a digital pattern of 10000000 (bit 7 high) and the hex number 90 is a digital pattern of 10010000 (bits 7 and 4 high).
Message 9 of 42
(3,539 Views)

## Re: DIGITAL I/O SETTINGS

To add to what Dennis said, each hex digit represents 4 binary digits. Hex 8 is 1000, hex 9 is 1001. Therefore hex89 is 10001001. Notice that it takes two hex digits to represent 8 binary digits. The DIO port is grouped in 8 lines per port. The hex number is used because it is simpler to wire 89 to the port write function than it is to wire 10001001. But sometimes I do use the binary representation to wire to the DIO Write because it makes it easy to see what lines are hi and lo, especially when I'm driving relays. It is best to do what Dennis suggested and display the radix of the number, especially when using hex numbers. That way there is no confusion of whether x89 is hex or decimal. The 80 and 90 that you saw are just arbitrary values used by the author in his example. They mean nothing to a developer. You must figure what lines you want to send hi, write down a binary string to represent those line states, then you can either use the binary number or convert it to hex. Do this on the side. Then in Labview wire the number you came up with into the DIO write function.
- tbob

Inventor of the WORM Global
Message 10 of 42
(3,529 Views)