Echelon Neuron C Instrukcja Użytkownika Strona 1

Przeglądaj online lub pobierz Instrukcja Użytkownika dla Oprogramowanie Echelon Neuron C. Echelon Neuron C User Manual Instrukcja obsługi

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 268
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów

Podsumowanie treści

Strona 1 - C Programmer’s Guide

0 7 8 - 0 0 0 2 -02H®Neuron®C Programmer’s Guide

Strona 2

x The resp_receive( ) Function ... 139 Format of a Response...

Strona 3 - Audience

88 Using Configuration Properties to Configure Device Behavior 4 If the configuration property type for the configur

Strona 4 - Related Documentation

Neuron C Programmer’s Guide 89 identify the association between the configuration property and the object or objects to which it applies. Dev

Strona 5

90 Using Configuration Properties to Configure Device Behavior A Neuron C program can have multiple device property l

Strona 6

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

Strona 7 - Table of Contents

92 Using Configuration Properties to Configure Device Behavior Since the same CP family could also be used as a devic

Strona 8

Neuron C Programmer’s Guide 93 network output SNVT_volt nvoVoltage[4]; Now, suppose that we want to provide a SCPTmaxSendTime configuration p

Strona 9

94 Using Configuration Properties to Configure Device Behavior scenario, where part of the configuration property net

Strona 10

Neuron C Programmer’s Guide 95 Initialization of Configuration Properties at Instantiation You can initialize a configuration property of fix

Strona 11

