![background image](http://html.mh-extra.com/html/conrad/c-control-pro-mega-series/c-control-pro-mega-series_manual_2654183178.webp)
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
Summary of Contents for C-Control Pro Mega Series
Page 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Page 9: ...VIII Inhalt 2008 Conrad Electronic ...
Page 10: ...Part 1 ...
Page 17: ...Part 2 ...
Page 23: ...Part 3 ...
Page 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Page 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Page 58: ...Part 4 ...
Page 91: ...82 IDE 2008 Conrad Electronic ...
Page 92: ...Part 5 ...
Page 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Page 136: ...Part 6 ...
Page 231: ...Part 7 ...
Page 240: ......