Reading Serial Port pins in C# - c#

I have a device connected to my computer via RS232 to USB. This device hold times for eight tanning beds. I want to get the data from the pins on the serial port to see how it is connecting with the device, to see how the times are being displayed. I am hoping to do this is C#, but I'm not sure exactly where I need to start. I have thought about probing the pins on an oscilloscope, but that seems very tedious. Any thoughts?

I just ran in to this my self. If you are not using a 64 bit version of windows I would recommend using PortMon, save the log file, then do offline parsing of your log file. There are libraries that let you hook in to the stream via code but I think using PortMon you may not even need to write any code at all and you may be able to just figure out the protocol by visual inspection.
If you are using a 64 bit version of windows your choices are severely limited. I could not find a free program that was compatible with windows 7 x64, The only program I heard that works (but I did not buy it and the free version did not work) is Serial Port Monitor by HHD.
You can also try running the software in XP Mode to get the 32 bit monitoring programs running, it worked for me.

Related

Lime Video SDK - Windows10 quick sync config

I compiled fine the Samples in Lime Video SDK. On a Windows 7 system works very well but I got error message in a Windows 10 system.
"You are not properly configured for either: A) GPU/IGP Quick Sync B) Software fallback
You may not continue until you fix one option for Quick Sync coding
Press a key to exit"
I don't know what is the problem. I dug the source but not found a solution.
This message simply means that you have not installed the correct Intel HD graphics driver for your OS/CPU combination, or libmfxsw64.dll/so cannot be found in the DLL path, which is the software emulation fallback.
Without the correct device driver or the software fallback DLL/so being loadable, the samples will not be able to run.
What’s the best way to be sure you have drivers setup correctly?
Use either or both of: “MediaSDK System Analyzer“ or ffmpeg with the “-vcodec h264_qsv” option. Sorry for slow response, just noticed this.

Manage Wifi connections on Raspberry PI

I am working on using a Raspberry Pi in an embedded project that will utilize wifi to communicate with external devices. The device should be able to act either as a standalone wifi hotspot that devices can connect to or in the case of the presence of an existing wifi network it should connect to that network so that the user does not have to give up his internet connection in order to connect to the device. I plan on making the device start up in hotspot mode, the user can then use the web interface to enter the details of a network that he wants the device to connect to, whenever the specified parameters fails to establish a connection then it defaults back to hotspot mode.
Now the technical stuff I am struggling with is that I want to implement the control software in C# running with Mono on Arch Linux on the Rapsberry Pi. I am struggling the find the Apis or libraries needed to manage the Linux wifi connection. On Windows it seems as if managedwifi.codeplex.com can be used but it does not seem to be compatible with Linux.
My last resort would obviously be to execute shell commands and then parse their outputs, but considering how crude and possibly unreliable that would be this is obviously my last resort.
Any ideas regarding what I should do?
PS. Another thing I might consider before using shell scripts, if it makes a difference is to use Raspbian or some other distro instead.
Actually calling shell commands from a managed code is not a very bad idea. They are reliable, very well tested and mostly lightweight and sometimes just a wrapper around kernel or other modules function. This is also seems to be the same method Node.js modules use when they want to access something lowlevel or related to networking. For example see this source code: node-wireless/node_modules/wireless/index.js
If you don't like it this way there is always "Interop". The same way that you can DllImport() libraries in Windows, you can do in Linux. See here: http://www.mono-project.com/Interop_with_Native_Libraries
IMHO the second solution doesn't worth the effort. Calling shell commands is elegant and neat enough.
my pi is starting into wlan0 as AP with hostapd, when a AP also a lighttpd is starting and give a web interface do change the settings. the web interface verify and write the input in a sqlite3. a second script is doing the canges according to my changes. (like add, edit or remove wifis in wpa_supplicant, reset wlan0 to be a part of an existing wlan like set to dhcp, tell wpa_supplicants...)
except the lighttpd and sqlite3 all components are already on the Raspery. you dont need any mono or c-libraries
for writing the scripts i use python but also perl is working (even php for the frontend)

Getting PC Hardware Serial Numbers

I'm building an application for my personal use, in which I need to get the Serial Number of the hardware of the PC. i.e.: Motherboard, RAM(s), HDD(s), Cards, and any other device installed.
I've searched around the internet but couldn't find anything working with me!!
I'm using WPF on C#, and .NET Framework 4.0
I've just finished a preliminary design.

