Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Meaning of "PORT" when configuring 8251 to communicate with I2C devices

We have an application where we will have  24 I2C pressure sensors tied to an 8451 interface.  I'm writing the software in visual basic to communicate with these devices and had a simple question.   When I establish the 8251 configuration, there are attributes: Port, Address Size, Clock Rate and Address.  My questions are:

 

1) What is the significance of the "Port" parameter.  Can't find any description on what it is referring to.

 

2) In my application where I have 24 sensors (with 24 different addresses) on the I2C bus, do I keep redefining the configuration for each sensor or do I establish multiple configurations.

 

I'll polling the 24 sensors every second or so and logging the results.

 

Thanks for any insight on how best to proceed.

 

Chris Shatara

cshatara@ambientairtech.com

0 Kudos
Message 1 of 10
(4,704 Views)

Hi Chris,

 

The port parameter just states which I2C bus you are using. The USB-8451 only has 1 port so that value is always 0. If you do the programming without scripting, then you would have to define configuration since the address would keep changing for each thermocouple. However, I recommend you go into the Advanced palette and use scripting to do the entire task set up, then run the "Run Script VI". Then for subsequent polling you would just run the Run Script VI instead of setting up the entire configuration again.

 

Take a look at this Developer Zone article under Advanced API:

http://zone.ni.com/devzone/cda/tut/p/id/5767

 

Hope this helps!

Chris T.
0 Kudos
Message 2 of 10
(4,681 Views)

Thanks Chris.  I'm not at all familiar with the use of the Scripting commands and how to use them.  Is there a tutorial or app note on using scripts.  The reference you gave me talks about labview and advanced API Scripting but not being knowledgeable with either makes things rather foggy.

 

/Chris

 

0 Kudos
Message 3 of 10
(4,678 Views)

Hi Chris,

 

So there are some examples in the LabVIEW example finder under Hardware Input Output -> I2C SPI ->I2C Advanced.

 

Hope this helps!

Chris T.
0 Kudos
Message 4 of 10
(4,665 Views)

I think the original poster mentioned programming in Visual Basic. The LabVIEW examples probably won't be of much help Smiley Sad

0 Kudos
Message 5 of 10
(4,659 Views)

Oh! Sorry about that, so the 8451 does not have native VB support. You could use it in C and perhaps use it in VB.

 

For the C examples look in:

 

Windows 7 or Vista

C:\Users\Public\Documents\National Instruments\NI-845x\Examples\MS Visual C\I2C\Advanced

or

Windows XP

C:\Documents and Settings\All Users\Documents\National Instruments\NI-845x\Examples\MS Visual C\I2C\Advanced

 

Hope that helps and sorry for the confusion!

 

Chris T.
0 Kudos
Message 6 of 10
(4,653 Views)

Thanks all for all the advice.  I'm actually able to call most of the C routines from visual basic.  All have not been coded as of yet.  I know I'll have some challenges passing a pointer to the routines but we're making progress. 

 

One question I had relative to the 8451 is that the +5V line at pin 31 is actually 4.79 volts (with no load).  Not being familiar with USB hardware, is this something to be concerned about.  

 

Chris S.

0 Kudos
Message 7 of 10
(4,650 Views)

Sorry for all the questions but I'm new to the I2C interface and the 8451.

 

Question regarding the I2C Clock Signal, "SCL".   When I execute the call to set the clock rate (to say 100K), no clock appears on the signal pin even though the call executed properly (no errors or warning).  So is the clock present only during Read, Write or Write/Read functions.

 

/Chris

 

0 Kudos
Message 8 of 10
(4,648 Views)

Hi Chris,

 

The clock does not run until a Read or Write or both had started on the bus. Essentially a start signal needs to be produced from the master before the clock even starts. When you set the clock rate, you were merely setting the rate at which the clock would run when it does the interaction.

 

Depending on which set of commands you are using if using the non scripting, calling a Read or Write call would fire the clock. If you are using the scripting method, the Run Script would cause the clock to fire, assuming that you have put in the appropriate start signal.

 

Hope this helps!

Chris T.
0 Kudos
Message 9 of 10
(4,639 Views)

This helps alot Chris.  Thanks......ChrisS

0 Kudos
Message 10 of 10
(4,637 Views)