Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
FPGA Configuration Space
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
FPGA Configuration Space
Commits
eaa16b31
Commit
eaa16b31
authored
Nov 24, 2011
by
Manohar Vanga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simulation: fix temperature readings of ds18b20 chip
Signed-off-by:
Manohar Vanga
<
manohar.vanga@cern.ch
>
parent
30a807fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
test1w.c
simulation/test/test1w.c
+2
-1
wb_onewire.c
simulation/wb_onewire.c
+3
-3
No files found.
simulation/test/test1w.c
View file @
eaa16b31
...
...
@@ -37,7 +37,8 @@ int main(int argc, char *argv[])
return
ret
;
}
printf
(
"Temp: %08x
\n
"
,
a
.
temp
/
16
.
0
);
printf
(
"Temp RAW: %08x
\n
"
,
a
.
temp
);
printf
(
"Temp: %08f
\n
"
,
a
.
temp
/
16
.
0
);
close
(
fd
);
return
0
;
...
...
simulation/wb_onewire.c
View file @
eaa16b31
...
...
@@ -135,7 +135,7 @@ void ds18b20_read_serial(struct wb_onewire_dev *dev, int port, uint8_t *sbuf)
wb_onewire_reset
(
dev
,
port
);
wb_onewire_writebyte
(
dev
,
port
,
0x33
);
sbuf
[
0
]
=
wb_onewire_readbyte
(
dev
,
port
);
for
(
i
=
6
;
i
>=
1
;
i
--
)
for
(
i
=
1
;
i
<=
6
;
i
++
)
sbuf
[
i
]
=
wb_onewire_readbyte
(
dev
,
port
);
sbuf
[
7
]
=
wb_onewire_readbyte
(
dev
,
port
);
}
...
...
@@ -158,7 +158,7 @@ int ds18b20_read_temp(struct wb_onewire_dev *dev, int port, uint8_t *serial)
int
temp
;
ds18b20_access
(
dev
,
port
,
serial
);
printk
(
"serial: "
);
for
(
i
=
0
;
i
<
8
;
i
++
)
for
(
i
=
7
;
i
>=
0
;
i
--
)
printk
(
"%02x "
,
serial
[
i
]);
printk
(
"
\n
"
);
wb_onewire_writebyte
(
dev
,
port
,
0x44
);
...
...
@@ -168,7 +168,7 @@ int ds18b20_read_temp(struct wb_onewire_dev *dev, int port, uint8_t *serial)
wb_onewire_writebyte
(
dev
,
port
,
0xbe
);
wb_onewire_readblock
(
dev
,
port
,
data
,
9
);
printk
(
"data: "
);
for
(
i
=
0
;
i
<
9
;
i
++
)
for
(
i
=
8
;
i
>=
0
;
i
--
)
printk
(
"%2x "
,
data
[
i
]);
printk
(
"
\n
"
);
temp
=
(
data
[
1
]
<<
8
)
|
data
[
0
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment