Test and Measurement Forum

2 PT-104 USB with 2 macro on a same computer

Post your VB and VBA discussions here

2 PT-104 USB with 2 macro on a same computer

Postby eqiom » Wed Mar 09, 2016 6:08 pm

Hello

Following some example and based on the advice from the previous topic, I made the following Excel spreatsheet to collect the data from the 2 PT-104 USB in a same file and in a same time (see attached file).

Now on the same computer, I want to start an excel macro to collect the data from one PT-104 USB during several hours and I want to start also a second excel macro (from another excel file) to collect the data from the second PT-104 USB during several hours too. Of course the two macro will not be started in the same time but they will worked very often together.

I never succeed to start the second macro while the first was already running. Each time I was starting the macro from one excel file, it was impossible to start the macro from the second excel file.

Do we have a solution to collect separatly on two different excel file, the data from the two PT-104 USB, on a same computer

I'm running a computer with Windows Seven 64 bits and Excel 2016. I have 2 PT-104 USB :
On the CQ493/053 I have four temperature measurement device
On the CV669/077 I have two temperature measurement device

Thank's a lot
Attachments
USBPT104_x64_EQIOM USB fonctionnel.xls
(57 KiB) Downloaded 61 times
eqiom
Newbie
 
Posts: 0
Joined: Wed Mar 02, 2016 1:39 pm

Re: 2 PT-104 USB with 2 macro on a same computer

Postby Hitesh » Tue Mar 15, 2016 3:03 pm

Hi eqiom,

Having run some tests here, it is possible to run two separate macros by doing the following:

[list=]
[*] Open the first Excel file
[*] Open a new instance of Excel from the Windows Start Menu
[*] Load the second file into the new instance of Excel
[*] Start each macro running (use the serial number in the call to UsbPt104OpenUnit() to distinguish between each device)
[/list]

You may also wish to rename the Module for each file in the Macro editor.

I hope this helps.
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2063
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: 2 PT-104 USB with 2 macro on a same computer

Postby eqiom » Thu Mar 17, 2016 5:36 pm

Hello,

Finally I solved the problem by avoiding using the "Sleep" function, which is blocking the excel spreatsheet and preventing opening or working with another excel file.

The only way to be able to use excel while we are waiting between two measurement is to use the "Application.OnTime" function, which is sending directly the instruction to the kernel.

The excel file attached is a working example of collecting data from one controler with 4 measurement device.

I hope it will help one day.

regards
Attachments
Chaleur-hydratation-controleurA.xls
(89 KiB) Downloaded 63 times
eqiom
Newbie
 
Posts: 0
Joined: Wed Mar 02, 2016 1:39 pm


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests