Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / One Wire Weather Station project (open source)

Author
Message
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Oct 2006 14:53 Edited at: 3rd Mar 2007 06:21
Hi All.

Have got myself a one wire weather station system that uses a one wire to send date of the device that is being measured.

Some of you my have seen the start of this in Dll forums.
http://forum.thegamecreators.com/?m=forum_view&t=91102&b=18
info on one wire here.
http://www.audon.co.uk/1-wire_weather.html
and here
http://www.aagelectronica.com/aag/index.html?target=front.html&lang=en-us
So looking for anyone who may have a bit of spare time to help on this project.

APEXnow (Paul) has been very helpful in get the ball rolling and has made a Dll the works in DBPro, however he does not have the hardware so its a bit write a bit then I test it and report back.

Having just read that bit above, it seem that unless some of you have a large amount of cash hanging about you may not or wish to join in, that will be ok, but if you thnk you my be able to convert some equations or draw a 3D pointer then jump in.

So await your comments

cheers Jonathan
edit
here what it looks like if you have just looked at this post.


Ps if made to work other device or item could be made eg alarms

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 25th Oct 2006 20:52
Yes, I have been following this a little...it interests me.

Dallas Semiconductor uses that 1-wire system in alot of their products. I had a thermostat chip that worked that way...quite nice, that.

I'd give you my cash, but...its steadying a wobbly leg on my computer desk...sorry. I will have a go at your code later...after work.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 05:59
Your Welcome, been think at work what problem may be and shorten it down to the iButton usb thing, so now looking for away to find, load and read this device.

1. what do I need to find
2. how do I list it.

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 26th Oct 2006 06:47
First of all, are you using the USB, or the RS-232 version? I think you should use the RS-232 version, since it is easier to implement in Windows using what you already have.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 26th Oct 2006 06:57
Looks like were going to have to do it the hard way brought the usb device and not the rs-232.

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 26th Oct 2006 07:31 Edited at: 26th Oct 2006 07:54
Okay, that is fine...since you already have someone on that anyway.

btw, I noticed that someone wrote software for that interface that uses DDE, which...would be another way to get the information from the driver. I will have to look at it some more, but...now, I have no time. Sorry.

EDIT:
Oops, spoke too soon...I had enough time to find the answer to your questions....since the first one.

http://www.maxim-ic.com/products/ibutton/software/windowsdk/index.cfm

The help file has all the details, even your dll calls. It is really a very beautiful thing indeed.

I installed it, but...its bedtime for sure. Your avatar...is...somehow...making...me...very .zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 27th Oct 2006 07:52
I did not have much time to mess with this today, but...here is something that you can use to interface to the ibfs32 dll, I don't know if that is what you want...

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 27th Oct 2006 13:03
I believe that the dll is all most there and should be able to read info from the sensors soon.

Been trying to think of a new way of showing wind speed, most of the time its a pointer, pointing at a number giving the speed, would like another visual way of showing it.

some ideas
racing clouds
bending trees
cornfield

could do the same with temperature and wind direction.

before anyone runs off to try any of the above check that the dll is working!

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 27th Oct 2006 13:10
Correct me if I am wrong...that dll is from LabView? It is not the one from Dallas/Maxim....ibfs32.dll?

Is LabView providing the dll separate from their own GUI now? That seems strange to me....very cool, but strange.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 27th Oct 2006 13:14
No LabView are not doing anything like that, I was on about the dll over in the dll forum that being worked on to communicate with the iButton device.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Oct 2006 03:19 Edited at: 28th Oct 2006 03:33
Just need to know how you put this C++ code into DBPro
using the dll call command and if statements.

l



cheers Jonathan

edit

this call

n=call dll (1,"TMExtendedStartSession",1,1,0)

returns 273

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 28th Oct 2006 04:13 Edited at: 28th Oct 2006 04:22
Have you looked at the "1-Wire SDK" help file? It documents each function very completely.

Here is the above code, modified to use your sample code, rewritten in DBPro...it is rough, but it still works for me, and I don't have anything attached to my machine, either. It should give you a solid idea of how to communicate with the dll, and by extension, to the network, and your instruments.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Oct 2006 12:59 Edited at: 28th Oct 2006 13:01
getting an index error, looks ok but what is the error trying to tell me?



Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 28th Oct 2006 16:13
another question, in c what does &Myvaraible equal in DBPro?

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 30th Oct 2006 09:07
There were a couple of typos hiding a couple of other problems. I made a comment in the code in the area I fixed.

Don't call the FindFirst/FindNext stuff. The last two parameters to those functions are actually pointers to structure memory, which you do not have yet. It will work somewhat like the make memory statements in the first call do.

Tonight, I have no time to continue. Sorry.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 30th Oct 2006 13:32
No worries, as and when every you can spare time, even if it just to say have you tried ??? or !!!.

ReturnPortType =1
wSetup =3

the above retured those values which I think is correct, trying to get wFirst to come back with something, it likes putting up the send to MS buttons , think i have to may parameters or not enough.

Ps. takes sometime to get going with the software that supposed to work together.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 30th Oct 2006 13:40
Seen you use the memory pointer trick how would I set it up to do this.

Quote: "state_buffer

Specifies a pointer to a memory location that TMEX keeps all of the state information for the 1-Wire networks. This parameter is required by most TMEX API functions."


as I just picked some number I saw in the code.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 30th Oct 2006 14:26 Edited at: 30th Oct 2006 14:55
It getting somewhere but returns the wrong port type, comes back with a 1, should come back with a 6 then it would find the device.

code without all the other bits tack on, has error codes printed to screen.




edit
when other programe is running setup comes back with error code 3, so some commuication must going on.

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 31st Oct 2006 03:52
I had the same trouble, so I did not use the port type from the registry. Notice that command reads your system registry, and does not query the 1WireNetwork at all. So, your registry is wrong, then...just like mine. No worries, we can safely ignore that, since we know that you have a USB device.

Perhaps you should add "or is currently in use." to the error message, because you know very well that the network does exist.

About the state buffer memory, I think it is more than 2 bytes long. I need to hunt it down, and give you a definition of the structure, and a way to initialize it, and use it. If you pass it that dwptr3, and it tries to write past the second byte (which it will most assuredly do), you will get an error. I did not try it, but...it smells like an access violation...previously termed "General protection fault". It will be bad, very bad. You already know this, however, and that is not helpful to you at any rate.

Make the dwptr3 memory block bigger...either find out how much, or make a ridiculous guess...256 bytes is probably way too big. You will not get an error for asking for too much, unless it is not available, so you can afford to be overcautious this time.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 31st Oct 2006 04:58
Quote: "and does not query the 1WireNetwork at all."

that where we have to go, Just remembered in the install for the usb that there is a 1 wire adaptor that the usb is talking to which is _ISREG32.DLL.

that's one we have to find out what in it.

eg

computer
^
usb
^
Adaptor
^
one wire
^
temp wind

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 31st Oct 2006 05:37 Edited at: 31st Oct 2006 05:59
I don't think that should be necessary. If the device is installed properly, it should reflect that in the system registry. It should not be incumbent upon your application to reach down a level to make this determination itself, that is not a good precedent to set, imo. I might rather see why my registry thinks the default port is serial, and not USB. Either way, but I think that doing this would be difficult to say the least.

That dll name looks most foreboding to me. Firstly, there is the issue of the underscore. That is no random underscore, I think. Next, is that a Windows dll, or a 3rd party driver? I am not sure, but it sure looks like a dll that is not intended for random poking about with, and if it touches the registry, I would be loathe to go in there with my guns blazing in DBPro, that is for certain.

EDIT: Just for giggles, I went to the 1-Wire website, and installed the latest drivers. I opened Regedit when the installation presented me with the find hardware dialog, and lo and behold, there is a new port type...6 with an associated driver, ib90usb.dll. That is the dll you mean above, I think.

Load the latest drivers here. That will return the proper port type if you install successfully.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 31st Oct 2006 05:38 Edited at: 31st Oct 2006 05:46
not made any differnce but have add this line into it



it finds the adaptor.

find more about here
Dallas Semiconductor1-Wire Drivers V4.00 Beta 3

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 31st Oct 2006 06:50 Edited at: 31st Oct 2006 07:54
I have a few questions for you...

