Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Reading 1-Wire devices with the HA7S interface SIP


  • Please log in to reply
2 replies to this topic

#1 Llaves

Llaves

    New Member

  • Members
  • Pip
  • 9 posts

Posted 25 February 2012 - 05:35 PM

The HA7S is a 6-pin SIP made and sold by Embedded Data Systems. It costs about $20 and provides an ASCII command set to interface to a string of 1-wire devices. (Usual disclaimer - I have nothing to do with EDS other than being a satisfied customer. Their customer service is outstanding.) The attached zip file contains a small class I've written that interfaces to the HA7S and provides a number of functions needed to read 1-wire devices, particularly DS18B20, DS18S20, and DS1822 temperature sensors. I've included a couple of other convenience classes I used to write a temperature logger. The delay time for temperature conversion was set empirically - I originally set it to 1 second, but one of the sensors I was trying to read was failing with that interval, so I boosted it to 1.25 seconds to make it work. Obviously your experience may differ.

A couple of things to pay attention to if you want to extend the library.
1. Most of the commands end with a <CR>, but a few, like the search commands, don't.
2. You never send binary data - everything is ASCII. If you want to send the byte representing 10, you send the two ASCII characters "A" and "0" (zero). Commands that require a length byte use this character coding.
3. The Write command is actually a write/read command. It uses the same method as the underlying 1-wire protocol. If your command will return 4 bytes, you append "FFFFFFFF" to the command. After you issue the write command to the HA7S, the device will echo back the command. The data being read will be AND-ed with FFFFFFFFFF, so that's where to look for your response.

Although I've written tons of code over the years, this is my first C# code, so any comments on style and techniques are welcome.

Attached Files



#2 Gorf

Gorf

    Advanced Member

  • Members
  • PipPipPip
  • 96 posts

Posted 08 March 2012 - 09:06 AM

Thank you for posting this code. My application is very different in terms of linked hardware, but as I'm new to C#, it's nice to see how the code fits together.

#3 Fred007

Fred007

    Member

  • Members
  • PipPip
  • 25 posts

Posted 25 April 2014 - 02:01 PM

Can you supply the pinouts you used for the HA7S? Assuming pin 3 to the Netduino digital pin 1 and pin 4 to Netduino digital pin 0, just want to make sure I have that correct. Thanks.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.