96 Using Configuration Properties to Configure Device Behavior network output SNVT_amp nvoB nv_properties { nciPwrU

Strona 12

Neuron C Programmer’s Guide 97 static cpMaxSendT // Shared among the array // elements only }; Although the discussion above concer

Strona 13

Neuron C Programmer’s Guide xi Chips without Off-Chip Memory ... 177 Memory Regions ...

Strona 14 - What Is Neuron C?

98 Using Configuration Properties to Configure Device Behavior requirements of all individually listed FPT members (f

Strona 15 - Unique Aspects of Neuron C

Neuron C Programmer’s Guide 99 functional profile is an example of a functional profile that lists the SCPTdefOutput configuration property a

Strona 16 - Neuron C Integer Constants

100 Using Configuration Properties to Configure Device Behavior responsibility of the network tool to apply the forma

Strona 17 - Neuron C Variable Types

Neuron C Programmer’s Guide 101 5 Using Functional Blocks to Implement a Device Interface This chapter discusses the use of functional blo

Strona 18 - Neuron C Storage Classes

102 Using Functional Blocks to Implement a Device Interface Overview The device interface for a LONWORKS device cons

Strona 19 - Neuron C Declarations

Neuron C Programmer’s Guide 103 defined by the functional profile – these are called implementation-specific network variables and configurat

Strona 20

104 Using Functional Blocks to Implement a Device Interface and some required data structures that implement a functi

Strona 21 - Configuration Properties

Neuron C Programmer’s Guide 105 Example: network output SNVT_amp nvoAmpere; fblock SFPTopenLoopSensor { nvoAmpere implements nvoValue; } f

Strona 22

106 Using Functional Blocks to Implement a Device Interface added per line. In this way, a functional block can cont

Strona 23 - I/O Devices

Neuron C Programmer’s Guide 107 to provide language-dependent names for your functional blocks. The external name is discussed in more detai

Strona 24

xii Appendix A. Neuron C Tools Stand-Alone Use...211 Stand-Alone Tools ...

Strona 25 - Functions

108 Using Functional Blocks to Implement a Device Interface Shared Functional Block Properties Just as network variab

Strona 26

Neuron C Programmer’s Guide 109 fb_properties { cpGain, static cpUpdateRate, global cpBypassTime }; fblock SFPTopenLoopSensor { nv

Strona 27 - Focusing on a Single Device

110 Using Functional Blocks to Implement a Device Interface 1 Use the NodeBuilder Resource Editor to create a user f

Strona 28 - When Clauses

Neuron C Programmer’s Guide 111 This expression uses the network variable’s member identifier, not the network variable’s unique name. Using

Strona 29 - When Statement

112 Using Functional Blocks to Implement a Device Interface // reference of CP family, not CP family member cpGain.m

Strona 30 - Predefined Events

Neuron C Programmer’s Guide 113 between the internal and external names of configuration properties, you should preserve some degree of simil

Strona 31

114 Using Functional Blocks to Implement a Device Interface Node Object implementation can then direct this request t

Strona 32 - Event Processing

Neuron C Programmer’s Guide 115 fblock_director(nviRequest.object_id, nviRequest.object_request); } } Likewise, a single task can ha

Strona 33 - Reset Event

116 Using Functional Blocks to Implement a Device Interface

Strona 34 - Scheduling of When Clauses

Neuron C Programmer’s Guide 117 6 How Devices Communicate Using Application Messages This chapter describes the use of application message

Strona 35 - Priority When Clauses

Neuron C Programmer’s Guide 1 1 Overview This chapter introduces the Neuron C Version 2.2 programming language. It describes the basic asp

Strona 36 - Function Prototypes

118 How Devices Communicate Using Application Messages Introduction to Application Messages Application messages are

Strona 37 - Declaring Timers

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

Strona 38 - The timer_expires Event

120 How Devices Communicate Using Application Messages Application Messages You can explicitly create a message using

Strona 39 - Input/Output

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

Strona 40 - I/O Object Types

122 How Devices Communicate Using Application Messages the message does not need to be authenticated. The default is

Strona 41

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

Strona 42 - Device Self-Documentation

124 How Devices Communicate Using Application Messages Type of Message Message Code Description Responder Offline

Strona 43

Neuron C Programmer’s Guide 125 Example block transfer of data: msg_tag motor; #define MOTOR_ON 0 typedef enum { MOTOR_FWD, MOTOR_REV

Strona 44

126 How Devices Communicate Using Application Messages void msg_cancel(void); This function cancels the message being

Strona 45

Neuron C Programmer’s Guide 127 { // Do nothing, just discard it } To prevent the incoming message queue from becoming blocked, a program

Strona 46 - Dimmer Switch

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.

Strona 47

128 How Devices Communicate Using Application Messages Important: Assigning values to the msg_out object can invalid

Strona 48 - Fixed Timers

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

Strona 49 - With a 10 MHz Input Clock

130 How Devices Communicate Using Application Messages #define OFF 0 #define ON 1 // I/O Declaration IO_4 input bit

Strona 50 - With Other Clock Speeds

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

Strona 51 - Repeating Timers

132 How Devices Communicate Using Application Messages the event. See the Predefined Events chapter in the Neuron C

Strona 52 - Delay Functions

Neuron C Programmer’s Guide 133 Processing Completion Events for Messages When you send a message, you can optionally check the completion ev

Strona 53 - EEPROM Write Timer

134 How Devices Communicate Using Application Messages msg_send(); } when (msg_fails(TAG1)) { failures[0]++; }

Strona 54

Neuron C Programmer’s Guide 135 { // build a message // send the message } when (msg_completes) { msg_out.tag = t; // This seque

Strona 55 - Network Variables

136 How Devices Communicate Using Application Messages The following example indicates one way asynchronous and direc

Strona 56 - Major Topics

Neuron C Programmer’s Guide 137 Important: Because an Interoperable Self-Installation (ISI) network uses unbounded groups (group size 0), yo

Strona 57

Neuron C Programmer’s Guide 3 • fb_properties • nv_properties • device_properties • cp • cp_family You can still manually create the s

Strona 58

138 How Devices Communicate Using Application Messages Because the response is returned to the origin of the request,

Strona 59 - Declaring Network Variables

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

Strona 60

140 How Devices Communicate Using Application Messages To use this field, you must include the <addrdefs.h> a

Strona 61 - Connecting Network Variables

Neuron C Programmer’s Guide 141 msg_send(); // send the message // wait for completion while (!msg_succeeds(motor)) { post_ev

Strona 62

142 How Devices Communicate Using Application Messages sends any repeated requests to the application and the applica

Strona 63 - The nv_update_occurs Event

Neuron C Programmer’s Guide 143 • Two application input buffers See Chapter 8, Memory Management, on page 173, for a discussion of buffer

Strona 64 - Neuron C Reference

144 How Devices Communicate Using Application Messages task. However, you might want to free an application input bu

Strona 65 - Preemption Mode

Neuron C Programmer’s Guide 145 7 Additional Features This chapter describes additional features in Neuron C. It describes the scheduler

Strona 66

146 Additional Features The Scheduler Chapter 2, Focusing on a Single Device, on page 15, introduced the basic functio

Strona 67 - Variables

Neuron C Programmer’s Guide 147 RestartOrPower-UpInitializationReset TaskTop of Scheduling LoopTaskTwhen (offline)TaskTwhen (online)TaskTwhen

Strona 68 - Polling Network Variables

4 Overview Neuron C is designed to execute in the environment provided by the Neuron system firmware. This firmware provides an event-driven schedu

Strona 69

148 Additional Features Outgoing messages, network variable updates, and network variable polls use application output

Strona 70

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

Strona 71

150 Additional Features Watchdog Timer For Series 3100 devices, the watchdog timer times out within a range of 0.21 se

Strona 72

Neuron C Programmer’s Guide 151 Additional Predefined Events The following three predefined special events result from network management mes

Strona 73

152 Additional Features // handle case of device going online if (online) { HandleOnline(); } } when (online)

Strona 74

Neuron C Programmer’s Guide 153 device, so events can be processed only through direct event processing. Neither network variable updates, n

Strona 75

154 Additional Features I/O Interrupts The Series 5000 hardware supports two independent I/O interrupts, each derived

Strona 76

Neuron C Programmer’s Guide 155 associated periodic system timer interrupt as needed; see Controlling Interrupts on page 159. One applicatio

Strona 77 - Monitoring Network Variables

156 Additional Features Table 10. I/O Interrupt Triggers Trigger Type Example Interrupt Specification Positive level

Strona 78 - Authentication

Neuron C Programmer’s Guide 157 • Infrared Input • Infrared Pattern Output • Oneshot Output • Ontime Input • Period Input • Pulsecount

Strona 79 - How Authentication Works

Neuron C Programmer’s Guide 5 0x0 .. 0x7F signed short 0x80 .. 0xFF unsigned short 0x100 .. 0x7FFF signed long 0x8000 .. 0xFFFF unsig

Strona 80

158 Additional Features • Infrared input • Ontime input • Period input • Pulsecount input • Stretched triac outpu

Strona 81

Neuron C Programmer’s Guide 159 ... } interrupt(repeating, “3456.789Hz”) { ... } interrupt(repeating, ”625E3”) { // 625 kHz

Strona 82

160 Additional Features You can call the interrupt_control() function at any time to enable or disable one or more of

Strona 83

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

Strona 84 - Validating a Type Change

162 Additional Features Example: unsigned long globalVariable; void f() { __lock { globalVariable = ...;

Strona 85 - Processing a Type Change

Neuron C Programmer’s Guide 163 At the end of this preparation, the system firmware calls the interrupt dispatcher within the Neuron C applic

Strona 86 - Processing a Size Change

164 Additional Features Figure 15. Interrupt Latency As the figure shows, the first (in source-code declaration order

Strona 87 - Changeable-Type Example

Neuron C Programmer’s Guide 165 out, and the device resets. To avoid the watchdog timer reset, use the #pragma deadlock_is_infinite compiler

Strona 88

166 Additional Features Flushing the Neuron Chip or Smart Transceiver You can use the flush( ) function to instruct th

Strona 89

Neuron C Programmer’s Guide 167 COMM_IGNORE Causes incoming messages to be ignored. PULLUPS_ON Enables all internal pullup resistors for S

Strona 90

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

Strona 91

168 Additional Features Forced Sleep You can force a device to sleep even though a flush operation is not complete. U

Strona 92

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

Strona 93 - } // SetCurrent()

170 Additional Features Taking an Application Offline You can take a device offline using the go_offline( ) function.

Strona 94

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

Strona 95 - Configure Device Behavior

172 Additional Features Access to Device Status and Statistics From your application program, you can access the same

Strona 96

Neuron C Programmer’s Guide 173 8 Memory Management This chapter describes system memory resources, such as on-chip EEPROM, application bu

Strona 97 - ONWORKS file transfer

174 Memory Management Memory Use This section outlines the amount of memory used by certain elements in your program.

Strona 98

Neuron C Programmer’s Guide 175 • Each address table entry requires 5 bytes. A maximum of 15 address table entries are allowed. The minimu

Strona 99

176 Memory Management Using Neuron Chip Memory The following section describes two different situations, using Neuron

Strona 100

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

Strona 101 - Device Property Lists

Neuron C Programmer’s Guide 7 uninit When combined with the eeprom keyword (see below), specifies that the EEPROM variable is not initialize

Strona 102 - Neuron C Reference Guide

178 Memory Management Neuron firmware and can optionally (only on a Neuron 3150 Chip or FT 3150 Smart Transceiver) con

Strona 103

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

Strona 104 - Properties

180 Memory Management compiler and linker to place specific objects in the offchip and onchip RAMFAR areas, respective

Strona 105

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

Strona 106

182 Memory Management eeprom variables. Restarting a device or powering it up does not re-initialize the eeprom varia

Strona 107 - Instantiation

Neuron C Programmer’s Guide 183 offchip Keyword (for Functions and Data Declarations) The Neuron linker typically places code, const data, an

Strona 108

184 Memory Management if the device is to be protected against a power cycle. See the Neuron 3150 Chip External Memor

Strona 109

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

Strona 110

186 Memory Management Any direct write by the application to the flash memory causes a programming cycle, even if the

Strona 111

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

Strona 112

Echelon, LONWORKS, LONMARK, NodeBuilder, LonTalk, Neuron, 3120, 3150, ShortStack, LonMaker, and the Echelon logo are trademarks of Echelon Corporation

Strona 113 - Implement a Device Interface

8 Overview Declaration Example Data types typedef unsigned long ULONG; Enumerations enum hue {RED, GREEN, BLUE}; Pointers char *p; Functions in

Strona 114 - Overview

188 Memory Management provided to write by pointers which can (but are not required to) refer to EEPROM or flash memor

Strona 115 - Resources

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

Strona 116

190 Memory Management The maximum number of aliases for applications developed with the Mini EVK Evaluation Kit or the

Strona 117

Neuron C Programmer’s Guide 191 ApplicationSchedulerNetworkMACHardwareSender Device (writer)ApplicationSchedulerNetworkMACHardwareReceiver De

Strona 118 - The Director Function

192 Memory Management If explicit addressing is used, add an additional 11 bytes of system overhead. For application m

Strona 119

Neuron C Programmer’s Guide 193 • If your device is installed with unicast connections (that is, one device sends a network variable or mess

Strona 120

194 Memory Management buffers; the second directive specifies that the compiler should define exactly 114-byte buffers

Strona 121 - Scope Rules

Neuron C Programmer’s Guide 195 Sets the number of network buffers available for outgoing priority messages and network variables. Incoming N

Strona 122

196 Memory Management address, destination address, and priority attribute vector into an existing receive transaction

Strona 123

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

Strona 124

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

Strona 125

198 Memory Management If explicit addressing is used for network variables: C = max(34, 19 + sizeof(largest NV)) The a

Strona 126

Neuron C Programmer’s Guide 199 unsigned short int controlReg2; unsigned long int dataReg; } *PMemMapDev; const PMemMapDev pDevice =

Strona 127 - Behavior

200 Memory Management also included in the optionally produced link map file (if your Neuron C development tool suppor

Strona 128

Neuron C Programmer’s Guide 201 can consider removing the self-identification data. You can do this by specifying the following compiler dir

Strona 129 - Application Messages

202 Memory Management Use Efficient Constant Values In the Neuron Chip and Smart Transceiver CPU architecture, constan

Strona 130 - ONWORKS

Neuron C Programmer’s Guide 203 The Neuron C utility functions include byte-manipulation functions, such as high_byte( ), low_byte( ), make_l

Strona 131 - Layers of Neuron Software

204 Memory Management In addition to the code size numbers, all sequences above, except the one for unsigned short, ma

Strona 132 - Constructing a Message

Neuron C Programmer’s Guide 205 Use the Optional fastaccess Feature Array accesses (both loads and stores) in Neuron C normally use the rules

Strona 133 - Management

206 Memory Management void f(void) { int temp; temp = b * c * 4; d = (a * 2) + temp; e = a - temp; } A

Strona 134

Neuron C Programmer’s Guide 207 Use the Alternate Initialization Sequence Use of the #pragma disable_mult_module_init directive saves 2 or 3

Strona 135

10 Overview configuration data. Like network variables, configuration properties also provide a well-defined interface. Each configuration propert

Strona 136 - Block Transfers of Data

208 Memory Management } else if (c == '3') { f3(); } else if (c == '4') { f4(); } else {

Strona 137 - Sending a Message

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

Strona 138 - The msg_arrives Event

210 Memory Management different set of system library functions might need to be linked into the application space (fr

Strona 139 - The msg_receive( ) Function

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

Strona 140

212 Neuron C Tools Stand-Alone Use Stand-Alone Tools The Neuron C tools listed in Table 15 can be used stand-alone, m

Strona 141 - Switch Program

Neuron C Programmer’s Guide 213 Usage: [optional command(s)] argument ... (Remaining output not listed here) Most command switches come in t

Strona 142 - Explicit Addressing

214 Neuron C Tools Stand-Alone Use --basename=23305 Most tools require additional arguments to be given; these argume

Strona 143 - Message Completion Events

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

Strona 144

216 Neuron C Tools Stand-Alone Use C:\>ncc –Imyincs -DOPTION1 myfile.nc This command (assuming the compilation doe

Strona 145 - Messages

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

Strona 146 - Preemption Mode and Messages

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

Strona 147

218 Neuron C Tools Stand-Alone Use The exporter command line contains a number of switches. Several switches must be

Strona 148

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

Strona 149 - Constructing a Response

220 Neuron C Tools Stand-Alone Use f8.no f9.no f10.no The librarian command line can contain more than one script fil

Strona 150 - The resp_arrives Event

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

Strona 151 - Format of a Response

222 Neuron C Function Libraries Definitions Application program A Neuron C source program that has been compiled, as

Strona 152 - Request/Response Examples

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

Strona 153

224 Neuron C Function Libraries 2 The NodeBuilder project manager cannot be used to manage the dependencies of a lib

Strona 154 - Application Buffers

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

Strona 155 - Reference Guide

226 Neuron C Function Libraries then placing the Neuron C code in the include file for the utility, the utility can e

Strona 156

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

Strona 157 - Additional Features

12 Overview Neuron-Hosted and Host-Based Compilation Compilation for Neuron-hosted devices, that is, devices based on a Neuron Chip or Smart Transc

Strona 158 - Scheduler Reset Mechanism

228 Neuron C Custom System Images Definitions Application program A Neuron C source program that has been compiled,

Strona 159 - Interrupts

Neuron C Programmer’s Guide 229 BFT5000 - Firmware incorporated into a Neuron 5000 Processor or an FT 5000 Smart Transceiver. SYS3150

Strona 160 - Scheduler Example

230 Neuron C Custom System Images consists of the following: image.nx Loadable image in Intel hex format image.nxb

Strona 161 - The post_events( ) Function

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

Strona 162 - Watchdog Timer

232 Neuron C Custom System Images 1 Run the stand-alone Neuron linker as described in Appendix A. In addition to th

Strona 163 - Additional Predefined Events

Neuron C Programmer’s Guide 233 file. The output files are directed (with the "-o" switch) to files named "myimage.*." n

Strona 164 - Wink Event

234 Neuron C Custom System Images limit is cumulative, in other words, the two (or more) images cannot use more than

Strona 165 - Interrupt Sources

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

Strona 167 - Defining an Interrupt Task

Neuron C Programmer’s Guide 237 D Neuron C Language Implementation Characteristics This appendix discusses how the Neuron C language impleme

Strona 168

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

Strona 169

238 Neuron C Language Implementation Characteristics Neuron C Language Implementation Characteristics The Internation

Strona 170

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

Strona 171 - )]',255min(,0max[ Zn =

240 Neuron C Language Implementation Characteristics Characters (J.3.4) Q: What are the members of the source and ex

Strona 172

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

Strona 173

242 Neuron C Language Implementation Characteristics -128 .. 127 signed short 0 .. 255 unsigned s

Strona 174 - Interrupt Latency

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

Strona 175

244 Neuron C Language Implementation Characteristics Qualifiers (J.3.10) Q: What constitutes an access to an object

Strona 176 - Debugging Interrupt Tasks

Neuron C Programmer’s Guide 245 the directories specified in Include Directories of the NodeBuilder Device Templates Properties dialog and Pr

Strona 178 - Putting the Device to Sleep

Neuron C Programmer’s Guide 247 Index # #elif, 14 #if, 14 #line, 14 / /* */ comment style, 14 // comment style, 14 @ @ (at-sign character), 2

Strona 179 - Forced Sleep

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

Strona 180 - Error Handling

248 Index size, 191 application output buffers freed by completion events, 148 components of, 191 counts, 192 effect

Strona 181 - Restarting the Application

Neuron C Programmer’s Guide 249 conversion cast, 242 integer, 241 pointer, 242 cp keyword. See config_prop keyword cp_family keyword, 6, 85,

Strona 182 - Disabling a Functional Block

250 Index F far keyword, 7, 181, 182 fastaccess keyword, 205 fatal error diagnostic from compiler, 238 fblock keyword

Strona 183 - System Errors

Neuron C Programmer’s Guide 251 periodic, 154, 158 restrictions, 165 semaphore, 161 sharing data, 161 sources, 153 task, 155 timer/counter, 1

Strona 184

252 Index msg_send( ) function, 120, 125, 130, 144, 197 msg_succeeds event, 21, 131, 141, 148 comparison with resp_ar

Strona 185

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

Strona 186 - EEPROM Use

254 Index comparison with msg_succeeds event, 141 resp_free( ) function, 144 resp_in object, 139 addr field, 198 defi

Strona 187

Neuron C Programmer’s Guide 255 domain. See domain table network variable configuration, 188 tag keyword, 121 tasks, 16, 18, 47 order of exec

Strona 189 - Memory Regions

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

Strona 190 - Memory Areas

16 Focusing on a Single Device What Happens on a Single Device? In this chapter, you begin to learn about programming

Strona 191

Neuron C Programmer’s Guide 17 In this example above, when the led_timer application timer (definition not shown in this example) expires, th

Strona 192 - Default Memory Usage

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

Strona 193 - Declarations)

18 Focusing on a Single Device event This expression is either a predefined event (see the following section) or any

Strona 194

Neuron C Programmer’s Guide 19 Predefined Event Where Described in This Manual msg_arrives Chapter 6 msg_completes Chapter 6 msg_fails Chapt

Strona 195

20 Focusing on a Single Device io_changes). These operators are of equal precedence with each other, but they are mu

Strona 196 - Use of Flash Memory

Neuron C Programmer’s Guide 21 msg_succeeds msg_fails resp_arrives Most network events, except resp_arrives, are enqueued only if the Neuron

Strona 197

22 Focusing on a Single Device User-Defined Events A user-defined event can contain assignments and function calls.

Strona 198

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

Strona 199

24 Focusing on a Single Device when clause selected evaluates to FALSE, its task is ignored and the scheduler resumes

Strona 200 - Address Table

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

Strona 201 - Alias Table

26 Focusing on a Single Device initial-value An optional initial value to be loaded into the timer on power-up or re

Strona 202 - Allocating Buffers

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

Strona 203 - Buffer Size

iv Related Documentation The following manuals are available from the Echelon Web site (www.echelon.com) and provide additional information that can h

Strona 204 - Buffer Counts

28 Focusing on a Single Device objects can also be linked to Neuron C events, because changes in I/O often affect tas

Strona 205

Neuron C Programmer’s Guide 29 magtrack1 serial wiegand Serial Input/Output Model Types i2c neurowire sci spi • Parallel I/O Models a

Strona 206 - Outgoing Network Buffers

30 Focusing on a Single Device options Optional I/O parameters, dependent on the chosen type for the I/O object. Th

Strona 207 - Incoming Application Buffers

Neuron C Programmer’s Guide 31 Example 1: Thermostat Interface This thermostat measures the resistance of a thermistor by measuring the puls

Strona 208 - (20, 21, 22, 24, 26, 30, 34

32 Focusing on a Single Device // Uses a thermistor to measure temperature, and a // quadrature encoder to enter setp

Strona 209 - (20, 21, 22, 24, 26, 30)

Neuron C Programmer’s Guide 33 desiredTemp = max(DESIRED_TEMP_MIN, desiredTemp); } //////////////////////////////////////////////////////

Strona 210

34 Focusing on a Single Device value through the built-in variable input_value. Dimmer SwitchZero-CrossingDetector11

Strona 211 - Neuron Chip

Neuron C Programmer’s Guide 35 // since a lower value means more light. currentBrightness -= input_value; // Look for underflow

Strona 212 - Template File

36 Focusing on a Single Device Neuron ChipIO_8IO_9IO_2+5VC4.01F470R103 Digit LED DisplayMulti-CharacterLED Display Dr

Strona 213

Neuron C Programmer’s Guide 37 • Triac pulse timer. Timer used to generate pulses for the stretchedtriac and triac output objects. The fol

Strona 214 - Initialization Actions

Neuron C Programmer’s Guide v Table 1. Typographic Conventions Typeface or Symbol Used for Example boldface type keywords literal characters

Strona 215 - Be Aware of Library Usage

38 Focusing on a Single Device Series 3100 device with a 10 MHz clock, the expected duration of a millisecond timer i

Strona 216 - Observe Declaration Order

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

Strona 217

40 Focusing on a Single Device Time started here.H1E1L1H2E2L2E1Timer expires in this range.Second iteration of timer

Strona 218 - Use Function Calls Liberally

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

Strona 220

Neuron C Programmer’s Guide 43 3 How Devices Communicate Using Network Variables This chapter discusses how LONWORKS devices communicate wit

Strona 221 - Using the Link Map

44 How Devices Communicate Using Network Variables Major Topics LONWORKS devices communicate with other LONWORKS devi

Strona 222

Neuron C Programmer’s Guide 45 • Changeable-Type Network Variables on page 68 describes how to implement network variables that allow their t

Strona 223

46 How Devices Communicate Using Network Variables Figure 6. Sample Development Network with Five Devices The declar

Strona 224 - Common Syntax

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

Strona 226 - Common Set of Basic Commands

48 How Devices Communicate Using Network Variables After the device design is complete, you specify connections betwe

Strona 227 - Neuron C Compiler

Neuron C Programmer’s Guide 49 network input SNVT_temp nviTemp; network output SNVT_switch nvoHeater; network output int nvoCurrentTemp; Exam

Strona 228 - Neuron Linker

50 How Devices Communicate Using Network Variables Figure 7. A Simple Closed-Loop System Use of the is_bound( ) Func

Strona 229 - Neuron Exporter

Neuron C Programmer’s Guide 51 Network Variable Events Chapter 2, Focusing on a Single Device, on page 15, introduced the event scheduling me

Strona 230

52 How Devices Communicate Using Network Variables io_out(ioLED, nviLampState.state); } In the following example, wh

Strona 231 - Neuron Librarian

Neuron C Programmer’s Guide 53 heater_failed = FALSE; // heater device received update } The nv_update_completes Event The nv_up

Strona 232 - Neuron C Function Libraries

54 How Devices Communicate Using Network Variables Declaring Synchronous Network Variables To declare a synchronous n

Strona 233

Neuron C Programmer’s Guide 55 Preemption Mode The scheduler enters preemption mode when a synchronous output network variable update occurs

Strona 234 - Definitions

56 How Devices Communicate Using Network Variables 2 Check for the failure and the success events (nv_update_fails

Strona 235 - Disadvantages of a Library

Neuron C Programmer’s Guide 57 The reader device makes its request through the poll( ) function. The syntax is shown below: poll ([network-v

Strona 236

Neuron C Programmer’s Guide vii Table of Contents Welcome...

Strona 237

58 How Devices Communicate Using Network Variables mtimer tDelayedPolling; /////////////////////////// Tasks ///////

Strona 238

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

Strona 239

60 How Devices Communicate Using Network Variables IO_4 input bit ioButton = BUTTON_UP; ///////////////////////////

Strona 240

Neuron C Programmer’s Guide 61 Example: network output SNVT_temp nvoTemp; when (timer_expires(heartbeat)) { propagate(nvoTemp); } The pro

Strona 241

62 How Devices Communicate Using Network Variables Initial Value Updates for Input Network Variables Many application

Strona 242

Neuron C Programmer’s Guide 63 Example: network input SNVT_temp nviCurrent; network input SNVT_temp nviSetpoint; network output SNVT_volt

Strona 243

64 How Devices Communicate Using Network Variables poll(nviSetpoint); } when(nv_update_occurs(nviSetpoint)) when(n

Strona 244

Neuron C Programmer’s Guide 65 Monitoring Network Variables A monitoring device is a LONWORKS device that receives data from many other devic

Strona 245

66 How Devices Communicate Using Network Variables Following is an example for the code on a network monitor device:

Strona 246 - Providing a Large RAM Space

Neuron C Programmer’s Guide 67 Declaring Authenticated Variables and Messages For network variables, include the authenticated (or auth) keyw

Strona 247

viii Fixed Timers ... 36 Scaled Timers and I/O Objects ...

Strona 248

68 How Devices Communicate Using Network Variables 4 Device B compares its computed transformation with the number i

Strona 249 - Neuron C Language

Neuron C Programmer’s Guide 69 You can use a changeable-type network variable to implement a generic functional block that works with differe

Strona 250 - Translation (J.3.1)

70 How Devices Communicate Using Network Variables configuration property access through LW-FTP and check, in the sto

Strona 251 - Identifiers (J.3.3)

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

Strona 252 - Characters (J.3.4)

72 How Devices Communicate Using Network Variables Validating a Type Change There are several ways that your applicat

Strona 253 - Integers (J.3.5)

Neuron C Programmer’s Guide 73 If one or more type-inheriting configuration properties apply to changing configuration network variables (CPN

Strona 254 - Standard)

74 How Devices Communicate Using Network Variables Your application must always support the NVT_CAT_INITIAL type cate

Strona 255 - (J.3.9)

Neuron C Programmer’s Guide 75 The get_nv_length_override( ) function returns the current length of the network variable with the index speci

Strona 256 - Qualifiers (J.3.10)

76 How Devices Communicate Using Network Variables of the framework provided by NodeBuilder Code Wizard. Your applic

Strona 257 - Library Functions (J.3.12)

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

Strona 258

Neuron C Programmer’s Guide ix Instantiation of Configuration Properties ... 88 Device Propert

Strona 259

78 How Devices Communicate Using Network Variables #endif // For all inheriting configuration properties tha

Strona 260 - 248 Index

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

Strona 261

80 How Devices Communicate Using Network Variables // TODO: If needed by the application algorithm, transform

Strona 262 - 250 Index

Neuron C Programmer’s Guide 81 // for details. nvoVolt = nvLocal.xInitial; } // bConversionOK } // SetCurrent()

Strona 264 - 252 Index

Neuron C Programmer’s Guide 83 4 Using Configuration Properties to Configure Device Behavior This chapter discusses the declaration and

Strona 265

84 Using Configuration Properties to Configure Device Behavior Overview A configuration property is a data item that,

Strona 266 - 254 Index

Neuron C Programmer’s Guide 85 configuration file, and no events are automatically generated when a configuration property implemented within

Strona 267

86 Using Configuration Properties to Configure Device Behavior configuration property, or with the entire configurati

Strona 268

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

Brak uwag