How to communicate with device with GPIB? - c#

I use "82357B USB/GPIB" in order to communicate with a device with "Agilent Communication Expert".
How can I communicate with the device in C# code? What should I need to install? Which references to add? etc.
And how to diploy the application to another computer? Does the computer need some installations?
Thanks

See "Keysight IO library suit Getting started with Visa.Net C# Instrument control program"
This document describe how to build visual studio solution with visa to communicate with device over GPIB
https://keysightsales.my.salesforce.com/sfc/p/#1a000000awb5/a/2L0000009JeU/UxdJUjDDylNahqCuK6OHVbjWCycgVq7mZhTdkMgNDDI
Another important document is "Keysight IO Library Suite VISA.NET / C# Quick Reference Guide" (google it)

Related

Web application to manage CATIA files

A have a question for CATIA customization experts!
I'm intend to develop a web application able to perfoms the following tasks:
Modify some parameters into CATIA files. eg.: change the diameter or length of a part;
Convert theses CATIA files to STEP files.
So, I possible do these things using CATIA API and without have CATIA software instaled on my web server?
I did some research on the WEB and I found some APIs, like "CAD.ai" that I think solve these questions. But, these APIs look so sophisticated for my purpose and I looking for develop my own code.
Any suggestion?
Catvbs code can be incorporated in web pages and "talk' with CATIA, check Dassault Systems automation documentation which is in the installation folder of CATIA (be aware that there are differences between releases and versions of CATIA- v5, v6, 3DEx). You don't need to have CATIA but you need to check if CATIA is opened or not on client PC (and convince CATIA user to run your code from web).
By the way, from DS chm automation file you can run their codes directly in CATIA...

Write/Read file in my iPhone app Shared File

I wrote an app on my iPhone. It's a more portable and smaller version of my pc software. I activated the File Sharing feature on my app so now I can transfer files through iTunes. But I want my pc software to be able to read or write files to that shared folder on my iPhone without having to do it manually through iTunes.
I have big constraints:
I can't use a Jailbroken iPhone/iPod/iPad
The vast majority of my customers don't have Internet access (It's a farm management software so even cellular are not available in some area)... :(
I heard there is a way using Manzana and MobileDevice.dll (itunesmobiledevice.dll). I don't really know how to use these dll. I tried to use Manzana a little but I can't access my folder since it's not a jailbroken iPhone.. Can someone help me with a little bit of code example?
Or is there other ways to make my iPhone app communicate with my C# application using the USB cable without internet access or Wifi?
mobiledevice.codeplex.com. This project should let you send and retrieve files from the phone
I'd suggest seeing if you can use the iTunes scripting interface. Add the COM reference iTunes 1.1 Type Library to a project and you can control many parts of itunes automatically. I can't find the documentation for it, but you can play around with the library and see if there is something to access the file sharing section.
Here's a decent introduction to using it:
http://www.codeproject.com/Articles/7723/Controlling-iTunes-through-COM

Interprocess Communication between Excel & C# Application?

I was wondering if there was a way to set up communication between an instance of excel and a C# Application. For instance, when a cell value changes, I would like to send the updated value to the C# Application in real time.
Thanks in advance!
You need the Office Primary Interop Assemblies, which are a .Net wrapper for the COM API exposed by MS Office. You can consume events through these, so you might be able to set up a listener that will capture the event that you want.
You can use the Visual Studio Tools for Office (VSTO) project types available in Visual Studio to automate Office from C# code. This ensures you use only managed code and do not rely on COM or the Primary Interop Assemblies being available/installed.
This is the preferred approach when compared to the COM solution. For further information and examples, please take a look at the MSDN page.

Read USB interrupt data

I have a USB device which which uses the libusb WIN32 drivers and
Interrupt data is available from the
accelerometer through the USB-HID
interface endpoint 83 (in EP83). Data
is in little end-in format with the
following fields (x,y,z,Vbat,CpuTemp.)
Data are acquired every 62.5ms (16Hz).
There a number of USB HID "get" and
"set" Reports available (through ep0)
How can I access this data via .NET and C#?
libusb32 is c/c++ library of generic usb driver. it comes in 2 layers. low layer in kernel mode is generic client driver libusb0.sys + .inf file that you change and it tells to what device to upload this generic usb driver.They have inf-wizard.exe tool that helps for you to make this .inf file for your device. Upper layer in user space is libusb.lib (you can make also static link) that talks to libusb driver. You can find in sources usb.h that actually defines interface between you code and usb (usb driver). To access unmanaged code or you should write your layer of interop in c# or in c++/cli or use ready layer that been made by somebody. Here the link to one of the projects, http://sourceforge.net/projects/libusbdotnet/
How to use libusb library i advice you to see some example from them. Usually it like you open handle to usb bus, then find there your device by VendorId & ProductId, get it's handle. Then make write/read to endpoints of device.
If it is HID device I recommend you to use Windows's default driver - hid.dll, I used it and it was ok. This way you should not care about deploying also a driver, it's there anyway and you just have to understand the API and use it. For this I recommend you Jan Axelson book USB Complete, she has pretty good explanation and samples there, it is a mixture of C/C++ and C# but the trend is for .net Also she has a HID Page on her website and there you find the code samples you just need.

How can I install a printer using .NET?

I have an .INF for a virtual printer that I need to install from a .NET Application. I have done this before using batch scripts, but I am looking for a snippet of code to do this in the .NET Framework.
There's nothing particular about the printer .INF, so any code that installs a printer from an INF in C# or VB.NET will work.
I believe this is possible via interop to native win32 APIs, but I've found its much, much easier just to use a System.Diagnostics.Process() to call into printui.dll via:
rundll32.exe printui.dll,PrintUIEntry /?
Perhaps you're already using that in the mentioned batch script, but if not the parameters are documented here: PrintUI.DLL User's Guide and Reference
Just be sure to test it against all operation systems you need to support. Some options either do not exist in all Windows releases or have been renamed (although I think they're the more esoteric options - installing an .INF will likely work across the board).
You are going to want to look at the WMI objects available. These give you a finer control of the local machine settings. Take a look at the WMI code creator from Microsoft, I believe this will generate some example code you can leverage to solve your problem.
Administering Printer Settings in C# for Flexible Printing
see this article, it uses an MS Platform SDK DLL called PRNADMIN to manage printers, printer-drivers, printer-ports, ...etc.
I personally use it in a commercial project to install a printer driver and change the printer port to local port to intercept the Postscript. and it works like a Charm.
Alternatively you can use some pre-installed vbscripts that come with windows in C:\Windows\system32\Printing_Admin_Scripts and here is a an articles for them:
http://technet.microsoft.com/en-us/library/cc771846.aspx
This is not the ideal solution, but if nobody else answers, you can create a temp batch file and invoke that through C#/VB.NET.
Someone else will probably know a more natural way to do this.
You will need to wrap the setup APIs using PINVOKE or a native COM object.

Categories

Resources