170
Libraries
© 2008 Conrad Electronic
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 To 9
' read whole scratchpad
scratch_pad(i)= OneWire_Read()
Msg_WriteHex(scratch_pad(i))
Next
Msg_WriteChar(13)
Text = "Temperature: "
Msg_WriteText(Text)
temp = scratch_pad(1) * 256 + scratch_pad(0)
Msg_WriteFloat(temp * 0.5)
Msg_WriteChar(99)
Msg_WriteChar(13)
Lab Ende
End Sub
6.14
Port
The Atmel Mega 32 provides 4 input/output ports at 8 bits each. The Atmel Mega 128 provides 6
input/output ports at 8 bits each and one input/output port at 5 bits. Each bit of the individual ports
can be configured as input or output. Since however the number of pins in the Mega 32 Risc CPU is
limited, additional functions are assigned to individual ports. A pin assignment table for
can be found in the documentation.
It is important to study the pin assignment prior to programming since important functions of the
program design (e. g. the USB Interface of the Application Board) are assigned to specific ports. If
these ports are programmed differently or the corresponding jumpers on the Application Board are no
longer set it may happen that the design interface is no longer able to transfer programs to the C-
Control Pro.
The direction of data flow (input/output) can be determined with function Port_DataDir or
Port_DataDirBit. If a pin is configured as input then this pin can either be operated high resistive
("floating") or with an internal pull-up resistor. If with
input then the pull-up resistor (Reference Level VCC) is activated and the input is defined.
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: ......