Thank you for being a valued part of the CNET community. As of December 1, 2020, the forums are in read-only format. In early 2021, CNET Forums will no longer be available. We are grateful for the participation and advice you have provided to one another over the years.

Thanks,

CNET Support

Question

Device Name Parameter for CreateFile()

May 12, 2016 6:48AM PDT

I am trying to write a C program to communicate with some OneWire devices from a Windows PC via a Maxim DS9490R USB-to-OneWire bridge. The C program (a simple command line application) is built using Visual Studio C++. I am having trouble with the CreateFile() function. What string do I have to supply as the "filename" parameter (the first parameter) to identify the DS9490R, which is plugged into a USB port on my PC? The code that I am basing my program on (part of Maxim's OneWire Public Domain API) contains the comment "For this platform use format '\\.\DS2490-X' where X is the port number". DS2490 is the name of the chip inside the DS9490R. I have tried the format given, and many variations of it, and all give me an error "Error 23: Failed to acquire a necessary system resource". I know that the hardware is working, because a different Maxim application (OneWireViewer, a Java app) works perfectly well, and finds the DS9490R, and the devices attached to the OneWire network, and can read values back from them. I just need to make this work in my C program.

I hope someone can give me a hint that can get me over this hurdle.

Thanks - Rowan

Discussion is locked

- Collapse -
Answer
Small world.
May 12, 2016 8:23AM PDT

I had the old Dallas One Wire system with the weather station and more. It also had an USB to one wire dongle and at the time Dallas had example code. In your case back to Maxim to see if they have example code and drivers.

In short I had to install the driver for the USB dongle then the apps would work.

- Collapse -
Thanks
May 12, 2016 9:10AM PDT

Thanks for your reply. I have asked Maxim for help, but no reply yet. I have also tried running their example application, which doesn't run either (although a different Java program does run, so I know it's not a hardware problem. Maybe a missing driver or something...).

So I'm still searching for a solution...

Thnaks - Rowan

- Collapse -
You may want to read the Java source to see what they did.
May 12, 2016 9:15AM PDT

That would be my next move.

Maxim used to have source for such things. Have they changed?
(Sorry but I didn't check on that for you.)