Instructions
301 C-Control Pro IDE
© 2013 Conrad Electronic
End If
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
5.18 Port
Atmel Mega
The Atmel Mega 32 provides 4 input/output ports at 8 bits each. The Atmel Mega 128 provides 6 in-
put/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 lim-
ited, additional functions are assigned to individual ports. A pin assignment table for M32 and M128
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 Port_Write or Port_WriteBit a "1" is written to an