HOME - - - - - - - TUTORIALS INDEX - - - - - - - - - - - - Other material for programmers

Delphi: Using Dallas MicroLan (aka 1-wire) ADC Chip (DS2450)

This has good information, and a search button at the bottom of the page

Please don't dismiss it because it isn't full of graphics, scripts, cookies, etc!

Click here if you want to know more about the source and format of these pages.


This page gives you access to two tutorials on reading the DS2450. One has a minor flaw which I'm afraid you'll have to find for yourself. The other has "extra bits" which may be an unwelcome distraction.... or may be useful to your learning of Delphi. The one with extra bits does have the essentials of reading the chip set aside in two tidy subroutines. (One to initialize the chip, the other to read from it.


First Option: The one with extra bits may be useful to people with no interest in programming. It allows you to monitor the voltages on the four inputs. I wrote the extra bits to give myself a "test instrument" when I was working with a Dallas wind direction and windspeed sensor (Dallas design, now AAG badged.) (Available from AAG.. navigate to their weather instrument "TAI8515". $75... but well worth it... beautifully made, and great design.)

I'll try to write this up a little better one day, but for now, here's a zip file with the sourcecode, and a copy of the exe file. Note: You have to create a small file called DS039ini.txt. It has to be created with a simple text editor, not Word... "Notepad" is fine. (Or you can use Word if you know how to save your work as a plain text file.) You have to store it in the same folder as the .exe file. The file should look like....
aaDS039ini.txt file
1 <-1st char determines port where adapter is.
5 <-1st char determines adapter type. 5 for U, 1 for E
IDA:eb00000001826020
... but you WILL have to change what follows "IDA:" to match the ID of your DS2450, and, unless you are using the same type of adapter I was using, on the same port, you'll have to change the entries in the second or third line. No big deal... I'll help if you need it.

The program writes the things it sees to a memo. You can pause and resume this logging, and you can use copy/paste to move those results to other places for further analysis.

The program also "translates" each reading into "Small", "Medium" or "Large", and you can adjust the boundaries, i.e. the definitions of those categories. This may not seem very useful to everyone, but if you are working on a problematic wind direction sensor it is a great help!

N.B.: The program FETCHES 16 bit numbers from the ADC, but DISPLAYS them divided by 256.
Second option: An older tutorial on the DS2450. This particular tutorial is more than usually sketchy... please don't judge my other tutorials from this. You will find extensive commentary in the source code. (Click on the "source code" link to download a zip.)

It gives you almost working software to read the DS2450, a 4 channel analog to digital converter. There is a little flaw in the program!! I think it was because, somewhere, I only read one byte instead of two to fetch a cehcksum from the MicroLan. The code is 99% okay, and "unclttered". It reads channels A, B, and D properly.

Within the source code, you will find

Function ConfigureADC, and
Procedure ReadDS2450ADC

The rest of DS005 is just to call those two items. Around them, you can build your own program to make use of the DS2450 analogue to digital converter (ADC) chip.

The demo only uses the chip's ADC features. The chip can also be configured to flag conditions above or below thresholds set by the user. Any or all of the 4 analogue inputs can be sacrificed if you would rather use their pins for single bit outputs.

A word about a trap I fell into: In the data sheet from Dallas, you are given help with writing programs for the DS2450. There is frequently a single line saying "Read CRC". To do this takes TWO calls of TMTouchByte. (Obvious, when you think about it... but easy to fall into the trap of forgetting that the CRC is a 16-bit number, and TMTouchByte only reads 8 bits. (Yes... I know... the name SHOULD have saved me making that mistake of thinking I could fetch the CRC with one call of TMTouchByte. Isn't programming fun?)

For more on the MicroLan and why it's cool, see... My guide to MicroLan


   Search this site or the web        powered by FreeFind
 
  Site search Web search
Site Map    What's New    Search


Click here if you're feeling kind! (Promotes my site via "Top100Borland")
Ad from page's editor: Yes.. I do enjoy compiling these things for you... hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows pc) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!

Click here to visit editor's freeware, shareware page.


Link to Tutorials main page
Here is how you can contact this page's author, Tom Boyd.


Valid HTML 4.01 Transitional Page WILL BE tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at validator.w3.org


If this page causes a script to run, why? Because of things like Google panels, and the code for the search button. Why do I mention scripts? Be sure you know all you need to about spyware.

....... P a g e . . . E n d s .....