Reading One wire via Visual Basic

EL34

Active Member
Does anyone have a simple Visual basic working example of how to read a one wire network DS1820 temp sensor?
Or any one wire weather device would do, just as long as the code actually works.

Everything I come across on the web or the SDK file does not work for one reason or another.
Either it's VB6.0 or this or that shows as an error, and I'm not savy enough in Vb to figure out why or what references are missing, etc.

I'm messing around with Visual basic 2008 express, creating windows apps.
I am also using a HB 6 channel master hub 9097U via serial port com 1

Thanks
appreciate any help I can get
 
I'm not going to be any help there because I don't use Visual Basic. I do all my coding in Java or C/C++.

Eric
 
Yeah, I do all mine in perl.

It's just way easier to do windows apps with VB

I found a VB forms example on the web last night that may be of some help.
Still, would love to see some simple, stripped down examples that just read a specific sensor by calling it's long number.

Thanks Eric
 
Yo Eric, maybe you can answer this.

I can read the DS18s20 sensors with the VB program example I found, but only if I go into the one wire viewer and click on the correct channel of the 6 channel master hub and then I have to click the switch in the one wire viewer to get to the aux port of that particular 2409 on the hub.

How do you get past the 3-2409's on the hub and get to the proper main or aux port to read the sensors.
I'm going to start reading docs, which usually ends in me looking at things for hours and not getting anywhere. :)

Basically, I guess the whole chain is
9097U com1
......... 2409's on the hub
.................devices on main or aux port on each 2409
 
Made some progress in reading my Ds18S20 temp sensors via Visual basic.

Now the problem is that Wserver is using the one wire network via my 6 channel master hub 9097U com1 one port

Looks to me like you cannot access the one wire network if an application is already tied to it, correct?
My Vb app works fine until I start up Wserver.
Each one wire software app wants exclusive access to the one wire network.

I want to read my temp senors that are going in my greenhouse and so I think I need to install another one wire adapter.
I am already using my only serial port and so I think I need one of Eric's usb adapters to get a second one wire network going?

Wserver is handling my weather station and my VB app will Handle the greenhouse Ds18s20 temp sensors via a usb adapter.

Does that all make sense and have I got it right? :)
 
You are correct that only one application can have access to the 1-Wire network at a time so you would need to add another adapter and 1-Wire network if you want two applications running at the same time.

As for using the Hub you need to turn on the channel of the DS2409 that your device is attached to before you will see it on the network. I have some Java code that does that if you would like to take a look at it.

Eric

Made some progress in reading my Ds18S20 temp sensors via Visual basic.

Now the problem is that Wserver is using the one wire network via my 6 channel master hub 9097U com1 one port

Looks to me like you cannot access the one wire network if an application is already tied to it, correct?
My Vb app works fine until I start up Wserver.
Each one wire software app wants exclusive access to the one wire network.

I want to read my temp senors that are going in my greenhouse and so I think I need to install another one wire adapter.
I am already using my only serial port and so I think I need one of Eric's usb adapters to get a second one wire network going?

Wserver is handling my weather station and my VB app will Handle the greenhouse Ds18s20 temp sensors via a usb adapter.

Does that all make sense and have I got it right? :)
 
I figured it out just a bit ago.
Like you said, I had to turn on the appropriate channel in the 2409 switch to be able to see the Ds18S20's that were attached to that channel.

It's wierd though.
Wserver runs 24/7 here, but I am able to sneak in, get my readings and get out without any problems?

The whole problem I was having, was just based on the fact that I did not have the 2409 switched properly to be able to read the exact temp sensors I was trying to read.

I am not sure if this breaks any rules, but wserver and my app are both sharing my master hub and both are able to get readings.

My app checks temps every 60 seconds and then bails out.
Not sure what would hwppen if Wserver and my app were both trying to check the one wire network at the same time.

Probably best to get that USB adapter and keep my app away from the master hub and wserver.
 
My app checks temps every 60 seconds and then bails out.
Not sure what would happen if Wserver and my app were both trying to check the one wire network at the same time.
One of them would fail to acquire the 1wire network. If you are using the TMEX routines, then if an app opens the 1wire network (TMExtendedStartSession) but doesn't close it (TMEndSession), there are rules for determining when the next 1wire session can start. See the docs for TMExtendedStartSession.

Probably best to get that USB adapter and keep my app away from the master hub and wserver.
Good answer! There's only one "default" port so you'll need to manage the port numbers and types (usb,serial) on that yourself. Hopefully wserver can be configured to use a specific 1wire port/type.

Technically you could share the 1wire network between two apps. Both apps would need to be aware of the sharing and would need to recover gradefully from access collisions.
 
I am using the OWCOM API and I believes that Wserver uses TMEX?

I believe the last version of Wserverv came with the TMEX drivers as part of the install.
Arne's latest Wserver version may now use the OWCOM API, don't know.

Anywho, both pieces of software seem to be sharing nicely at this point.
I looked at serveral of the Wserver text files for serveral of the sensors and it doesn't seem to be missing any data.
Haven't seen any error messages pop up either.

Wserver reads all it's sensors every 60 seconds and so does my app.
I'll just keep an eye on things and see how it goes.
 
engboytwo said:
EL34,
 
Are you still out there? I am interested in the 1-Wire interfacing you did with VB6.
 
Yes, My one wire system has been running since 2006
I have never used VB6

Everything I have ever done was in VB.net using visual studio
 
Back
Top