Where/how did you get your equipment? I ask because you have the usb connector, but...your registry does not seem to reflect that.


Do you have any software that can detect and communicate with it installed now?

If not, the driver install should rectify that, or you could bravely edit your system registry manually....

I have ordered samples of two iButtons. I did not order the USB adapter yet because I do not have the money at this time. Pity, too...the starter kit is only $70USD. It uses the RS-232 port, however.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 31st Oct 2006 09:45
Wow, I am pretty stupid sometimes! The state buffer number you put in is correct, but...it is the size of the structure, not a value of a variable. That is why that did not work.
dwptr3 = make memory(15360) is what you needed there. I am still looking for the structure of the buffer, but I think they are unique to the type of device. It is a ROM address of some description.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 31st Oct 2006 12:01 Edited at: 31st Oct 2006 12:55
this what i am using to commucate with the iButton.



Ps. When another programe is running that talks to the usb adptor Setup comes back with 3, A 1 is given if other software is not run, Also the driver picker fails if the other software is running.

Might help a bit.

What bits in regertiser would I have to look for ?

ps should each command session be call with a TMExtendedStartSession
and ended with
TMEndSession
.

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 1st Nov 2006 03:06 Edited at: 1st Nov 2006 03:31
The driver returning that is not unusual at all. Like I said, telling the user that the network does not exist is not enough in this situation. I would add something like, "...or the USB port is in use." What happens on a machine that has two USB ports...one in use by other software, and one being given a request to start the 1-wire network? At any rate, it is normal, I think.

I am not certain that I understand the other two questions...sorry, but I will answer what I believe you are asking. As far as the structure, I believe that each device has a unique structure associated with it. I have not read all of the SDK notes, and also I downloaded a number of app notes and white pages. My printer is fubar att, and well...I hate using my development PC to read files like that...I really like hardcopy reference material. I will study the datasheets for the devices on your network, and we can make up some code to handle those. The samples I ordered are different devices, (I ordered the new temperature sensor, and also an ID button, which I did not need after all.) but they communicate using the same dlls, and in the same format.

I would only start and stop a session at program light off and program stop, unless there was a compelling reason to do otherwise. Since you are not required to share the USB port (Which apparently you are not, since the driver will not accept multiple sessions on a single USB port.), it would not be necessary, and you would likely want to go through all of the machinations of TMFirst/TMNext to find the devices, unless you wanted to keep that information elsewhere. (It make the most sense simply to find out what is out there each time...no need to configure in that event.)

Did you install the USB dll? You should be able to use the TMReadDefaultPort call if you installed the USB driver. That is what the above post was supposed to convey...see the default port number and driver in the registry? It appears that USB support is sort of new to the API. (When I originally used the DS-1620, it was only RS-232.) I got the correct numbers after I installed. I would imagine that your code that can read the devices is not reading the registry after all...it is probably looking in all of the spots for a network. (The RS-232 ports, the parallel port, and the USB port.)

The 1-wire API is based on the same OSI model that pretty much all networks use. The dll ibfs32.dll is the layer that your application is supposed to use. That is why I balked at using the other dll, which btw is from Dallas. The dll that talks to the USB port is ib90usb.dll, which interfaces to the driver, DS2490.SYS . You see, it is not supposed to matter to your application if you are using the USB port, or the parallel port, or the serial port. You are supposed to go to the registry and use the port that it tells you to use. That is what well-behaved applications do. Naturally, you are free to do whatever you like, but...I would do it the 'official' way, because I do not like getting bitten by my laziness and non-compliance
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 1st Nov 2006 05:57
Quote: "You are supposed to go to the registry and use the port that it tells you to use. "


I read that bit, I think OK, how do I read the registry to get those port numbers?

Have load the ib90usb.dll and have tried to get it to return something like setup = 1 but only get 0.



one snag their no TMReadDefaultPort for usb dll.

Thank you for your time on this project as it's a big help, learned quite a bit about memroy calls, how to talk to a dll and lots more.

