LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot read AMUX 64T channels in Measure 1.2 c DAQ Excel or MAX 2.0

Setup:

Revived PC, Win 98 SE (suggested by a veteran NI engineer as appropriate to the EISA hardware below)
AMUX 64T
AT-MIO-16XE-50
Nidaq 6.8, Max 2.0
Measure 1.2C

AMUX 64T powers on.

On the AMUX 64T,
--ten type 'J' thermocouples wired into channels 1 through 10 (pins 1/33 , 2.34 etc). .
--Built in CRC is jumper enabled.

AT-MIO-16XE-50 passes all MAX 2.0 hosted tests without errors

I fell heir to this project. This rig worked in the past when it was set up by one of our engineers. He left us, however, and his work was lost in a hard drive crash. Doh.

Eventually, we will use VBA to grab temperature readings and massage and manipulate within Excel.

For now, we would just like to simply read each thermocouple. We are totally at sea. The manuals are user hostile, to be kind. For example, the SW1 on/off switch diagram in the manual was reversed. This cost us six hours until the error was found and lo and behold, the AMUX 64T  idiot light powered on.

I do remember that when our former engineer originally set up this equipment, that he had to write quite a few routines himself (this was with the Measure version 1.1 originally supplied).

Any assistance would be tremendously appreciated. We have lots of internal VBA and Excel macro expertise, but first we need to read all ten da$ned thermocouples.






0 Kudos
Message 1 of 10
(3,551 Views)
Hi Mrmw,

I do not have Max version 2.0 installed so bear with me if some of the walk through described below are somewhat different on your machine.  They should be very similar so please let me know if you have any difficulty following the steps below.

I would recommend first making sure that you have both the AT-MIO-16XE-50 and AMUX 64T setup properly and working in Measurement and Automation Explorer (MAX).  You will need to select the AMUX 64T as the accessory for the AT-MIO-16XE-50 within MAX.  This can be done by right-clicking on the AT-MIO-16XE-50 and selecting Properties.  In the properties menu, go to the accessory tab and select the AMUX 64T (Use (1) if you only have one AMUX 64T).  You will also want to check the box for CJC jumper set. 

Now, you will need to create a virtual channel to test the accessory and channels.  You will need to Right-click on Data Neighborhood and select to create a virtual channel.  This needs to be setup as an analog input temperature task.  Once you have created the virtual channel, you should be able to test your channels to make sure the thermocouples are reading correctly.

Once you have been able to verify that the card is working and bringing in the right data we can move on to how to get this working within VBA and Excel.

I hope this helps,
Paul C.
0 Kudos
Message 2 of 10
(3,528 Views)
Thank you so much for your reply.

Would you agree, though, that the AMUX 64T does not support virtual channels, as written at this link:
http://digital.ni.com/public.nsf/websearch/9D8232DFFE50108F86256DCD005A319B?OpenDocument

If so, then I assume that with the AMUX 64T in the equipment mix that virtual channels cannot be implemented with either MAX 2.0 or Excel DAQ add-in .

As we say in the software world when we come up against such a Catch 22, everything is 'Working As Designed'. Grin..

Anyway, On To 'The Next Steps':
The MAX 2.0 front end software (from the Nidaq 6.8 install) has indeed confirmed that the AT-MIO-16XE-50 card is working correctly.

The next step in the project is use Visual Basic resident Nidaq32.dll  function calls to read the binary output of the AMUX 64T integral CJC (AMUX 64T channel zero) and the binary output of the ten 'J' thermocouples wired into AMUX 64T channels one through ten; from the MIO channel zero (AMUX channels zero through three), MIO channel one (AMUX channels four through seven) and MIO channel channel two (AMUX channels eight through ten).

Then, with these eleven binary readings stored in an array, convert them to voltages and then to temperatures, then finally write channels one through ten (the CJC temp from channel zero is not of concern) to an Excel worksheet.

