|
Issue
99, October 1998
Networking
with DeviceNetPart
2: A Weather Station Application
by
Jim Brady
Start
Can
Chips
Chip
Setup
Real Time
Message
Flow
Connections
Timers
Analog
Input Point
Identity
Object
Fragmented
Messages
Getting
Physical
Applying
DeviceNET
Software,Sources
ANALOG
INPUT POINT
The Analog Input Point in
the DeviceNet object library models an analog sensor.
Listing 2 shows some
code for this class.
The specification defines
eight attributes, many of which are optional. I implemented
the ones for sensor value, sensor status, and data type.
The data type tells the master whether the value is an
integer, float, or what. For the weather station, I use
an unsigned char that corresponds to a data type of 2.
My Analog Input Point class
implements the DeviceNet Get Attribute Single service
using a member function. Thus, the master can read any
of the three attributes using an Explicit message.
These attributes arent
settable, so my class doesnt have the Set Attribute
Single service. In the future, I may allow the master
to set the data type to a float, switching my sensor value
to floating point.
|