|
Hi,
I need to read data from multiple RS232 ports.
I use the System.IO.Ports.SerialPort Class from the .NET Framework (VB). Everything works fine with just one COM device. If I use more than one device on different RS232 Ports i get problems with receiving data using the DataReceived-Event from the SerialPort Class.
I tried starting different threads to send and receive the bytes but the DataReceived-Event also starts a seperate thread and so i get problems on how to handle the incoming data to send them back to the waiting thread which check the incoming data on errors??!
Has anybody an idea how to solve this (maybe without the DataReceived-Event)??
Thanks Alex
|
|
|
|
|
AFAIK DataReceived fires on a separate thread (probably one from the ThreadPool), and a different one for different serial ports. You are not allowed to touch any GUI Control from there, see this article[^].
Getting data in correctly from a serial port isn't straightforward:
- with DataReceived you are never sure when it will fire, and how much data will be available; assuming the incoming data is message oriented, messages may be cut into pieces, or multiple messages may appear in one chunck of data received.
- without DataReceived, you either have no events at all, or you need to perform a periodic read, based on some timer. Then CPU cycles are wasted when the port is idle, and messages have to be reassembled in code.
The right approach depends on the kind of data (text vs binary), the maximum message length, the required maximum latency time, and much more.
You need a rock-solid solution for one port, fitting your exact needs; then duplicate that for all the other ports.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
Hi!
I need to read data from usb. for this purpose I have downloaded snoopPRo for packet sniffing . I got a log file but this file does not tell me anything. there are several functions such as GET_DESCRIPTOR_FROM_DEVICE , CONTROL_TRANSFER , SELECT_CONFIGURATION, BULK_OR_INTERRUPT_TRANSFER, CLASS_INTERFACE... could you help me how can I benefit from this log file?
|
|
|
|
|
hande54 wrote: how can I benefit from this log file?
Quote Selected Text
It depends on what problem you are trying to solve. Packet sniffers sometimes have filter options to allow you to reduce the amount of low level protocol information and highlight the actual data that you are interested in. The documentation often has information that may help.
|
|
|
|
|
I would like to get data measurement results from the blood pressure meter which has a usb gateway. It has software to list values in txt format. but what I need to do is read data directly from the usb.
|
|
|
|
|
hande54 wrote: It has software to list values in txt format. but what I need to do is read data directly from the usb.
I don't see why you want to make it so difficult for yourself. However, if this is the route you decide on then you will need to get hold of the technical documentation for your BP device to decode its output.
|
|
|
|
|
Dear,
I have a problem,
I'm coding a application with multiple monitor.I use MFC ( VS 2003)
I used to WM_DEVICECHANGE to catching event when plug/unplug monitor.
With my computer, when i unplug monitor, it doesn't go to OnDeviceChange() function
But with other computers, when i unplug monitor, it go to OnDeviceChange() function
I don't know why ?
How to catching event when plug/unplug monitor ?
Thank you for your help
|
|
|
|
|
|
Hi all,
I'm trying to access the RNG on the Intel 82802 Firmware Hub
As in the document:
Intel
82802 Firmware Hub:
Random Number Generator
Programmer’s Reference Manual
December 1999
Order Number: 298029-001
I'm stuck at accessing memory outside my code, as my code throws Access violation errors when I try to read from the feature space memory:
<br />
unsigned char *pFeatureSpace;<br />
unsigned char *pHardwareStatus;<br />
__int64 val;<br />
<br />
val = 0xFFBC0000;<br />
pFeatureSpace = (unsigned char*)val;<br />
pHardwareStatus = pFeatureSpace + 0x015F;<br />
if ( (*pHardwareStatus & 0x40) != 0)
{<br />
val = 1;<br />
}<br />
else<br />
{<br />
val = 0;<br />
}<br />
return val;<br />
Could anyone point me in the right direction as to how to read from this hardware?
|
|
|
|
|
I can't be certain of this, but I don't think Windows will let you read/write to memory addresses that are outside of the address space of your program. You will need some way of getting the memory starting at 0xFFBC0000 mapped so that you are allowed access to it.
|
|
|
|
|
You cannot do this in user code. You have to write a .DLL or other device driver that runs in Ring 0 and provides the data to your app. Welcome to the wonderful world of NT Kernel programming!
|
|
|
|
|
I was afraid of this. But I'm not even in with the lingo yet - the Ring 0 idea gets me googling further - thanks. Any good guides out there for DLL writing and getting to Ring 0 / NT Kernel programming?
I may have bumped into this problem before in 2002, trying to get data from the ECP port really fast. I ended up abandoning Windows XP and got a linux system up and running, through which I got everything done, but I had to learn Linux in the process so I'm sure it's the same effort to just figure out NT Kernel programming.
|
|
|
|
|
ChrisBosch wrote: Any good guides out there for DLL writing and getting to Ring 0 / NT Kernel programming?
Not that I know of, but then again, i haven't had the need for about 7 years now. You might want to ask the same question in here[^].
|
|
|
|
|
Thanks Dave!
|
|
|
|
|
Hi Chris,
Actually... I think it is possible to read this physical address from usermode without writing a device driver on Windows XP SP2 and below. You would need to rely on some unsupported and fairly undocumented techniques hacks to achieve this however. You could start by researching Device\PhysicalMemory and NtOpenSection[^].
An even better solution would be using a device driver such as WinIO [^]to map the physical memory into your process. WinIO comes with full source code.
Best Wishes,
-David Delaune
|
|
|
|
|
Hey now there sounds like an idea - I'll look it up and let you know what I get going - unfortunately as pet projects go I can't deliver lightning fast results - work and social life somehow take preference...
But I'll definately come back here with a working piece of code hopefully other people can use this hardware RNG through our findings.
Also will have to look at how fast I can get random samples from the device - I expect it to be slowish, but one could definately incorporate the input into a psuedorandom sequence to yied hopefully superior results.
I'll get back to you guys.
|
|
|
|
|
Can somebody please tell me what to do about administrator password.
This pc was purchased from Costco as open box item and somehow it's
showing that there is an existing administrator code. I'm concern about
the privacy safety if I can't fix this issue.
God bless to you all...
|
|
|
|
|
Assuming the password to the account is non-blank, there're bootable CDs with command line tools that will allow you to write a new password for an existing windows account.
The latest nation. Procrastination.
|
|
|
|
|
Hello.
My program burns CD's/DVD's. Those CD/DVD's are sent out to a lot of receivers, countrywide. Now, I've got error reports from some people who claims that the two CD's they got is identical to eachother. That is not the case.
The CD's in question got the same volume label, the same anount of files, with identical file names.
But the content of the files differ.
When the receiver has read the first CD, ejects it and puts in CD No 2, the information doesn't change (due to the fact that the driver cdrom.sys doesn't notice the changed CD, I guess). And the content of the files (from the first CD) seems cached, so the user sees the files from CD No 1, despite the fact that CD No2 is inserted.
F5 doesn't help, since the file system doesn't become refreshed.
If the user reads a completely different CD between "my" CD's, the file system is refreshed and the information is correct.
My question:
What's the criteria (in cdrom.sys) for detecting a replaced CD in the CD-ROM drive? Different volume label, or what?
This problem drives "my CD readers" go nuts, and then it hits me...
TIA.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
modified on Wednesday, September 23, 2009 6:19 AM
|
|
|
|
|
kakan wrote: The CD's in question got the same volume label, the same anount of files, with identical file names.
Well I guess Windows may not be able to guess that the contents of the files is different.
|
|
|
|
|
I know how it works for diskettes, since I modified Windows diskette driver (a long time ago).
The diskette driver compares the diskettes serial number to the serial number gotten from the previous access to the diskette.
But for a CD/DVD? Maybe I should get a copy of the source code for cdrom.sys and examine it. I'm not sure I got the time for it. I think I'll hang around CP a while before trying that.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
This may be too late for your purposes, but I have only just seen your question.
Take a look at How to receive notification of CD-ROM insertion or removal[^] on MSDN.
Google could have saved you a lot of time!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hello.
I did at lot of Googling about the subject.
The article you are referring, talks about receiveing and handling WM_DEVICECHANCE messages.
In this case, there are no such messsage, and that's the problem.
My guess is that it's a driver issue.
My question was (and still is): What's the mechanism for the driver to detect that the CD/DVD has been replaced (and consequently send a WM_DEVICECHANCE message)?
In other words: What do I have to do with the CD's/DVD's in order to make Windows (and it's cdrom driver) discover that CD/DVD has been replaced?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
We are looking at our disaster recovery strategy. One of the big concerns is documentation. We are leary of having multiple versions of our documenation and so have it shared folders that are then backed up to key fobs. Right now the documentation is in word files and spreadsheets and screaming for a wiki.
I was wondering does anybody know of a wiki that runs on a shared server but can be downloaded and run off a key fob on a basic windows installation?
Ken
|
|
|
|
|
hi everybody..
i am searching "intel 284B HD driver".i have install my laptop but my driver CD is not working.i got the internet driver but i did not find the sound driver.please help me..
|
|
|
|