Any assistance in VBA (i.e. incorporating Nidaq function calls into Excel Macros) to accomplish all or part of the above steps is greatly appreciated.




0 Kudos
Message 3 of 10
(3,520 Views)
I should have been more specific about what help would be really great. Forgive me, its been a little crazy around here.

We have Visual Basic expertise aplenty for EXcel macros.

What would be super helpful are the specific function call(s) we would use, on a sub task basis, for incorporation into macros.

For example, from the Nidaq 6.8 function call full set, only a subset (for the 'E' MIO series boards) are supported on the MIO board we are using.

As a further example, on a subtask by subtask basis your suggestions on the optimum and most simple set of suggested function call(s) would be really useful, along with tips on the arguments for each function call:

Sub Task Nidaq 6.8 nidaq32.dll Function Calls To...
--set the gain and other paramaeters, by channel (we are reading 'J' thermocouples in the range of 25F to 250F)
--read the cjc AMUX channel 0 and channels 1 to 10 binary values into an array
--convert the array binary values into voltages
--convert the array voltages into temperatures

From there, writing the array contents to rows and columns is something we do routinely. Rolling them into graphs, likewise.

Thanks for your patience.
0 Kudos
Message 4 of 10
(3,513 Views)
Hi Mrmw,

I apologize that I missed the article about virtual channels with the AMUX 64T.  You are correct that you cannot use virtual channels with this device.  There are currently no examples that will do all the things that you are looking for with the AMUX 64T.  I did find an example for reading a set of channels in LabWindows here.  The C code might help you getting started.  The basic idea is that you will use a unique channel string to select the different channels on the AMUX 64T.  This will be in the form of AMx!y (where x is the device number and y is the channel number).  This can be done with the AI_VRead as suggested in the example above.  This will also allow you to select gain and other parameters.  In addition, the AI_VRead will read in the values as voltages.  The CJC value of the AMUX 64T is routed to channel 0 when you change the jumper to the temp setting.  You will need to read in this value (you can use AI_VRead to read this in as a voltage) and use it to adjust the voltage values manually.  There are no NI-DAQ function calls that will do this for you. 

Specifically, in the C example above you will also notice that there is a AI_Mux_Config command that is used to setup the device to use the AMUX 64T.  You will also notice that at the end of the application the AI_Mux_Config is called again to reset the card for no AMUX 64T.

I would also like to add that this is one of our older cards that requires our older NI-DAQ drivers which I don't have currently installed on my machine.  The information above is information that I have found in the manuals and I haven't tried it all.  If you have any trouble setting up the above, I will need some time to setup a machine with that driver set for testing.

In regards to other examples that are written for Visual Basic with our Legacy NI-DAQ drivers.  Please take a look here.  This article tells a bit more about the location that you should be able to find our VB examples.  These won't be specific do your hardware or application but might give you some ideas on where to begin.

I hope this helps,
Paul C.

Message Edited by Paul C. on 10-30-2007 04:57 PM

0 Kudos
Message 5 of 10
(3,503 Views)
Mrmw posted the following updated information on another thread.  Here is the information

"Given that the AMUX 64T does not support Virtual Channels under either Labview or Nidaq as per this link,

http://forums.ni.com/ni/board/message?board.id=250&message.id=6455&requireLogin=False

...are there examples of how AMUX 64T multi-channel thermocouple data can be acquired via Traditional Nidaq, compensated for with AMUX 64T based CJC, the binary data converted to voltage and voltage converted to temperatures, then displayed in Excel...all thru the use of Nidaq function calls from within VBA or VB?

Environment:

Hardware:
AMUX 64T
AT-MIO-16XE-50

Software
Win 98 SE
Nidaq 6.8
Measure 1.2C

Its clear that the solution lies in using Nidaq32.dll based functioin calls. We have the online manual and Windows help file which detail the functions and arguments. We have fragments that address portions of the problem.

We have defined an architecture:
1.Create (Excel) command button ONE to read all the AMUX channels (zero through eleven) using a traditional Nidaq function such as scan_op, which the manual says places the info into an array.

