0 7 8 - 0 0 0 2 -02H®Neuron®C Programmer’s Guide
x The resp_receive( ) Function ... 139 Format of a Response...
88 Using Configuration Properties to Configure Device Behavior 4 If the configuration property type for the configur
Neuron C Programmer’s Guide 89 identify the association between the configuration property and the object or objects to which it applies. Dev
90 Using Configuration Properties to Configure Device Behavior A Neuron C program can have multiple device property l
Neuron C Programmer’s Guide 91 member that is shared between two or more network variables. The use of the static keyword creates a CP famil
92 Using Configuration Properties to Configure Device Behavior Since the same CP family could also be used as a devic
Neuron C Programmer’s Guide 93 network output SNVT_volt nvoVoltage[4]; Now, suppose that we want to provide a SCPTmaxSendTime configuration p
94 Using Configuration Properties to Configure Device Behavior scenario, where part of the configuration property net
Neuron C Programmer’s Guide 95 Initialization of Configuration Properties at Instantiation You can initialize a configuration property of fix
96 Using Configuration Properties to Configure Device Behavior network output SNVT_amp nvoB nv_properties { nciPwrU
Neuron C Programmer’s Guide 97 static cpMaxSendT // Shared among the array // elements only }; Although the discussion above concer
Neuron C Programmer’s Guide xi Chips without Off-Chip Memory ... 177 Memory Regions ...
98 Using Configuration Properties to Configure Device Behavior requirements of all individually listed FPT members (f
Neuron C Programmer’s Guide 99 functional profile is an example of a functional profile that lists the SCPTdefOutput configuration property a
100 Using Configuration Properties to Configure Device Behavior responsibility of the network tool to apply the forma
Neuron C Programmer’s Guide 101 5 Using Functional Blocks to Implement a Device Interface This chapter discusses the use of functional blo
102 Using Functional Blocks to Implement a Device Interface Overview The device interface for a LONWORKS device cons
Neuron C Programmer’s Guide 103 defined by the functional profile – these are called implementation-specific network variables and configurat
104 Using Functional Blocks to Implement a Device Interface and some required data structures that implement a functi
Neuron C Programmer’s Guide 105 Example: network output SNVT_amp nvoAmpere; fblock SFPTopenLoopSensor { nvoAmpere implements nvoValue; } f
106 Using Functional Blocks to Implement a Device Interface added per line. In this way, a functional block can cont
Neuron C Programmer’s Guide 107 to provide language-dependent names for your functional blocks. The external name is discussed in more detai
xii Appendix A. Neuron C Tools Stand-Alone Use...211 Stand-Alone Tools ...
108 Using Functional Blocks to Implement a Device Interface Shared Functional Block Properties Just as network variab
Neuron C Programmer’s Guide 109 fb_properties { cpGain, static cpUpdateRate, global cpBypassTime }; fblock SFPTopenLoopSensor { nv
110 Using Functional Blocks to Implement a Device Interface 1 Use the NodeBuilder Resource Editor to create a user f
Neuron C Programmer’s Guide 111 This expression uses the network variable’s member identifier, not the network variable’s unique name. Using
112 Using Functional Blocks to Implement a Device Interface // reference of CP family, not CP family member cpGain.m
Neuron C Programmer’s Guide 113 between the internal and external names of configuration properties, you should preserve some degree of simil
114 Using Functional Blocks to Implement a Device Interface Node Object implementation can then direct this request t
Neuron C Programmer’s Guide 115 fblock_director(nviRequest.object_id, nviRequest.object_request); } } Likewise, a single task can ha
116 Using Functional Blocks to Implement a Device Interface
Neuron C Programmer’s Guide 117 6 How Devices Communicate Using Application Messages This chapter describes the use of application message
Neuron C Programmer’s Guide 1 1 Overview This chapter introduces the Neuron C Version 2.2 programming language. It describes the basic asp
118 How Devices Communicate Using Application Messages Introduction to Application Messages Application messages are
Neuron C Programmer’s Guide 119 Layers of Neuron Software When you use network variables in a program, the actual building and sending of mes
120 How Devices Communicate Using Application Messages Application Messages You can explicitly create a message using
Neuron C Programmer’s Guide 121 and one incoming message (or response) at any one time. For example, you cannot build up two messages in par
122 How Devices Communicate Using Application Messages the message does not need to be authenticated. The default is
Neuron C Programmer’s Guide 123 It might not always be possible to determine rate_est and max_rate_est. For example, message output rates ar
124 How Devices Communicate Using Application Messages Type of Message Message Code Description Responder Offline
Neuron C Programmer’s Guide 125 Example block transfer of data: msg_tag motor; #define MOTOR_ON 0 typedef enum { MOTOR_FWD, MOTOR_REV
126 How Devices Communicate Using Application Messages void msg_cancel(void); This function cancels the message being
Neuron C Programmer’s Guide 127 { // Do nothing, just discard it } To prevent the incoming message queue from becoming blocked, a program
2 Overview What Is Neuron C? Neuron C Version 2 is a programming language based on ANSI C that is designed for Neuron Chips and Smart Transceivers.
128 How Devices Communicate Using Application Messages Important: Assigning values to the msg_out object can invalid
Neuron C Programmer’s Guide 129 If a message were to arrive and the application fail to process it, that message would remain at the head of
130 How Devices Communicate Using Application Messages #define OFF 0 #define ON 1 // I/O Declaration IO_4 input bit
Neuron C Programmer’s Guide 131 See Message Tags on page 122 for a more detailed discussion of the nonbind option. The use of explicit addres
132 How Devices Communicate Using Application Messages the event. See the Predefined Events chapter in the Neuron C
Neuron C Programmer’s Guide 133 Processing Completion Events for Messages When you send a message, you can optionally check the completion ev
134 How Devices Communicate Using Application Messages msg_send(); } when (msg_fails(TAG1)) { failures[0]++; }
Neuron C Programmer’s Guide 135 { // build a message // send the message } when (msg_completes) { msg_out.tag = t; // This seque
136 How Devices Communicate Using Application Messages The following example indicates one way asynchronous and direc
Neuron C Programmer’s Guide 137 Important: Because an Interoperable Self-Installation (ISI) network uses unbounded groups (group size 0), yo
Neuron C Programmer’s Guide 3 • fb_properties • nv_properties • device_properties • cp • cp_family You can still manually create the s
138 How Devices Communicate Using Application Messages Because the response is returned to the origin of the request,
Neuron C Programmer’s Guide 139 Its syntax is the following: resp_arrives [(msg-tag-name)] If a response arrives, this event evaluates to TRU
140 How Devices Communicate Using Application Messages To use this field, you must include the <addrdefs.h> a
Neuron C Programmer’s Guide 141 msg_send(); // send the message // wait for completion while (!msg_succeeds(motor)) { post_ev
142 How Devices Communicate Using Application Messages sends any repeated requests to the application and the applica
Neuron C Programmer’s Guide 143 • Two application input buffers See Chapter 8, Memory Management, on page 173, for a discussion of buffer
144 How Devices Communicate Using Application Messages task. However, you might want to free an application input bu
Neuron C Programmer’s Guide 145 7 Additional Features This chapter describes additional features in Neuron C. It describes the scheduler
146 Additional Features The Scheduler Chapter 2, Focusing on a Single Device, on page 15, introduced the basic functio
Neuron C Programmer’s Guide 147 RestartOrPower-UpInitializationReset TaskTop of Scheduling LoopTaskTwhen (offline)TaskTwhen (online)TaskTwhen
4 Overview Neuron C is designed to execute in the environment provided by the Neuron system firmware. This firmware provides an event-driven schedu
148 Additional Features Outgoing messages, network variable updates, and network variable polls use application output
Neuron C Programmer’s Guide 149 become TRUE. It is thus important that these when clauses be evaluated in their given order after a network
150 Additional Features Watchdog Timer For Series 3100 devices, the watchdog timer times out within a range of 0.21 se
Neuron C Programmer’s Guide 151 Additional Predefined Events The following three predefined special events result from network management mes
152 Additional Features // handle case of device going online if (online) { HandleOnline(); } } when (online)
Neuron C Programmer’s Guide 153 device, so events can be processed only through direct event processing. Neither network variable updates, n
154 Additional Features I/O Interrupts The Series 5000 hardware supports two independent I/O interrupts, each derived
Neuron C Programmer’s Guide 155 associated periodic system timer interrupt as needed; see Controlling Interrupts on page 159. One applicatio
156 Additional Features Table 10. I/O Interrupt Triggers Trigger Type Example Interrupt Specification Positive level
Neuron C Programmer’s Guide 157 • Infrared Input • Infrared Pattern Output • Oneshot Output • Ontime Input • Period Input • Pulsecount
Neuron C Programmer’s Guide 5 0x0 .. 0x7F signed short 0x80 .. 0xFF unsigned short 0x100 .. 0x7FFF signed long 0x8000 .. 0xFFFF unsig
158 Additional Features • Infrared input • Ontime input • Period input • Pulsecount input • Stretched triac outpu
Neuron C Programmer’s Guide 159 ... } interrupt(repeating, “3456.789Hz”) { ... } interrupt(repeating, ”625E3”) { // 625 kHz
160 Additional Features You can call the interrupt_control() function at any time to enable or disable one or more of
Neuron C Programmer’s Guide 161 Sharing Data with an Interrupt Task In general, an interrupt task can access any data that the main applicati
162 Additional Features Example: unsigned long globalVariable; void f() { __lock { globalVariable = ...;
Neuron C Programmer’s Guide 163 At the end of this preparation, the system firmware calls the interrupt dispatcher within the Neuron C applic
164 Additional Features Figure 15. Interrupt Latency As the figure shows, the first (in source-code declaration order
Neuron C Programmer’s Guide 165 out, and the device resets. To avoid the watchdog timer reset, use the #pragma deadlock_is_infinite compiler
166 Additional Features Flushing the Neuron Chip or Smart Transceiver You can use the flush( ) function to instruct th
Neuron C Programmer’s Guide 167 COMM_IGNORE Causes incoming messages to be ignored. PULLUPS_ON Enables all internal pullup resistors for S
6 Overview Neuron C Storage Classes If no class is specified and the declaration is at file scope, the data or function is global. File scope is th
168 Additional Features Forced Sleep You can force a device to sleep even though a flush operation is not complete. U
Neuron C Programmer’s Guide 169 • Log an error These actions can be combined. For example, you can log an error and then take the applicat
170 Additional Features Taking an Application Offline You can take a device offline using the go_offline( ) function.
Neuron C Programmer’s Guide 171 See the FT 5000 EVB Examples Guide or the NodeBuilder FX/PL Examples Guide for more examples of using the fbl
172 Additional Features Access to Device Status and Statistics From your application program, you can access the same
Neuron C Programmer’s Guide 173 8 Memory Management This chapter describes system memory resources, such as on-chip EEPROM, application bu
174 Memory Management Memory Use This section outlines the amount of memory used by certain elements in your program.
Neuron C Programmer’s Guide 175 • Each address table entry requires 5 bytes. A maximum of 15 address table entries are allowed. The minimu
176 Memory Management Using Neuron Chip Memory The following section describes two different situations, using Neuron
Neuron C Programmer’s Guide 177 Chips without Off-Chip Memory On-chip memory on the Neuron 3120 Chips and on the FT 3120 Smart Transceiver co
Neuron C Programmer’s Guide 7 uninit When combined with the eeprom keyword (see below), specifies that the EEPROM variable is not initialize
178 Memory Management Neuron firmware and can optionally (only on a Neuron 3150 Chip or FT 3150 Smart Transceiver) con
Neuron C Programmer’s Guide 179 • The ROM region has a system area and a user area (Neuron 3150 Chip and FT 3150 Smart Transceiver only). T
180 Memory Management compiler and linker to place specific objects in the offchip and onchip RAMFAR areas, respective
Neuron C Programmer’s Guide 181 Controlling Non-Default Memory Usage If you receive an error message at link time that part of your program d
182 Memory Management eeprom variables. Restarting a device or powering it up does not re-initialize the eeprom varia
Neuron C Programmer’s Guide 183 offchip Keyword (for Functions and Data Declarations) The Neuron linker typically places code, const data, an
184 Memory Management if the device is to be protected against a power cycle. See the Neuron 3150 Chip External Memor
Neuron C Programmer’s Guide 185 Use of Flash Memory for Series 3100 Chips For the Neuron 3150 Chip and the FT 3150 Smart Transceiver, Neuron
186 Memory Management Any direct write by the application to the flash memory causes a programming cycle, even if the
Neuron C Programmer’s Guide 187 The flash memory that is used for the EECODE data is erased once during the application load process. If pre
Echelon, LONWORKS, LONMARK, NodeBuilder, LonTalk, Neuron, 3120, 3150, ShortStack, LonMaker, and the Echelon logo are trademarks of Echelon Corporation
8 Overview Declaration Example Data types typedef unsigned long ULONG; Enumerations enum hue {RED, GREEN, BLUE}; Pointers char *p; Functions in
188 Memory Management provided to write by pointers which can (but are not required to) refer to EEPROM or flash memor
Neuron C Programmer’s Guide 189 By default, the address table contains 15 entries. Each address table entry uses five bytes of on-chip EEPRO
190 Memory Management The maximum number of aliases for applications developed with the Mini EVK Evaluation Kit or the
Neuron C Programmer’s Guide 191 ApplicationSchedulerNetworkMACHardwareSender Device (writer)ApplicationSchedulerNetworkMACHardwareReceiver De
192 Memory Management If explicit addressing is used, add an additional 11 bytes of system overhead. For application m
Neuron C Programmer’s Guide 193 • If your device is installed with unicast connections (that is, one device sends a network variable or mess
194 Memory Management buffers; the second directive specifies that the compiler should define exactly 114-byte buffers
Neuron C Programmer’s Guide 195 Sets the number of network buffers available for outgoing priority messages and network variables. Incoming N
196 Memory Management address, destination address, and priority attribute vector into an existing receive transaction
Neuron C Programmer’s Guide 197 Pragma Values Allowed Default (See Notes) app_buf_in_size (20, 21, 22, 24, 26, 30), 34, 42, 50, 66, 82, 114
Neuron C Programmer’s Guide 9 declared with the polled modifier), the new value of the network variable is propagated across the network to a
198 Memory Management If explicit addressing is used for network variables: C = max(34, 19 + sizeof(largest NV)) The a
Neuron C Programmer’s Guide 199 unsigned short int controlReg2; unsigned long int dataReg; } *PMemMapDev; const PMemMapDev pDevice =
200 Memory Management also included in the optionally produced link map file (if your Neuron C development tool suppor
Neuron C Programmer’s Guide 201 can consider removing the self-identification data. You can do this by specifying the following compiler dir
202 Memory Management Use Efficient Constant Values In the Neuron Chip and Smart Transceiver CPU architecture, constan
Neuron C Programmer’s Guide 203 The Neuron C utility functions include byte-manipulation functions, such as high_byte( ), low_byte( ), make_l
204 Memory Management In addition to the code size numbers, all sequences above, except the one for unsigned short, ma
Neuron C Programmer’s Guide 205 Use the Optional fastaccess Feature Array accesses (both loads and stores) in Neuron C normally use the rules
206 Memory Management void f(void) { int temp; temp = b * c * 4; d = (a * 2) + temp; e = a - temp; } A
Neuron C Programmer’s Guide 207 Use the Alternate Initialization Sequence Use of the #pragma disable_mult_module_init directive saves 2 or 3
10 Overview configuration data. Like network variables, configuration properties also provide a well-defined interface. Each configuration propert
208 Memory Management } else if (c == '3') { f3(); } else if (c == '4') { f4(); } else {
Neuron C Programmer’s Guide 209 For example, if a program has two input network variables, and has a single task executed when either variabl
210 Memory Management different set of system library functions might need to be linked into the application space (fr
Neuron C Programmer’s Guide 211 A Neuron C Tools Stand-Alone Use This appendix provides information on how to use the Neuron C tools as stan
212 Neuron C Tools Stand-Alone Use Stand-Alone Tools The Neuron C tools listed in Table 15 can be used stand-alone, m
Neuron C Programmer’s Guide 213 Usage: [optional command(s)] argument ... (Remaining output not listed here) Most command switches come in t
214 Neuron C Tools Stand-Alone Use --basename=23305 Most tools require additional arguments to be given; these argume
Neuron C Programmer’s Guide 215 Important: Specify the scriptfile script file in such a way that it does not overwrite the default script fi
216 Neuron C Tools Stand-Alone Use C:\>ncc –Imyincs -DOPTION1 myfile.nc This command (assuming the compilation doe
Neuron C Programmer’s Guide 217 EEPROM, respectively. The -Z switch is used to specify the last page of ROM (there is no corresponding switc
Neuron C Programmer’s Guide 11 of this feature in Chapter 3, How Devices Communicate Using Network Variables, on page 43, and also in the Neu
218 Neuron C Tools Stand-Alone Use The exporter command line contains a number of switches. Several switches must be
Neuron C Programmer’s Guide 219 Neuron Librarian The Neuron librarian is named nlib.exe. You can use the librarian to create and manage libr
220 Neuron C Tools Stand-Alone Use f8.no f9.no f10.no The librarian command line can contain more than one script fil
Neuron C Programmer’s Guide 221 B Neuron C Function Libraries This appendix discusses how to construct and use your own function and data li
222 Neuron C Function Libraries Definitions Application program A Neuron C source program that has been compiled, as
Neuron C Programmer’s Guide 223 The linker only looks at libraries when the object files being linked and combined with the system image file
224 Neuron C Function Libraries 2 The NodeBuilder project manager cannot be used to manage the dependencies of a lib
Neuron C Programmer’s Guide 225 Use these include files in the library source files that define these functions and data objects as well, s
226 Neuron C Function Libraries then placing the Neuron C code in the include file for the utility, the utility can e
Neuron C Programmer’s Guide 227 C Neuron C Custom System Images This appendix discusses how to build and use your own custom system images fo
12 Overview Neuron-Hosted and Host-Based Compilation Compilation for Neuron-hosted devices, that is, devices based on a Neuron Chip or Smart Transc
228 Neuron C Custom System Images Definitions Application program A Neuron C source program that has been compiled,
Neuron C Programmer’s Guide 229 BFT5000 - Firmware incorporated into a Neuron 5000 Processor or an FT 5000 Smart Transceiver. SYS3150
230 Neuron C Custom System Images consists of the following: image.nx Loadable image in Intel hex format image.nxb
Neuron C Programmer’s Guide 231 3 A custom system image can only contain pure C functions and data objects. It cannot contain Neuron C exte
232 Neuron C Custom System Images 1 Run the stand-alone Neuron linker as described in Appendix A. In addition to th
Neuron C Programmer’s Guide 233 file. The output files are directed (with the "-o" switch) to files named "myimage.*." n
234 Neuron C Custom System Images limit is cumulative, in other words, the two (or more) images cannot use more than
Neuron C Programmer’s Guide 235 As for the I/O operations on the display, assume that the display has a Neurowire device interface. The cust
Neuron C Programmer’s Guide 237 D Neuron C Language Implementation Characteristics This appendix discusses how the Neuron C language impleme
Neuron C Programmer’s Guide 13 Differences between Neuron C and ANSI C Neuron C adheres closely to the ANSI C language standard; however, Neu
238 Neuron C Language Implementation Characteristics Neuron C Language Implementation Characteristics The Internation
Neuron C Programmer’s Guide 239 Environment (J.3.2) Q: What are the semantics of the arguments to main? (Sec. 5.1.2.2.1) A: Neuron C plac
240 Neuron C Language Implementation Characteristics Characters (J.3.4) Q: What are the members of the source and ex
Neuron C Programmer’s Guide 241 Q: What are the number of bits in a character in the execution character set? What is the size of a wide ch
242 Neuron C Language Implementation Characteristics -128 .. 127 signed short 0 .. 255 unsigned s
Neuron C Programmer’s Guide 243 Hints (J.3.8) Q: What is the extent to which objects are actually placed in registers by use of the register
244 Neuron C Language Implementation Characteristics Qualifiers (J.3.10) Q: What constitutes an access to an object
Neuron C Programmer’s Guide 245 the directories specified in Include Directories of the NodeBuilder Device Templates Properties dialog and Pr
Neuron C Programmer’s Guide 247 Index # #elif, 14 #if, 14 #line, 14 / /* */ comment style, 14 // comment style, 14 @ @ (at-sign character), 2
14 Overview include file. Other ANSI C library functions, such as file I/O and storage allocation functions, are not included in Neuron C. Consult
248 Index size, 191 application output buffers freed by completion events, 148 components of, 191 counts, 192 effect
Neuron C Programmer’s Guide 249 conversion cast, 242 integer, 241 pointer, 242 cp keyword. See config_prop keyword cp_family keyword, 6, 85,
250 Index F far keyword, 7, 181, 182 fastaccess keyword, 205 fatal error diagnostic from compiler, 238 fblock keyword
Neuron C Programmer’s Guide 251 periodic, 154, 158 restrictions, 165 semaphore, 161 sharing data, 161 sources, 153 task, 155 timer/counter, 1
252 Index msg_send( ) function, 120, 125, 130, 144, 197 msg_succeeds event, 21, 131, 141, 148 comparison with resp_ar
Neuron C Programmer’s Guide 253 O object files, 222, 223 offchip keyword, 7, 179, 181, 183, 185 off-chip memory use of, 176 offline event, 18
254 Index comparison with msg_succeeds event, 141 resp_free( ) function, 144 resp_in object, 139 addr field, 198 defi
Neuron C Programmer’s Guide 255 domain. See domain table network variable configuration, 188 tag keyword, 121 tasks, 16, 18, 47 order of exec
www.echelon.com
Neuron C Programmer’s Guide 15 2 Focusing on a Single Device This chapter describes the Neuron C event scheduler and I/O objects. The conce
16 Focusing on a Single Device What Happens on a Single Device? In this chapter, you begin to learn about programming
Neuron C Programmer’s Guide 17 In this example above, when the led_timer application timer (definition not shown in this example) expires, th
Neuron C Programmer’s Guide iii Welcome This guide describes how to write programs using the Neuron® C Version 2.2 language. Neuron C is a pr
18 Focusing on a Single Device event This expression is either a predefined event (see the following section) or any
Neuron C Programmer’s Guide 19 Predefined Event Where Described in This Manual msg_arrives Chapter 6 msg_completes Chapter 6 msg_fails Chapt
20 Focusing on a Single Device io_changes). These operators are of equal precedence with each other, but they are mu
Neuron C Programmer’s Guide 21 msg_succeeds msg_fails resp_arrives Most network events, except resp_arrives, are enqueued only if the Neuron
22 Focusing on a Single Device User-Defined Events A user-defined event can contain assignments and function calls.
Neuron C Programmer’s Guide 23 Letter names shown above are used for the clauses in Figure 1 and the following narration of events. This sho
24 Focusing on a Single Device when clause selected evaluates to FALSE, its task is ignored and the scheduler resumes
Neuron C Programmer’s Guide 25 void f() { /* body */ } g (a,b) int a; int b; { /* body */ } Although Neuron C can create prototypes, it do
26 Focusing on a Single Device initial-value An optional initial value to be loaded into the timer on power-up or re
Neuron C Programmer’s Guide 27 } If your program has multiple timers, you must include a specific check for each timer so that the expiration
iv Related Documentation The following manuals are available from the Echelon Web site (www.echelon.com) and provide additional information that can h
28 Focusing on a Single Device objects can also be linked to Neuron C events, because changes in I/O often affect tas
Neuron C Programmer’s Guide 29 magtrack1 serial wiegand Serial Input/Output Model Types i2c neurowire sci spi • Parallel I/O Models a
30 Focusing on a Single Device options Optional I/O parameters, dependent on the chosen type for the I/O object. Th
Neuron C Programmer’s Guide 31 Example 1: Thermostat Interface This thermostat measures the resistance of a thermistor by measuring the puls
32 Focusing on a Single Device // Uses a thermistor to measure temperature, and a // quadrature encoder to enter setp
Neuron C Programmer’s Guide 33 desiredTemp = max(DESIRED_TEMP_MIN, desiredTemp); } //////////////////////////////////////////////////////
34 Focusing on a Single Device value through the built-in variable input_value. Dimmer SwitchZero-CrossingDetector11
Neuron C Programmer’s Guide 35 // since a lower value means more light. currentBrightness -= input_value; // Look for underflow
36 Focusing on a Single Device Neuron ChipIO_8IO_9IO_2+5VC4.01F470R103 Digit LED DisplayMulti-CharacterLED Display Dr
Neuron C Programmer’s Guide 37 • Triac pulse timer. Timer used to generate pulses for the stretchedtriac and triac output objects. The fol
Neuron C Programmer’s Guide v Table 1. Typographic Conventions Typeface or Symbol Used for Example boldface type keywords literal characters
38 Focusing on a Single Device Series 3100 device with a 10 MHz clock, the expected duration of a millisecond timer i
Neuron C Programmer’s Guide 39 treats as 820 microsecond ticks. This means that a timer duration is actually 0.999 times the specified durat
40 Focusing on a Single Device Time started here.H1E1L1H2E2L2E1Timer expires in this range.Second iteration of timer
Neuron C Programmer’s Guide 41 count A value between 1 and 33,333. See the Neuron C Reference Guide for the formula used in determining the
Neuron C Programmer’s Guide 43 3 How Devices Communicate Using Network Variables This chapter discusses how LONWORKS devices communicate wit
44 How Devices Communicate Using Network Variables Major Topics LONWORKS devices communicate with other LONWORKS devi
Neuron C Programmer’s Guide 45 • Changeable-Type Network Variables on page 68 describes how to implement network variables that allow their t
46 How Devices Communicate Using Network Variables Figure 6. Sample Development Network with Five Devices The declar
Neuron C Programmer’s Guide 47 Note: This discussion uses the terms writer device and reader device. A writer device is a device that write
48 How Devices Communicate Using Network Variables After the device design is complete, you specify connections betwe
Neuron C Programmer’s Guide 49 network input SNVT_temp nviTemp; network output SNVT_switch nvoHeater; network output int nvoCurrentTemp; Exam
50 How Devices Communicate Using Network Variables Figure 7. A Simple Closed-Loop System Use of the is_bound( ) Func
Neuron C Programmer’s Guide 51 Network Variable Events Chapter 2, Focusing on a Single Device, on page 15, introduced the event scheduling me
52 How Devices Communicate Using Network Variables io_out(ioLED, nviLampState.state); } In the following example, wh
Neuron C Programmer’s Guide 53 heater_failed = FALSE; // heater device received update } The nv_update_completes Event The nv_up
54 How Devices Communicate Using Network Variables Declaring Synchronous Network Variables To declare a synchronous n
Neuron C Programmer’s Guide 55 Preemption Mode The scheduler enters preemption mode when a synchronous output network variable update occurs
56 How Devices Communicate Using Network Variables 2 Check for the failure and the success events (nv_update_fails
Neuron C Programmer’s Guide 57 The reader device makes its request through the poll( ) function. The syntax is shown below: poll ([network-v
Neuron C Programmer’s Guide vii Table of Contents Welcome...
58 How Devices Communicate Using Network Variables mtimer tDelayedPolling; /////////////////////////// Tasks ///////
Neuron C Programmer’s Guide 59 Example: A lamp and switch example could also be written to use explicit polling of the switch network variabl
60 How Devices Communicate Using Network Variables IO_4 input bit ioButton = BUTTON_UP; ///////////////////////////
Neuron C Programmer’s Guide 61 Example: network output SNVT_temp nvoTemp; when (timer_expires(heartbeat)) { propagate(nvoTemp); } The pro
62 How Devices Communicate Using Network Variables Initial Value Updates for Input Network Variables Many application
Neuron C Programmer’s Guide 63 Example: network input SNVT_temp nviCurrent; network input SNVT_temp nviSetpoint; network output SNVT_volt
64 How Devices Communicate Using Network Variables poll(nviSetpoint); } when(nv_update_occurs(nviSetpoint)) when(n
Neuron C Programmer’s Guide 65 Monitoring Network Variables A monitoring device is a LONWORKS device that receives data from many other devic
66 How Devices Communicate Using Network Variables Following is an example for the code on a network monitor device:
Neuron C Programmer’s Guide 67 Declaring Authenticated Variables and Messages For network variables, include the authenticated (or auth) keyw
viii Fixed Timers ... 36 Scaled Timers and I/O Objects ...
68 How Devices Communicate Using Network Variables 4 Device B compares its computed transformation with the number i
Neuron C Programmer’s Guide 69 You can use a changeable-type network variable to implement a generic functional block that works with differe
70 How Devices Communicate Using Network Variables configuration property access through LW-FTP and check, in the sto
Neuron C Programmer’s Guide 71 property automatically assumes the size and type of the network variable it applies to, and is governed by the
72 How Devices Communicate Using Network Variables Validating a Type Change There are several ways that your applicat
Neuron C Programmer’s Guide 73 If one or more type-inheriting configuration properties apply to changing configuration network variables (CPN
74 How Devices Communicate Using Network Variables Your application must always support the NVT_CAT_INITIAL type cate
Neuron C Programmer’s Guide 75 The get_nv_length_override( ) function returns the current length of the network variable with the index speci
76 How Devices Communicate Using Network Variables of the framework provided by NodeBuilder Code Wizard. Your applic
Neuron C Programmer’s Guide 77 // and allow for its use even if the target device doesn't support // system extensions. See text for de
Neuron C Programmer’s Guide ix Instantiation of Configuration Properties ... 88 Device Propert
78 How Devices Communicate Using Network Variables #endif // For all inheriting configuration properties tha
Neuron C Programmer’s Guide 79 // returns the current length of the given NV (in bytes) or 0xFF to // indicate that the initial type is still
80 How Devices Communicate Using Network Variables // TODO: If needed by the application algorithm, transform
Neuron C Programmer’s Guide 81 // for details. nvoVolt = nvLocal.xInitial; } // bConversionOK } // SetCurrent()
Neuron C Programmer’s Guide 83 4 Using Configuration Properties to Configure Device Behavior This chapter discusses the declaration and
84 Using Configuration Properties to Configure Device Behavior Overview A configuration property is a data item that,
Neuron C Programmer’s Guide 85 configuration file, and no events are automatically generated when a configuration property implemented within
86 Using Configuration Properties to Configure Device Behavior configuration property, or with the entire configurati
Neuron C Programmer’s Guide 87 in the standard.typ file, which is part of the standard resource file set included with the NodeBuilder tool.
Komentarze do niniejszej Instrukcji