Diagnose communication problems with a Zaber device

When I write software to control Zaber devices, I sometimes get strange behaviour that I don't understand. Usually it's caused by bugs in my script or other software, and sometimes it's a hardware problem like a loose connection on the serial port.
How can I see exactly what commands my software is sending and how the device is responding? I'd like a kind of log file that I can search through to see what's causing the errors.
Most often, I'm writing scripts in Zaber Console using C#, but I also write LabVIEW VIs using the Zaber instrument driver.
There are several techniques to see the raw data being sent to and received from Zaber devices. Some are restricted to certain operating systems, others only work with some software. Most of the options involve looking at the raw data, so look in the user manual for details about the message format, and a list of command numbers.
Below, I'll try to list a few options and tell you when they are available.
Zaber Console Log Window
Only in Zaber Console, only on Windows.
This is the easiest technique if you are using Zaber Console scripts or plug ins. The window in the top-right corner records all the requests and responses for you. You might find it easier to track down the problem if you clear the window just before the problem occurs, and stop the script right after. One shortcoming is that some corrupted messages are not shown, you just see a partial packet timeout error. If the messages you want are getting scrolled off the top, change the log size on the advanced tab.
Portmon
Only on 32-bit Windows.
Portmon was a great tool, and I'm sad that it never got upgraded to 64-bit Windows. If you're still running a 32-bit version of Windows, it's worth trying. I found that the latest version 3.03 didn't work for me, but 3.02 still does. If the official version doesn't work, then searching for "portmon 3.02" will usually find some site that carries the old version.
In version 3.02, open the Computer menu and choose Connect Local.
From the Capture menu, choose Ports: COM1, or whatever serial port you want to connect to. Make sure your software is currently closed, or Portmon won't be able to connect to the serial port. Sometimes after using Portmon, you have to restart the computer to make it release the serial port.
From the Edit menu, choose Filter/Highlight... and set the Include to be IRP_MJ_READ;IRP_MJ_WRITE
On the Options menu, enable Show Hex and Clock Time.
Try sending some commands from your software, and then look at the Portmon window. You should see something like this after you widen the Other column.
In the screenshot you can see two commands being sent (1 block of 6 bytes for each command), and two responses coming back (6 blocks of 1 byte for each response). Remember that the display is using hexadecimal numbers, so the first command is 14 hexadecimal or 20 decimal (move absolute).
HHD Serial Monitor
The best replacement I've found for Portmon is HHD Serial Monitor. It's not free, but it has a trial period, and the license is pretty cheap. I think it might be more powerful than Portmon, but it's not as easy to use.
Here are the settings I found to be useful for logging Zaber device commands. After installing and starting the Device Monitoring Studio, I clicked on the serial port I want to monitor in the list of ports. That opens a list of available views, and I double click on Request View. On the right-hand side, I click the Start button. That opens the request view, and I click on the Complete tab.
Now when I send some commands to the device, I see read and write requests with hexadecimal and text display of the data. Here's the equivalent of the Portmon screenshot above.
Again, the first command is 14 hexadecimal or 20 decimal (move absolute).
NI Spy or NI I/O Trace
Available with LabVIEW
This option isn't as easy to read, but it comes with LabVIEW, and you can read the documentation on how to start it. Here's a screenshot of the NI Spy tool. I think it came with older versions of LabVIEW.

Send/Receive WiFi traffic data

Is it possible to monitor WiFi traffic and send data myself? My goal is to learn how to monitor probe requests, send deauth packets, and other operations similar to AirCrack and the other libraries found on the BackTrack os flavor.
You might have a tough time doing what you want to do in a Windows environment. If you poke around the Aircrack site a bit you'll see that the Windows version is pretty useless in comparison to its Linux counterpart, in large part due to the open source driver availability in Linux and the lack thereof in Windows. You can definitely packet sniff etc. ( http://www.codeproject.com/Articles/12458/SharpPcap-A-Packet-Capture-Framework-for-NET ) but you won't get the robustness that you can get out of a similar application in Linux.
I don't know about sending just random radio signals, but you can certainly monitor the traffic and data. Here is an article which describes how to do it.
AirPcap from Riverbed. USB adapter that can run in monitor mode and has an API for channel switching and more, and you can send Wi-Fi frames if you buy the right adapter. Wireshark has builtin support too. The Alfa cards are a good choice, but only for 'nix

Categories