Skip to content

Commit c32bd4e

Browse files
committed
As received from Maxim owpd310r2 website
0 parents  commit c32bd4e

File tree

235 files changed

+81979
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+81979
-0
lines changed

ReadMe.txt

Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
Public Domain 1-Wire Net Functions
2+
Version 3.10
3+
3/24/06
4+
Copyright (C) 2006 Dallas Semiconductor
5+
6+
The 1-Wire Net functions provided are written in 'C' and are intended
7+
to be used on platforms not supported by the TMEX 1-Wire Net
8+
drivers. The '1-Wire Net' is a one wire and ground network with one
9+
master and one or more slave devices.
10+
11+
This source code creates a 1-Wire Net master that can be used to identify
12+
and communicate with slave devices. It provides all of the 1-Wire Net,
13+
and some of the transport and file level services to communicate with all
14+
of Dallas Semiconductor's 1-Wire devices including iButtons.
15+
16+
This source code is designed to be portable. There are provided 'TODO'
17+
templates to be completed for a specific platform. Several platform example
18+
implementations have been provided. There are also several example
19+
applications that use these platform implementations.
20+
21+
There are two sets of portable source files. The first set is general purpose
22+
and is intended for platforms that already have the primitive linklevel
23+
1-Wire Net communication functions. This is the lowest level that is hardware
24+
dependent.
25+
26+
The other set of portable source files assumes that the user has a serial port
27+
(RS232) and wishes to utilize our 'Universal Serial 1-Wire Line Driver Master
28+
chip' called the DS2480B. This chip receives commands over the serial port,
29+
performs 1-Wire Net operations and then sends the results back to the serial
30+
port. The source code converts the intended 1-Wire operations into serial
31+
communications packets to the DS2480B. The only thing that needs to be
32+
provided for a platform are the serial port read/write primitives.
33+
34+
These two sets of portable source code files implement the same 1-Wire Net
35+
functions and are interchangeable.
36+
37+
The files in the sub-directory '\lib\MICRO\' are written for example programs
38+
using assembly language.
39+
40+
It is best to not mix library files from one platform build with another.
41+
This could create an inefficient implementation.
42+
43+
44+
CONTENTS:
45+
46+
* lib (1-Wire Net library code sets)
47+
* userial - Code set based on Universial Serial chip (DS2480B)
48+
* general - Code set based on 1-Wire link-level functions
49+
* micro - Formerly in the TMEX kit, written for example programs
50+
using assembly language
51+
52+
* apps (application examples)
53+
* atodtst - finds and display the value for channels A,B,C,D on the
54+
DS2450 Quad A/D Converter
55+
* counter - reads the DS2423 counter value of the associated memory page
56+
* coupler - tests the DS2409 commands and searches for the DS2409 and the
57+
devices on the branch of the DS2409
58+
* fish - Read, write, format and display the file system on a 1-Wire
59+
memory device.
60+
* gethumd - Measures the humidity using the DS2438.
61+
* humalog - Sets up the DS1923 for mission or reads the current mission
62+
log. Also can set the passwords.
63+
* mweather - 1-Wire Weather Station example, supports versions of the
64+
Weather Station
65+
* memutil - Minimal 1-Wire application to list the devices present on
66+
the default 1-Wire Adapter/Port.
67+
* sa_ps - Uses a DS1991 for software authorization.
68+
* sa_sha - Uses the DS1961S or the DS1963S for software authorization.
69+
* sa_time - Uses the DS1994 for software authorization timeouts.
70+
* shaapp - 1-Wire application for using DS1961 functions.
71+
* shadebit - DS1963/DS1961 SHA iButton monetary demo. Initializes the
72+
the dedicated co-processor DS1963 and the user performs
73+
authenticated secure money debits using DS1963/DS1961.
74+
* swtloop - performs various operations on the Dual Addressable Switch
75+
* swtsngl - turns the DS2405 switch on & off and reads the on/off status
76+
* temp - finds and displays the temperature measurement for the
77+
DS1920/DS1820
78+
* thermo - DS1921 Thermochron download and mission example application
79+
* tstfind - loop to find all 1-Wire devices on Net
80+
81+
* examples (example implementations on platforms)
82+
* linux - Linux implementation using 'userial' code set
83+
* win32 - Windows 32-Bit implementation using 'userial' code set
84+
* tmexwrap - Windows 32-bit implementation using 'general' code set
85+
TMEX 32-bit as the 1-Wire link-level functions.
86+
* DS550 - Dallas Micro-controller code using the 'userial' and
87+
'general' code set.
88+
* wince - Windows CE implementation using 'userial' code set.
89+
* multiwvc - Windows 32-bit implementation using TMEX drivers to
90+
communicate to multiple ports. (COM, USB, Parallel)
91+
92+
* Documentation
93+
* ReadMe.txt - this file (Version 3.00, application descriptions,
94+
platforms used, information, kit history)
95+
* license.txt - 'public domain' source code license (based
96+
Consortium's/MIT license
97+
http://www.opensource.org/mit-license.html
98+
* OWPD300.txt - Notes to the user, device listing, application
99+
interface code
100+
* \apps\(application-name)\ReadMe.txt - documentation throughout the
101+
One Wire Domain kit with code explanation and
102+
location of other files that may be required
103+
for usage
104+
105+
INFORMATION:
106+
107+
The best source of information about 1-Wire
108+
devices
109+
including iButtons is Dallas Semiconductor's
110+
iButton web site at:
111+
http://www.ibutton.com/
112+
113+
This file has the latest download listings:
114+
ftp://ftp.dalsemi.com/pub/auto_id/softdev/softdev.html
115+
116+
Dallas Semiconductor/Maxim's main web site:
117+
http://www.maxim-ic.com/
118+
119+
Data sheets: http://dbserv.maxim-ic.com/pl_list.cfm?filter=1w
120+
121+
KIT HISTORY:
122+
1.01 -> 1.02 Support multiple DS1820 temperature devices in example.
123+
* Change MLANU(userial) section to implement
124+
opening and closing of communication port with
125+
generic functions.
126+
* Fix incorrect declarations of global variables
127+
in MLANU(userial).
128+
* Fix reading incorrect counter page in
129+
MWeather example.
130+
* Extended DSO of MLANU(userial) adapter.
131+
132+
1.02 -> 1.03 Reorganization of files/directories
133+
* Make applications not library dependent
134+
(userial/general)
135+
* Add Linux support
136+
137+
1.03 -> 2.00 Reorganization of files/directories
138+
* Addition of the Common directory
139+
* Additional support added to the Lib file
140+
for multiple ports
141+
* New applications and examples
142+
* New Weather Station example to both
143+
versions of the Weather Station
144+
* Change from MicroLAN (MLAN) to 1-Wire Net (OW)
145+
146+
2.00 -> 3.00 Reorganization of files/directories
147+
* Added error handling code
148+
* Added code for running applications on micros
149+
* Added modules to support memory IO for all current
150+
1-Wire memory devices.
151+
* Expanded the 1-Wire file I/O to implement all
152+
functions similar to the TMEX API.
153+
* Updated the 1-Wire Link Layer functions to match
154+
up with App Note 187 and App Note 192.
155+
* Added Software Authorization application examples
156+
along with Java iButton applications.
157+
* Added code to handle the DS1923, DS1922L/T, DS2422
158+
and DS1977 in memory bank applications
159+
* Created a DS1923, DS1922L/T and DS2422 application
160+
for starting missions and accessing the logged data.
161+
* Added a multiple adapter build that allows access
162+
to COM, USB or Parallel ports.
163+
* Added an owAcquireEx and OpenComEx for returning
164+
the port number instead of passing it to owAquire
165+
and OpenCOM. These new functions have replaced
166+
the old ones for this build.
167+
168+
3.00 -> 3.10 Reorganization of files/directories
169+
* Updated humutil.c with fixes and convert errors.
170+
* Added the addendum applications swtduo, swtmain1c and
171+
swtmulti
172+
* Changed the search CRC calculation to take into account
173+
for the changing DS28E04 serial number.

apps/atodtst/ReadMe.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Test application to read the DS2450
2+
1-Wire Quad A/D Converter.
3+
4+
Required on the command line is the 1-Wire port name:
5+
6+
example: "COM1" (Win32 DS2480B)
7+
"/dev/cua0" (Linux DS2480B)
8+
"1" (Win32 TMEX)
9+
"\\.\DS2490-1" (Win32 USB DS2490)
10+
"{1,5}" (Win32 DS2480B multi build)
11+
"{1,6}" (Win32 USB DS2490 multi build)
12+
"{1,2}" (Win32 DS1410E multi build)
13+
14+
This application uses the 1-Wire Public Domain API.
15+
Implementations of this API can be found in the '\lib' folder.
16+
The libraries are divided into three categories: 'general',
17+
'userial' and 'other'. Under each category are sample platform
18+
link files. The 'general' and 'userial' libraries have 'todo'
19+
templates for creating new platform specific implementations.
20+
21+
This application also uses utility and header files found
22+
in the '\common' folder.
23+
24+
25+
Application File(s): '\apps'
26+
atodtst.c - example application to find and display the
27+
value for channels A, B, C, D on the
28+
1-Wire Net DS2450 Quad A/D Converter
29+
30+
Common Module File(s): '\common'
31+
atod20.c - module(s) to set up, write, convert, and read
32+
the DS2450 Quad A/D Converter
33+
findtype.c - finds all of the devices of the same type
34+
(family code) on a 1-Wire Net
35+
ownet.h - include file for 1-Wire Net library
36+
crcutil.c - keeps track of the CRC for 8 and 16
37+
bit operations
38+
ioutil.c - I/O utility functions

apps/atodtst/atodtst.c

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
//---------------------------------------------------------------------------
2+
// Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved.
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a
5+
// copy of this software and associated documentation files (the "Software"),
6+
// to deal in the Software without restriction, including without limitation
7+
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8+
// and/or sell copies of the Software, and to permit persons to whom the
9+
// Software is furnished to do so, subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included
12+
// in all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17+
// IN NO EVENT SHALL DALLAS SEMICONDUCTOR BE LIABLE FOR ANY CLAIM, DAMAGES
18+
// OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19+
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20+
// OTHER DEALINGS IN THE SOFTWARE.
21+
//
22+
// Except as contained in this notice, the name of Dallas Semiconductor
23+
// shall not be used except as stated in the Dallas Semiconductor
24+
// Branding Policy.
25+
//---------------------------------------------------------------------------
26+
//---------------------------------------------------------------------------
27+
//
28+
// atodtst.c - Application for the DS2450 - 1-Wire Quad A/D Converter.
29+
//
30+
// This application uses the files from the 'Public Domain' MicroLAN
31+
// libraries ('general' and 'userial').
32+
//
33+
// Version: 2.00
34+
//
35+
36+
#include <stdio.h>
37+
#include <stdlib.h>
38+
#include "ownet.h"
39+
#include "atod20.h"
40+
#include "findtype.h"
41+
42+
// defines
43+
#define MAXDEVICES 20
44+
45+
// global serial numbers
46+
uchar FamilySN[MAXDEVICES][8];
47+
48+
//----------------------------------------------------------------------
49+
// Main Test for the DS2450 - 1-Wire Quad A/D Converter
50+
//
51+
int main(int argc, char **argv)
52+
{
53+
char msg[45];
54+
int NumDevices = 0;
55+
int i = 0;
56+
int start_address = 0x8;
57+
int end_address = 0x11;
58+
float prslt[4];
59+
uchar ctrl[16];
60+
int try_overdrive=0;
61+
int portnum=0;
62+
63+
//------------------------------------------------------
64+
// Introduction header
65+
printf("\n/---------------------------------------------\n");
66+
printf(" Channels A to D Application - V2.00\n"
67+
" The following is a test to excersize a\n"
68+
" DS2450 - 1-Wire Quad A/D Converter \n\n");
69+
70+
printf(" Press any CTRL-C to stop this program.\n\n");
71+
printf(" Output [Serial Number(s) ... Channel 'A' Value ... Channel 'B' Value ... \n"
72+
" ... Channel 'C' Value ... Channel 'D' Value] \n\n");
73+
74+
// check for required port name
75+
if (argc != 2)
76+
{
77+
printf("1-Wire Net name required on command line!\n"
78+
" (example: \"COM1\" (Win32 DS2480),\"/dev/cua0\" "
79+
"(Linux DS2480),\"{1,5}\" (Win32 TMEX)\n");
80+
exit(1);
81+
}
82+
83+
// attempt to acquire the 1-Wire Net
84+
if ((portnum = owAcquireEx(argv[1])) < 0)
85+
{
86+
OWERROR_DUMP(stdout);
87+
exit(1);
88+
}
89+
90+
// success
91+
printf("Port opened: %s\n",argv[1]);
92+
93+
// Find the device(s)
94+
NumDevices = FindDevices(portnum, &FamilySN[0], 0x20, MAXDEVICES);
95+
if (NumDevices>0)
96+
{
97+
printf("\n");
98+
printf("Device(s) Found: \n");
99+
100+
for (i = 0; i < NumDevices; i++)
101+
{
102+
103+
PrintSerialNum(FamilySN[i]);
104+
printf("\n");
105+
106+
if (SetupAtoDControl(portnum, FamilySN[i], &ctrl[0], &msg[0]))
107+
{
108+
printf("A/D settings found\n %s\n", msg);
109+
}
110+
else
111+
printf("\n\n\n ERROR, device set up unsuccessful!\n");
112+
113+
114+
if (WriteAtoD(portnum, try_overdrive, FamilySN[i], &ctrl[0], start_address, end_address))
115+
{
116+
printf("\nA/D settings written");
117+
118+
}
119+
else
120+
printf("\n\n\n ERROR, device not found!\n");
121+
}
122+
}
123+
124+
// (stops on CTRL-C)
125+
do
126+
{
127+
// read the current channels
128+
for (i = 0; i < NumDevices; i++)
129+
{
130+
printf("\n\n");
131+
PrintSerialNum(FamilySN[i]);
132+
133+
if (!DoAtoDConversion(portnum, try_overdrive, FamilySN[i]))
134+
{
135+
printf("\nError doing conversion, verify device present: %d\n",
136+
(int)owVerify(portnum,FALSE));
137+
}
138+
if (ReadAtoDResults(portnum, try_overdrive, FamilySN[i], &prslt[0], &ctrl[0]))
139+
{
140+
int c = 0;
141+
for (c = 0; c < 4; c++)
142+
{
143+
printf(" %1.3f ", prslt[c]);
144+
}
145+
}
146+
else
147+
{
148+
printf("\nError reading channel, verify device present: %d\n",
149+
(int)owVerify(portnum,FALSE));
150+
}
151+
152+
}
153+
}
154+
while (!key_abort());
155+
156+
// release the 1-Wire Net
157+
owRelease(portnum);
158+
printf("Closing port %s.\n", argv[1]);
159+
exit(0);
160+
161+
return 0;
162+
}
163+
164+
165+

0 commit comments

Comments
 (0)