here's what I done to it so far, it's a bit all over the place but see what you my be able to fix.



Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 1st Nov 2006 06:35
To answer your question about reading the registry, there are several ways to do this, but I suppose that I have not been clear. TMReadDefaultPort does that already. It gets the registry entry that I showed you above. You could duplicate that in software, but you will get the same incorrect answer. The fix is either to ignore it and plow on (I don't recommend this because it is a short and unpleasant trip, I think.), or fix your registry.

If you follow the link above that says "Load the latest drivers here", and install the drivers from the site, it will update your registry to have those entries, which will allow the TMReadDefaultPort to return the correct values. (1 and 6). That is why I asked you about where and how you got the equipment. It seems like you would have gotten the latest drivers, unless you got it sharply discounted because it was discontinued, or whatever. I do that too, but it might be a good idea to visit that link, or otherwise reinstall the USB driver. Did the installation ask you to plug in the USB adapter? (I want to be absolutely certain that the driver is also installed correctly.) I am still somewhat puzzled as to why your registry is not reporting the USB adapter. I mean, mine does and I don't even have an adapter, I just cancelled the installation when it prompted me to plug it in.

I will take a look at your code, but for your part, I would recommend addressing the installation of the software on your machine. It seems to me it is not tied together properly, although I will look again at the site...it took me back to Dallas/Maxim the first time. Did it come with an application that is working now?
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 1st Nov 2006 08:00 Edited at: 1st Nov 2006 08:03
Okay, I am stupid, or at least my memory is failing slowly. _ISREG32.DLL is not so much from Dallas as it is from their install program. I remembered finally! It is an InstallShield install. I used to write them. That dll is for updating the registry during an installation, I think.

Do you recall having any troubles installing the software?

If yes, maybe you should uninstall, and then reinstall. Then, visit that link and update your drivers.

If not, press on with installing the latest drivers.
Sorry to be so attle-brained, we'll get there eventually.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 1st Nov 2006 12:20 Edited at: 1st Nov 2006 13:07
brief run down,

When I first got this device all I did was load in the weather programme version 5 and tried to run it, it would not go, could not find any port adapters, so did some digging, then found the Dallas exe that you see I have use in the programme which then made a port to connect to available.

now off to have fun seeing if I can take off the bit that should not be there.

edit
taken off bits that may have been confusing it, now have a wired problem programme does not run if I take the SetPrt32.exe out.
as I think, get it to run with rs-232, then just a matter of getting the code to find the usb.

Ho! hum it, off to buy one RS-232.
Question do you think this may be easier if I were to buy a rs-232 port at least we know we should be able to talk to that.

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 1st Nov 2006 19:27
Okay...what is going on here is that you installed the weather station software, but it did not install your USB driver, and update your registry. That is because it is a very old application, and the USB driver did not exist then. That is not good, but also not surprising.

The SDK code works in some cases because the main driver, ibfs32.dll is installed and working. You cannot go beyond that because there are additional drivers in the chain to the weather station. You do not need to purchase anything in addition to what you have already. Just go here http://www.maxim-ic.com/products/ibutton/software/tmex/, and install the latest drivers. Here is what should jump out at you on that page:
1-Wire Drivers (Now Supports DS9490 USB!)
You have the DS9490 USB...which is new. Take the first link there, and you can either install the Java component too when asked, or not. It makes no difference to this application. After that, you will be able to use the functions in ibfs90 that go into the 1-wire network because you will be able to go through the USB adapter then. You will be asked to plug in the USB adapter at some point, but...begin the install with it unplugged.

I'm off to work, cheers.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 2nd Nov 2006 05:46
Well followed above ok, and it has loaded ok, like it should, Only it still not returning the info were looking for.

click the view button to see what I get.

off to bed now.

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 2nd Nov 2006 05:50
Well, I am now very sorry that I did not go ahead and post this before...


I knew that the short integers (2 bytes) would be important soon! I wrote you a function for that. Strings will be more intense, I am trying to be too clever, I think!

Try some form of the code above, I am curious to see what it tells you.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 2nd Nov 2006 11:10
Well done, that's seem to been giving the correct response, see picture.

Now to try out somethings.....

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 2nd Nov 2006 11:49 Edited at: 2nd Nov 2006 13:04
Well things are looking good, have got I think the iRom to return a value of 1. see picture, device count may need some looking in to as I have made it stop after 6 checks as it would go on until out of room.

Wow! if this what you can do without a device, as to what you will get up to when get one.

This may help for later, its what the other weather software see in its config.


Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 3rd Nov 2006 02:36
XLNT....most xlnt indeed. Did you try to run the weather station software yet? I think it should be able to go now. I think it might work, as long as they played fairly like we did when confronted with the driver selection issue. No matter if it doesn't, you are going to write your own anyway.

Oddly enough, my first iButton just arrived today! Unfortunately, its the serial number iButton. Still, its very nice. I imagine it as some sort of security device, or key. I took some pics, but...I've misplaced my spy cam adapter somewhere in my lab. I will post when I find the cable. It is almost exactly the size of a US dime. To anyone reading that doesn't know about iButtons, they resemble hearing aid batteries, CMOS batteries or watch batteries. The can that they are in provides power and also it is the communications interface. You can read an iButton by placing a probe on it that is attached to a reader...a PC, or custon device. They are available in a wide variety of functions, some can be programmed for alarms, or to sample and store data autonomously. They are really amazing little devices.

I rewrote the code we've been using. Its time to get serious, and I see you have been busy! One of the things that I wrote in a more structured manner is a routine called EnumerateDevices. I will look at the code after I have dinner, but...I hate while loops that have no exit...I really wanted to spend a little more time getting an appropriate stopper in there in the event the code was flawed. Sorry.

Next, I intend to put my telescope on the Internet for everyone's viewing pleasure. I still lack a camera ($99), and I am still writing support routines, but...I can talk to the telescope well enough using DBPro, or VisualC++, or the app that came with it...all is moving forward.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 3rd Nov 2006 05:09
Quote: "Next, I intend to put my telescope on the Internet for everyone's viewing pleasure. I still lack a camera ($99), and I am still writing support routines, but...I can talk to the telescope well enough using DBPro, or VisualC++, or the app that came with it...all is moving forward. "


Sound like your going the same way as me looking for a low light outdoor camera that can see stars and in the day watch the view of weather coming in.

Quote: "Did you try to run the weather station software yet?"

Lost me on that one, who's,
Still getting to grips with this on making it talk to and received info.

Think I will have a look at how they get the direction as I know I can make that move by hand a give a result.

Missed postie (thursdays) will pick up serial port adaptor Friday then will see if program can show difference.

Good job you know C++ and other stuff as I only know basic.

cheers Jonathan.

Dark Physics makes any hot drink go cold.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 6th Nov 2006 12:41
Well all weekend gone and still no get anything going, can't seem to get a reault!

On the other Dll have commucation but thats all no other bits work.

If I could see how read weather was written then I might be able to do the same for this, but can't find or see it.

??

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 7th Nov 2006 06:32 Edited at: 7th Nov 2006 06:52
Sorry 'bout that. I ordered my usb adapter tonight. I have two iButtons and a reader of sorts. I should have all I need next week.

Before, I was referring to the software that came with the weather station. I believe that it was Italian. I had wondered if perhaps the driver update fixed it, and now it would work.

Right now, I have a new version of the code we were working on, but it is not really ready to post. I want to get a generic template for use in creating more specific applications. The trouble is that I have the code spread out in 4 source files because I use alot of generic routines and also, I am putting a Windows interface on my application. I will try to get something else for you to try yet tonight.

EDIT :Try this code. On my machine, it finds no devices, and each second, it retries. I am not certain that it is correct, but if you are connected all the way to the weather station, I would hope that it would be able to find your devices. btw, I looked at the ib90usb.dll file and found the devices listed in there, so I can start making appropriate UDTs for them. It will really open up alot of possibilities then.



I do hope this helps.
Regards.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 7th Nov 2006 13:16 Edited at: 7th Nov 2006 13:44
Thing are looking good, works with both types of adaptors usb/serial, screen shot in view button.

comes up with different counts on devices but I believe you may be still trying to sort that out.

edit

When I slow programe down so I can see some number session handle show zero but thers a small flash of some numbers, that are the start number 353 then it add 256 to it eg:
353
609
865
1121
1377
1633
1889
2145
2401

may help in something, not sure what's is telling me, might be of use

PS
error handling works a treat, unplug it and it say it no there.
edit

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 8th Nov 2006 02:33 Edited at: 8th Nov 2006 02:41
That is why I was hesitant to post. You know how we are using NULL (0) when we ask for the session handle? You can give it a dword pointer that you can set some flags with...for example, you are supposed to be able to make the session permanent. The session gets invalidated after 1 second of silence, or other things. I wanted to be able to keep the session handle valid so that I hot swap components at some point. Anyway, the code checks for a valid session once a second, and gets a new one if the old one is not valid. Also, you get the zero return when the usb adapter is still busy from the last session. (That is now invalid!) Anyway, I suppose that I will eventually code it to simply restart from (nearly) the beginning. The zero code would return an error message of "Port not available.". (Before, we had encountered that...the message was "1-Wire Network does not exist.")

I think that the handle values returned are not a problem. I think that the driver has invalidated a session, and the next one returned is 256 greater than the last. You can comment out the GetValidSession() in the little tick heartbeat logic. Then, we will simply use GetValidSession prior to all calls into the network. I think that will be the best way to proceed. I let it go for 8 hours the other night...handle numbers were nearly a million. I was not able to check for any side effects...I've got my good eye on it, I hope.

I "had" to buy another iButton to avoid a $10 fee. (Naturally, I "had" to have one that cost $13!) It is on its way with my usb adapter and a Blue Dot cable. Dallas sampled me a blue dot connector. It is very curious, this thing. I must redouble my efforts to find my camera cable! Anyway, I got an iButton with some memory and another clock. You know a man with two clocks never knows what time it is. (Now, I am craving Chinese food for some reason....weird.)

EDIT: btw, here is the list of device names that I pulled from the ib90usb.dll. They will, I suspect be in the mysterious structures that are returned by TMFirst and TMNext. I am quite curious about the EnumerateDevices function...I really hating coding in the blind like that. (Truth...it is a little nifty when it works, however.)
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 8th Nov 2006 05:24 Edited at: 8th Nov 2006 06:17
Quote: "I really hating coding in the blind like that. (Truth...it is a little nifty when it works, however.)"


I think it Flipping fanatic that you have got anywhere with it, it a bit like painting a picture! but I not telling you what I want or the colors.

in the one wire setup 'set port 32' program it has this in brackets after the dll name

(C00.54 S0000.0000 P0000 V0000) might mean something, When the Weather V5 program runs the first time it looks for the adaptor and assigned that to use.

when its then found the devices, it does whats in the picture, names in there may help.

cheers will read your next replay about 4:30 gmt

now to read the post you made.

/edit

just done some checking and in the weather program it as an auto search button, when run with a serial adptor and usb one plug in it come back with the following.

adaptor : 5 port #1 ok
adaptor : 6 port #1 ok
adaptor : 6 port #2 ok

seem like theres one only on serail but two on the usb ..?

also been trying this but maybe doing it all wrong a function to get TMGetAdapterSpec.



/edit

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 11th Nov 2006 10:32
I have received my USB adapter and now I have some improved code for you to try out. I have found an error in the SDK that was tripping me up. I found a typo or two that I had made, and also I have rewritten some of the code to adhere better to my view of proper network communications. Then, I stumbled onto the fact that the ROM array is passed both ways as a word array, not byte like I believed up until about 20 minutes ago! I went ahead and created a dynamic array. I was glad to quit playing around with this like it was some sort of class project. That array will be our best friend for a while once we get the UDT fleshed out sufficiently. It is truly on now, I think.

I found my three devices. (There is an ID iButton in the USB adapter.) Next, I will retrieve and format the relevant information, and then we need to dive into the devices to get their goodies out. Some have memory that is arranged as a paged file system. My Thermochron and my memory iButtons both have real time clock/calendars which need to be set and also there is an oscillator that needs to be enabled to start the clock. The Thermochron is really nifty. It has what are referred to as missions. They are simply timed data acquisition events. They can create and store histograms and also trigger at high/low points. btw, it seems that the temperature in the lab varies from 69 - 72 F. I can also see when my roommate turns the thermostat down! (I already knew that one, my room is the draftiest one in the house, besides the furnace is in the lab. It is naturally ran from the doorbell...truth, more or less.)

Now, you have really gotten me started with this project. I am going to ask Dallas to sample me a 4 channel Analog to Digital converter. I am also going to purchase this very excellent TINI network adapter. That is what I will drive my iButton Network with, I think. It has its own microcontroller, and also it will plug straight into my router, so my data acquisition is instantly Internet-able by two means without any additional effort. I already have two such embedded Internet micros...a BasicStamp, and an older emWare Philips Micro that I quite like. This will be much better than that even. This micro has 8 processors in it.



Okay, I work today, so its all over for me tonight.

Cheers.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 11th Nov 2006 12:58
your a coder, its talking and has come back with the correct numbers that I get in the other programs .

That is some piece's of work there.

wonder if its the same control in them Ipods??

Now to work out how to get something from the device like tempture, is the a page of info I should look at the will help me on this?

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 11th Nov 2006 13:17
Here's what it comes back with on the serial port adaptor.

Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 12th Nov 2006 04:03
...I wish. Then, I would have gotten an iPod. I am generally disappointed in Apple, and in Steve Jobs in particular. That is a different thread, however, and I've got a fine mp3 player/flash drive that ended up costing me $20.

Not 5 star, but I do okay. Thanks. The secret is to know the big picture, and then learn the little bits in turn, I think. My background is in electronics, specifically aircraft electronic countermeasures, passive sonar, communications and data acquisition. (Not really mainstream stuff, but...that is where it all ends up eventually.) I have been working in this manner for about 25 years now, so one thing that I have in abundance is experience. I can pretty much suss out how to do anything with a Windows based PC, but that is mostly due to the fact that I have an enormous collection of reference material, and I know how the machine works down to the metal. I have bought into Bill's hell, and I feel quite cozy here.

Okay, then...enough of that. It is nearly time to look at the specific examples of 1-Wire Network code. I say this because we have a workable session layer interface to the network in DBPro. We still lack some device specific information, but...the same hammer applies to this portion of the program. (I am referring to dynamic arrays based on UDTs, here.) Each device has some sort of common functionality, and also...unique functionality, as well. One of your devices is actually switchable...the counter that is used for the wind speed is also used for the rain guage, I think. Anyway, tonight I am going to redo the display so that it resembles something more akin to a network packet sniffer. (Which are pretty neat little utilities, btw.) The difference here is that we are going to use the network, not just spy on it. (I plan to push some data out the other side of DBPro, and onto the Internet at some point...soon, I think.)

The USB has two ports defined because there are two versions of the USB adapter. The other one simply holds one F5 sized iButton, it cannot host a network like the other adapters can. Another thing about the USB adapters is that they will not work on some laptops that do not have a USB Host. (Apparently, some use USB slave ports...too bad, really, but that will affect any USB device seeking power from the bus.) The RS-232 adapters do not suffer from this, but using them is just like using any other ports, you need to use the session layer, and not try to talk directly to the com port in Windows.

About your question...the SDK has some information, but...I prefer to read the individual data sheets for each part. There are some white papers that I recall seeing which covered topics like "Reading Temperature with a Dallas DS1921", for example. I joined the Maxim Forum last night, and looked in their forums, but...most of those people are using the OWI Java stuff with all kinds of other languages and even Labview. Yes, I know LabView a little, but I was never able to convince my employer to buy into it because he wanted me to write all of the GUI in-house. I understand that, too...but LabView is a really primo test equipment metaphor in Windows, and it is not really that pricey, considering how well supported it is straight out of the box. It is really a sort of hobbyist's dream when it comes to data acquisition GUI. DBPro has that sort of potential, and even more as your initial posts alluded to...I agree. In fact, it might be worthwhile to create some models that can be animated based on the input from the sensors. There, my skillset is much more limited. Honestly, I think I should invest in a decent mouse, or trackball.

Cheers.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 12th Nov 2006 12:00 Edited at: 12th Nov 2006 12:11
Jinzai thanks for the in-site of your experience, now I see why you are able to get to bit's that other my not reach, I to work in electronics but only to the point of assembling it, someone else as had the fun? hard work of designing it all.

My programing has been om a few machines from a BBC32, Acorn and Amiga, my favourite is the Amiga 500 and 1200, which use AMOS which is very much like DBPro.

On another note anything you need me to find on the working weather station that my be of help, the devices that are in the weather station are chip numbers TAI8515 for temperature, wind speed and direction, the rain gauge is a TAI8575.

polling of date in weather programe is like this

Taking time
Wind Dirction
RainGauge
Pressure
Send data
Read data
Wind Speed
Humidity
Tempture
Extra Tempture

Repeat top of list.

Strange the stuff I'd seen goes on about TAI8520 suppose it my be the same or the software it telling porky's

Cheers.

Dark Physics makes any hot drink go cold.
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 13th Nov 2006 10:13 Edited at: 13th Nov 2006 10:38
I have yet to address the application, so...I cannot comment on the devices too much at this point, but rest assured that we will be dealing with them directly. I want to establish communications in the same manner as the http://en.wikipedia.org/wiki/Open_Systems_Interconnect model it implements does, and honestly, I do not have as much time to invest in it as I'd like.

Seriously, the implications of this interface are somewhat more far-reaching than this application (Which is pretty amazing in its own right) that you are porting into DBPro. For example, you can actually purchase MAC addresses for 1-Wire Network devices, so they can literally hang on ethernet connections, and therefore the Internet. Given DBPro's accesss to Internet protocols, some native, others by similar reference to this....

Anyway, here is my latest, which does what I had intended. I am almost done defining the DEVICE UDT, and then it will be off to the races. I do hope that you will make a function out of your wind chill calculation. If you notice, my functions usually start out with "jz". This is not vanity so much as convention that lets people know that I wrote the function. I am going to annotate the source file to reflect this, and also...there will be a versioning scheme this week, which will allow me to upload it to the codebase. I sort of use my own system for this because I have usually worked alone, or was the program lead with the ability to make such egotistical determinations.



I think it is getting a little big to keep posting here, too. I apologize for that, it is nearly a WIP, however.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 13th Nov 2006 12:15 Edited at: 14th Nov 2006 05:58
here's a screen shot of your up todate code showing whats connected to.

Quote: "I think it is getting a little big to keep posting here, too. I apologize for that, it is nearly a WIP, however. "


No worries (long! I posted something this long and called it short ) move it to WIP board if you wish.

Well wind speed is showing, on the other weather program that its over 20mph here today (Monday), which is as high as it will count.


await the next instalment as and when ever your time will allow.

cheers.

made this bubble compass, what do you think?



Dark Physics makes any hot drink go cold.

Attachments

Login to view attachments
jinzai
17
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 14th Nov 2006 07:30 Edited at: 15th Nov 2006 10:19
I like that alot! I always like the procedural media, and that one is very sweet! Do you have any others that we could use? That one will do the direction fine, I imagine. It will be pretty easy to hook up to the data, I think. (Getting, then getting to the data will be the rough slog.)

I am not sure, but that might not be the maximum speed possible, I still haven't looked at the data sheets yet. I have them, and here are the links to the pdfs, if you do not already have them:

http://datasheets.maxim-ic.com/en/ds/DS2450.pdf
http://datasheets.maxim-ic.com/en/ds/DS1920.pdf
http://datasheets.maxim-ic.com/en/ds/DS2423.pdf

I did not get much time in on this tonight, but I was able to begin to make a layer of abstraction so that we can use the devices in your application more easily. I am nearly there. Soon, things will get a little dodgy, but we will muddle through.

I disagree with the contention that DBPro cannot be used in an OO manner. I suppose that I will settle on calling this method object centric as opposed to object-oriented. Anyway, it is applicable to more than just iButtons; it works well in a game loop, too.
[REFERENCE: lines 1257-1446]

I apologize for the display, I keep avoiding taking absolute control over the display. It will happen soon, though. It is a real mess now, but it is nice to have all of that info a function call away, isn't it?

WRT the size of the code, I would not be offended if asked to cease posting it. It looks alot better now than it did before anyway.



EDIT: I just updated this snippet, rather than post again. It is much improved over the last, I think. Now, the display is drawn only from global function calls, and I have almost made the entire connection that way.

enjoy.

Login to post a reply

Server time is: 2024-05-04 20:03:23
Your offset time is: 2024-05-04 20:03:23