C# interfacing between pc and Omron servopack sgdh - c#

I need help to write code c# interfacing between PC and Omron Servopack by rs232 to USB connection enter image description hereto drive ac servomotor

Using RS232 (CN3) to control this servo is not the best practice as it is not immune to EMC interference and is a port for driver setup (you will not be able to take graphics, and adjust the servo tuning while controlling through this port).
Consider researching the driver model you have and, if you have a fieldbus (Mecatrolink, DeviceNet, Profibus...), you could check how to use these protocols in a software (which I'll warn you, it's not trivial).
It all depends on your purpose, which could have been better explained in the question, as there are countless other approaches we can take...

Related

Arduino USB Driver

I want to make a program to interface with my Arduino through an USB port. I am already quite experienced with C# (which is the language I want to use), but I cannot find a way to install the Arduino USB driver without also installing the IDE. Can I download them somewhere? Or is there a better way to use USB (I do not need to upload any code to the board with the program)?
I know that there are a lot of tutorials on making the program, but they all seem to use the SerialPortclass which I assume is not the actual USB port but just a serial port made by the driver.
In short:
Q1: Where can I download the Arduino USB driver?
Q2: If I can't, what is the best way to do communicate using USB (maybe another driver or library)?
(Please tell me if my question does not make sense, this is the first time I am doing something with USB)
The "original" Arduinos that have build-in chip for serial communication are using FTDI's FT232RL chip. Here's the driver for these: http://www.ftdichip.com/Drivers/VCP.htm
The most cheap clones of those Arduino boards (from eBay, Aliexpress, etc) are using the CH340 chip for serial communication. Driver for these: http://www.wch.cn/download/CH341SER_EXE.html

Printer Communication Capture

If I need to post this elsewhere let me know.
We have some old software thats being re-written, that uses a printerdriver to a propriatery printer.
I need to rewrite the software bypassing the print driver and go directly to the printer. I do have the specs for the printer communication, thats fine, but what Id like to do is monitor the communications to the printer to view its contents (from the existing software that Im re-writing) and compare it to the specs, and what I will be sending it for validation.
I have to make sure Im not missing anything.
Any ideas on how I might be able to accomplish this?
Thanks
To capture the traffic you have to basic options.
1. Use software
If you are using ethernet, you can use a program like WireShark or USBTrace to capture the packets that are being sent out. There are similar programs for USB.
2. Use hardware
Another option would be to use an external logic analyzer. It's basically a box that sits in-between the computer and the printer that captures all the data, then uses software to decode it. There are some inexpensive options available (USBEE, Bus Pirate, and Total Phase Beagle.
I own a USBEE and I've used it to debug a simple USB device. It works well enough for that. The software is a little clunky though.

Open and close an electrical circuit

I have an application that one of it's features needs to control an electrical circuit of some device (open and close a circuit). Since i have no background in electronics i really don't know where to start.
I looked at some articles and found that i might need some kind of an RS232 relay device but i really don't have a clue if this is the right approach.
any help or guidance would be appreciated.
I will assume that this is a low-budget project - something like this would work :
http://www.easydaq.biz/PagesUSB/USBRelayCardProductsFRAME2.htm
Relay cards are available in USB, PCI, etc. Google will help you find something in your price range, deliverable in your region, and with a suitable number of outputs.
There are DIY ultra-cheap options, however. This would generally involve using the LPT printer port as a DIO port. The 5V lines can be used to activate power transistors that drive coils in similar relays. Have to solder your own for this kind of project. LPT bits can be set with very simple low-level memory writes.
For commercial or industrial application the prices go up (as does reliability) and the correct unit would depend heavily on the specific application and environment.

How can I determine the speed of a USB port?

Is there an easy way to programmatically determine the speed (or version) of a USB port? I'm looking to control the speed of data sent to a usb port based its maximum bandwidth.
If you need a solution for Windows this should be a good start:
http://msdn.microsoft.com/en-us/library/ms793313.aspx
Basically you should try this:
Enumerate the USB devices and the symbolic names to their drivers
Open a handle to the USB device driver through its symbolic name via CreateFile
Perform a DeviceIoControl on the driver handle with the control code IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX. This will have you returned the structure USB_NODE_CONNECTION_INFORMATION_EX. There you have a member there called Speed of the type USB_DEVICE_SPEED.
(Close the driver handle)
This could also be interesting for you: CodeProject: Enumerate Properties of an Installed Device
To answer your question, I'm sure that there are ways of getting the information you need. I don't know the answer for windows, but Linux has files you can read within the sysfs directory structure.
Speed control is usually taken care of by the drivers and the hardware controlling the bus. Most modern USB controllers really have 2 controllers per port connected. 1 for the slower speed 12Mbps USB 1.0, and another for the higher pseed 480Mbps USB 2.0. There is a magic switch inside that connects it properly. The driver itself makes sure that everything is enumerated properly, controls the flow, etc. A higher level "user-space" application typically doesn't need to worry about these things.
Also, if you have a device that is capable of running at faster than 12Mbps, and you plug it into a 12Mbps port, it'll get dragged down to 12Mbps whether you like it or not. Is it that you want to know that is got dragged down?

Need a Switch component controlled via USB port

I need device switch component which an be controlled by code(.net,C# Or vb) ON/OFF state is enough..
I have code knowledge in C#, .net window application, I need to make a switch that can be controlled using code via USB port ... so that using that switch I will turn on/off electrical devices (fan,light) for a specific time interval.. For my MINI Project
Note: I need the brief note regarding components needed and how to assemble it.
If you know any link which resembles this type of project pls refer me.
thanks.
You'll probably want to look into using an FTDI chip for this purpose. They do have a .NET interface available as well as traditional C DLLs.
FTDI offers two types of drivers - one emulates a simple COM port (Virtual COM Port, which is probably enough for you), and the other is more of a direct USB control (D2XX), although it still shows up as a COM port when the USB device is connected.
On the other hand, if you really only need on/off support, you could probably just use the .net serial port drivers for the most basic communication. Of course, the serial port drivers don't let you tie a serial port pin high or low, so you will need some method of reading the data coming from the PC. Many microcontrollers have freely available UART libraries exactly for this purpose, but you will need to also obtain an RS232 level shifting IC for this because the serial port from the PC outputs +/- 6V IIRC (might be +/- 12V), while most microcontrollers run off of and accept signals at 0/5V or 0/3.3V.
You could try something like the Arduino or one of its clones like the Sanguino. It's probably a bit overkill for your project, but they come pre-assembled and have a large support base.
You would also (for any low voltage switching circuit) need some form of relay board to switch electrical appliances that run on mains power. See here for some ideas.
Are you sure you have to do this with the USB port?
You'd need a device that implements a whole USB interface. This isn't as simple as using a line on the COM port (RTS/DSR etc...) or using the parallel port.
A quick search found this...

Categories

Resources