169
C-Control Pro Mega Series
© 2008 Conrad Electronic
if(ret ==
0
)
{
text=
"no device found"
;
Msg_WriteText(text);
goto end;
}
OneWire_Write(
0xcc
);
// skip ROM cmd
OneWire_Write(
0x44
);
// start temperature measure cmd
AbsDelay(
3000
);
OneWire_Reset(
7
);
// PortA.7
OneWire_Write(
0xcc
);
// skip ROM cmd
OneWire_Write(
0xbe
);
// read scratch_pad cmd
for(i=
0
;i<
9
;i++)
// read whole scratchpad
{
scratch_pad[i]= OneWire_Read();
Msg_WriteHex(scratch_pad[i]);
}
Msg_WriteChar(
'\r'
);
text=
"Temperature: "
;
Msg_WriteText(text);
temp= scratch_pad[
1
]*
256
+ scratch_pad[
0
];
Msg_WriteFloat(temp*
0
.
5
);
Msg_WriteChar(
'C'
);
Msg_WriteChar(
'\r'
);
end:
}
BASIC
' Sample Code to read DS18S20 temperature sensor from Dallas Maxim
Dim Text(40) As Char
Dim ret,i As Integer
Dim temp As Integer
Dim rom_code(8) As Byte
Dim scratch_pad(9) As Byte
Sub main()
ret = OneWire_Reset(7)
' PortA.7
If ret = 0 Then
Text= "no device found"
Msg_WriteText(Text)
GoTo Ende
End If
Содержание C-Control Pro Mega Series
Страница 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Страница 9: ...VIII Inhalt 2008 Conrad Electronic ...
Страница 10: ...Part 1 ...
Страница 17: ...Part 2 ...
Страница 23: ...Part 3 ...
Страница 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Страница 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Страница 58: ...Part 4 ...
Страница 91: ...82 IDE 2008 Conrad Electronic ...
Страница 92: ...Part 5 ...
Страница 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Страница 136: ...Part 6 ...
Страница 231: ...Part 7 ...
Страница 240: ......