2. convert channel zero CJC reading from binary to voltage (a callable function)

3. convert channels one through ten binary readings to voltages
(a callable function)

4. add the cjc voltage value to channel one through ten voltage values

5. convert the channels one through ten voltages to temps
(a callable function one of whose arguments may eliminate the need for the previous step 4. To be determined )

6. display the array, where the display would be one row of ten cells, each cell displaying the reading of one thermocouple, rounded to zero significant digits, degrees F. No need to display the cjc that came in on AMUX channel zero.

6b Create command buttons TWO and THREE which write their array contents to successive Excel rows.

'Comment: three buttons, three rows of temp reading...a 3D graph!!!

8. Create a fourth Command Button to read the temp only from thermocouple one, and display it in large font


It jseems antideluvian to have to re-roll this solution when its now the 21st century. Or to drop hefty money on Labview and then have to program it anyway.

Anyone?"

Paul C.

Message Edited by Paul C. on 10-30-2007 05:14 PM

0 Kudos
Message 6 of 10
(3,496 Views)
Thanks for all your help. With AI_VREAD we are successfully reading all ten type J thermocouple AMUX channels. Using a vba FOR/NEXT loop of 500 iterations, we have very good convergence. chuckle.

We do have a question, however. AI_VREAD permits the gain to set to 100 (for the AT MIO E Series board, I guess?).

But the optimal gain (for least error) for type J thermocouples is 500.

I can get gain = 500 by setting some combo of AT MIO E Series board gain (using AI_VREAD) and AMUX 64T gain.

But the AT MIO E Series board permits gain settings of 1,2,10, 100.

How is the AMUX 64T gain set using traditional Nidaq?

Is the answer perhaps nidaq function Scan_OP?.

If so, we have questions about the parameters. But let's answer the above questions first.

Thank you for your help and understanding.

Below is our meager VBA excel macro open source contribution to the knowldedge base for those of us who like to fix things using the language in which they were broken.
.........................................
Hardware setup:
AT MIO 16 XE 50, AMUX 64T, ten type J thermocouples, nidaq 6.8
Win 98 SE.

project to press one of three buttons within an excel worksheet, scan ten thermocouple temps and write them to the worksheet.

Option Explicit
Dim idvolt#(10)
Dim dVoltage#, iChan%, icjcerr%, cjctemp#, ireps%, ctr1%, ctr2%, istatus%

Sub Config()
'Configure AMUX board
    istatus = AI_Mux_Config(1, 1)
    If istatus <> 0 Then    'error
        MsgBox istatus & " = Error in AI_Mux_Config(1, 1)" 'display error & end
        End
    End If
'Configure MIO board
    istatus = MIO_Config(1, 1, 1)
    If istatus <> 0 Then    'error
        MsgBox istatus & " = Error in MIO_Config(1, 1, 1)" 'display error & end
        End
    End If
End Sub
Sub cleanit()
    'housekeeping: clear all public, semi-public variables so no legacy values
    'hang out to muck up future calculations/readings
   
    dVoltage = 0
    iChan = 0
    icjcerr = 0
    cjctemp = 0
    ireps = 0
    ctr1 = 0
    ctr2 = 0
    istatus = 0
   
End Sub

Sub cjc()
'Get CJC Voltage Reading
    icjcerr = AI_VRead(1, 0, 10, dVoltage)
    If icjcerr <> 0 Then    'error
        MsgBox istatus & " = Error in AI_VRead(1, 0, 10, dVoltage)" 'display error & end
        End
    End If
    cjctemp = dVoltage * 100
End Sub
 
Sub Temperatures(level%)
    Config      'Configure  boards
    cjc         'Get CJC Voltage Reading
    ireps = 500 'Number of repetitions - 500 takes about 3 seconds on Steve's computer

'read the AMUX channels 1 to 10...
    For ctr1 = 1 To ireps
        For iChan = 1 To 10
            istatus = AI_VRead(1, iChan, 100, dVoltage)
            'if error display error code else accumulate voltage (temperature)
            If istatus <> 0 Then    'error
                MsgBox istatus & " = Error in AI_VRead(1, iChan, 100, dVoltage)" 'display error & end
                End
            End If
            idvolt(iChan) = idvolt(iChan) + dVoltage
        Next
     Next

' Average channel voltages, convert volts to temps, write to worksheet & clear for next use
    For ctr1 = 1 To 10
        Cells(9 + (level - 1) * 3, 4 + ctr1) = thermocoupletemperature("J", cjctemp, "F", idvolt(ctr1) / ireps)
        idvolt(ctr1) = 0
    Next
   
    cleanit
   
    End Sub
 
Private Sub CommandButton1_Click()
    'Clear previous temperature values after saving in lower area of spreadsheet
    Dim i%, j%
    For i = 1 To 3
        For j = 1 To 10
            Cells(i * 3 + 20, j + 4) = Cells(i * 3 + 3, j + 4)  'Save current as previous
            Cells(i * 3 + 3, j + 4) = ""                        'Clear values
        Next
    Next
End Sub

Private Sub CommandButton2_Click()
    Temperatures 1
 End Sub

Private Sub CommandButton3_Click()
    Temperatures 2
End Sub

Private Sub CommandButton4_Click()
    Temperatures 3
End Sub



0 Kudos
Message 7 of 10
(3,473 Views)

Hi Mrmw,

As far as I have seen, there is no selectable gain on the AMUX 64T.  The only selectable gain is the one on the actual DAQ device (AT-MIO-16XE-50).   This card appears to have a  maximum selectable gain of 100 according to the manual found here.  It looks like without external circuitry you won't be able to obtain a gain of 500.  I also wanted to mention that the gain is also applied to the CJC input.

In addition, I also wanted to thank you for posting your code so future readers of this thread can use it to help jumpstart their projects.

I hope this helps,
Paul C.

 
0 Kudos
Message 8 of 10
(3,458 Views)
Yes, but:

The gain can also be adjusted by changing the input range, yes?

 Is it possible to change the input range either on the DAQ device (MIO card) or AMUX 64T using software programmable traditional Nidaq functions/parameters?

If I read all the manuals correctly the gain is a function of the input range and individual gain settings.

With our type J thermocouples and gain set at 100, our error according the AMUX 64T manual is 2.7 Deg C. If we can set the gain to 500, our error would tighten up to 1.4 Deg C.

That's quite a difference on our daily temp range, which is 45 F to 210 F.

The VBA, code, ah shucks, it was nothing. We couldn't have done anything without your help with the'C' code snippet upthread.

The hardest thing is deciphering the documentation. It is as poorly composed as the Nidaq architecture is elegant.



Paul C. wrote:
As far as I have seen, there is no selectable gain on the AMUX 64T.  The only selectable gain is the one on the actual DAQ device (AT-MIO-16XE-50).   This card appears to have a  maximum selectable gain of 100 according to the manual found here.  It looks like without external circuitry you won't be able to obtain a gain of 500.  I also wanted to mention that the gain is also applied to the CJC input and you might consider the options mentioned in the article found here.

In addition, I also wanted to thank you for posting your code so future readers of this thread can use it to help jumpstart their projects.

I hope this helps,
Paul C.



0 Kudos
Message 9 of 10
(3,446 Views)

Hi mrmw,

The gain of 500 that you saw in the AMUX 64T user manual only applies to devices that support that kind of gain.  The AT-MIO-16XE-50 has a maximum gain of 100 based on an input range of 0-100mV.  There are thermocouple modules, such as the SCXI-1102 available for use in an SCXI chassis, that will offer you better accuracy.  I hope this helps.

 

 


Best Regards

Hani R.
Applications Engineer
National Instruments
0 Kudos
Message 10 of 10
(3,413 Views)