DS2438

General discussion relating to the library modules supplied with the compiler

Moderators: David Barker, Jerry Messina

Post Reply
Intellisenc
Registered User
Registered User
Posts: 30
Joined: Mon Nov 22, 2010 3:08 am

DS2438

Post by Intellisenc » Fri Nov 26, 2010 4:30 pm

I am new to Swordfish and developing a temperature/humidity system utilizing an EasyPic4 and 18F452. I have been successful with multiple DS18B20 to USART, LCD and GLCD.

Ultimately I would like to read voltage A/D through a DS2438 on a one wire bus that has multiple DS18B20 and multiple DS2438. Has anyone done work in this area, either with step by step reset/write/read or a DS2438 module?

I would be willing to work with SetPin and only one DS2438 device to begin. I can take it from there.

Intellisenc
Registered User
Registered User
Posts: 30
Joined: Mon Nov 22, 2010 3:08 am

LSB and MSB Register - DS2438

Post by Intellisenc » Mon Dec 06, 2010 4:33 am

I am now able to retrieve memory page 0 and get bytes 3 (LSB) and 4 (MSB) voltage information. I am just not able to convert byte 3 and 4, voltage LSB and MSB, after OW.ReadByte().

I will need to, ultimately, use Vdd, Vad and temperature to calculate humidity.

I am able to convert byte 3, but don't understand how to use byte 4. An internet posting suggested multiplying byte 4 by 256, adding byte 3 and dividing by 100, but I'm not that well versed with basic at this point.

Can anyone offer suggestions?

DS2438

BATTERY VOLTAGE DIGITAL OUTPUT (Binary) DIGITAL OUTPUT (Hex)
0.05V 0000 0000 0000 0101 0005h
2.7V 0000 0001 0000 1110 010Eh
3.6V 0000 0001 0110 1000 0168h
5V 0000 0001 1111 0100 01F4h
7.2V 0000 0010 1101 0000 02D0h
9.99V 0000 0011 1110 0111 03E7h
10V 0000 0011 1110 1000 03E8H

User avatar
Senacharim
Posts: 139
Joined: Tue Aug 10, 2010 5:19 pm
Location: Ventura, CA

Post by Senacharim » Tue Dec 07, 2010 2:29 pm

(This is from memory, not researched)

If I recall correctly, the rule of thumb is V = (ADC reading) * (reference volts) / resolutions bits.

Write that down somewhere, it's come in handy several times over the years.
It may not be amazingly precise, but in most situations it will by close enough.
Surviving Member
Bermuda Triangle Battalion
from 2026 to 1992

Voted "Most likely to time travel"--Class of 2024.

Intellisenc
Registered User
Registered User
Posts: 30
Joined: Mon Nov 22, 2010 3:08 am

MSB, LSB

Post by Intellisenc » Wed Dec 08, 2010 2:43 pm

Thanks for the info. I was able to shift MSB one way, LSB the other, add them, shift once more and arrive at a value I could use.

Post Reply