Echelon Neuron C Bedienungsanleitung

Stöbern Sie online oder laden Sie Bedienungsanleitung nach Software Echelon Neuron C herunter. Echelon Neuron C User Manual Benutzerhandbuch

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 267
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen

Inhaltsverzeichnis

Seite 1 - C Reference Guide

0 7 8 - 0 1 4 0 -02F®Neuron®C Reference Guide

Seite 2

x delay( ) Function... 78 Syntax ...

Seite 3 - Related Documentation

80 Functions Example #pragma relaxed_casting_on eeprom far unsigned int widget[100]; far unsigned int ram_buf[100];

Seite 4 - ONWORKS Platform

Neuron C Reference Guide 81 associated with the functional block specified, passes the cmd parameter on to that director function, and return

Seite 5

82 Functions void fl_neg (const float_type *arg1, float_type *arg2); void fl_rand (float_type *arg1); void fl_round (

Seite 6

Neuron C Reference Guide 83 when (flush_completes) { // Go to sleep nothing_to_do = FALSE; sleep(); } flush_cancel( ) Function The

Seite 7 - Table of Contents

84 Functions when (...) { msg_out.tag = TAG1; msg_out.code = 3; msg_send(); flush_wait(); nvoVoltag

Seite 8

Neuron C Reference Guide 85 get_fblock_count( ) Built-in Function The get_fblock_count( ) built-in function is a compiler special function

Seite 9

86 Functions Example void f(void) { unsigned int start, delta; start = get_tick_count(); ... delta = get_tick

Seite 10

Neuron C Reference Guide 87 go_unconfigured( ) Function The go_unconfigured( ) function puts the device into an unconfigured state. It als

Seite 11

88 Functions provided by Series 5000 devices, and is only available to an application that defines at least one inter

Seite 12

Neuron C Reference Guide 89 io_change_init( ) Built-in Function The io_change_init( ) built-in function initializes the I/O object for the

Seite 13

Neuron C Reference Guide xi Syntax ... 90 Example

Seite 14

90 Functions value A value between 1 and 65535 defining the maximum value for each period measurement. Example IO_4

Seite 15

Neuron C Reference Guide 91 For Series 5000 devices, the io_idis( ) function disables all application interrupts. This function does not aff

Seite 16

92 Functions dualslope input unsigned long edgelog input unsigned short i2c unsigned short infrared input unsigne

Seite 17

Neuron C Reference Guide 93 io_in (input-obj); The type of the return-value of the io_in( ) call is listed in the table above. bitshift For b

Seite 18

94 Functions The io_in( ) call has an unsigned short return-value that is the actual number of bits read. magcard For

Seite 19 - Neuron C Overview

Neuron C Reference Guide 95 The io_in( ) call has an unsigned short return-value signifying the number of bits actually transferred for a neu

Seite 20 - Neuron C Programmer’s

96 Functions Example IO_0 input bit d0; boolean value; ... void f(void) { value = io_in(d0); } io_in_request( ) B

Seite 21 - Predefined Events

Neuron C Reference Guide 97 io_out( ) Built-in Function The io_out( ) built-in function writes data to an I/O object. The <io_types.h>

Seite 22 - Bypass Mode

98 Functions output-io-object-name Specifies the I/O object name, which corresponds to io-object-name in the I/O dec

Seite 23 - Event Directory

Neuron C Reference Guide 99 model in the I/O Model Reference for a detailed explanation of this restriction. muxbus For muxbus I/O objects, t

Seite 24

xii Syntax ... 108 Example ...

Seite 25

100 Functions touch For touch I/O objects, the syntax is: io_out (touch-io-obj, buf, count); buf A (void *) pointer t

Seite 26

Neuron C Reference Guide 101 io_preserve_input( ) Built-in Function The io_preserve_input( ) built-in function is used with an input timer/

Seite 27

102 Functions infrared ontime period pulsecount totalcount clock-value Specifies an optional clock value, in the r

Seite 28

Neuron C Reference Guide 103 { io_set_baud(iosci, SCI_38400); // Optional baud change } io_set_clock( ) Built-in Function The io_set_clo

Seite 29

104 Functions cannot specify TCCLK_40MHz or TCCLK_20MHz – no error is issued, but the effective value used in this ca

Seite 30

Neuron C Reference Guide 105 Example IO_0 output bit b0; IO_0 input byte byte0; int read_byte; void f(void) { io_set_direction(b0, IO_DIR_O

Seite 31 - Variable

106 Functions } when (...) { io_out(ioTriac, 0); // full off } is_bound( ) Built-in Function The is_bound(

Seite 32 - Variables

Neuron C Reference Guide 107 low_byte( ) Built-in Function The low_byte( ) built-in function extracts the lower single-byte value from the

Seite 33

108 Functions Table 30. Result Types for the max() Function Larger Type Smaller Type Result unsigned long (any) un

Seite 34 - network-var2

Neuron C Reference Guide 109 Example #include <mem.h> unsigned array1[40]; void f(void) { // Copy up to 40 bytes to array1, // b

Seite 35

Neuron C Reference Guide xiii nv_table_index( ) Built-in Function ... 118 Syntax ...

Seite 36

110 Functions Syntax #include <mem.h> int memcmp (void *buf1, const void *buf2, unsigned long len); Example #in

Seite 37

Neuron C Reference Guide 111 Syntax void memset (void *p, int c, unsigned long len); Example unsigned target[20]; void f(void) { memset(ta

Seite 38

112 Functions when (io_changes(io_push_button)) { msec_delay(10); // Delay 10ms at any clock rate debounced_bu

Seite 39 - Compiler Directives

Neuron C Reference Guide 113 } } msg_cancel( ) Built-in Function The msg_cancel( ) built-in function cancels the message currently being b

Seite 40 - Pragma Directives

114 Functions } ... } msg_receive( ) Built-in Function The msg_receive( ) built-in function receives a message i

Seite 41

Neuron C Reference Guide 115 Example msg_tag motor; # define MOTOR_ON 0 # define ON_FULL 1 when (io_changes(switch1)to ON) { // Send a mes

Seite 42

116 Functions always use muldiv24() without loss of precision, compared to muldiv(), if neither A nor B ever exceeds

Seite 43 - I/O Model Reference

Neuron C Reference Guide 117 muldivs( ) Function The muldivs( ) function permits the computation of (A*B)/C where A, B, and C are all 16-bi

Seite 44 - Memory Management

118 Functions { application_restart(); } nv_table_index( ) Built-in Function The nv_table_index( ) built-in fun

Seite 45

Neuron C Reference Guide 119 ... if (offline){ // Perform offline cleanup ... offline_confirm(); } } poll( ) Built-in Function T

Seite 46

xiv Syntax ... 129 Example ...

Seite 47

120 Functions when (nv_update_occurs(nviZone)) { // New value of nviZone arrived } post_events( ) Function The

Seite 48 - User’s Guide

Neuron C Reference Guide 121 if (power_up()) initialize_hardware(); else { // hardware already initialized ... }

Seite 49

122 Functions device interface (XIF) file. Thus, network tools can handle the network address assignment for the var

Seite 50

Neuron C Reference Guide 123 Example void f(void) { unsigned value; ... value = random(); } resp_alloc( ) Built-in Function The resp_al

Seite 51

124 Functions if (offline()) { // Requested to go offline resp_cancel(); } else { r

Seite 52

Neuron C Reference Guide 125 Example void f(void) { ... if (resp_receive()) { // Process message ... resp_free();

Seite 53

126 Functions unsigned long status_rcv_transaction_full; unsigned long status_lost_msgs; unsigned long st

Seite 54

Neuron C Reference Guide 127 status_version_number The version number, which reflects the Neuron firmware version. status_error_log The most

Seite 55

128 Functions value = reverse(value); // now value is 0xC7 } rotate_long_left( ) Function The rotate_long_left(

Seite 56

Neuron C Reference Guide 129 // k now contains 0x87E0 } rotate_short_left( ) Function The rotate_short_left( ) function returns the bit-

Seite 57 - Other Directives

Neuron C Reference Guide xv Example ... 140 strncmp( )

Seite 58

130 Functions } scaled_delay( ) Function The scaled_delay( ) function generates a delay that scales with the input

Seite 59

Neuron C Reference Guide 131 void f(void) { io_out(software_one_shot, 1); //turn it on scaled_delay(4); //approx. 108 µsec at 1

Seite 60

132 Functions } } service_pin_msg_send( ) Function The service_pin_msg_send( ) function attempts to send a servic

Seite 61 - Execution Control

Neuron C Reference Guide 133 when (timer_expires(three_sec_timer)) { if (service_pin_state()) { // Service pin still depressed // g

Seite 62 - Network Configuration

134 Functions The function enables or disables the lock (with a TRUE or FALSE argument, respectively). The EEPROM l

Seite 63 - Integer Math

Neuron C Reference Guide 135 void s32_ge (const s32_type *arg1, const s32_type *arg2); void s32_gt (const s32_type *arg1, const s32_type *arg

Seite 64

136 Functions void sleep (unsigned int flags , io-object-name); void sleep (unsigned int flags , io-pin); flags One

Seite 65

Neuron C Reference Guide 137 spi_get_error( ) Function The spi_get_error( ) built-in function returns a cumulative OR of the bits shown bel

Seite 66 - Floating-Point Math

138 Functions strchr( ) Function The strchr( ) function searches the string s for the first occurrence of the chara

Seite 67

Neuron C Reference Guide 139 { int val; char s1[20], s2[20]; val = strcmp(s1, s2); if (!val) { // Strings are equal } else if (

Seite 68 - Utilities

xvi Syntax ... 152 Example ...

Seite 69

140 Functions Syntax #include <string.h> unsigned long strlen (const char *s); Example #include <string.h>

Seite 70 - Input/Output

Neuron C Reference Guide 141 When a mismatch occurs, the characters from both strings at the mismatch are compared. If the first string’s ch

Seite 71

142 Functions Example #include <string.h> char s[20]; void f(char *p) { strncpy(s, p, 19); // Prevent over

Seite 72 - Integer

Neuron C Reference Guide 143 Example long k; void f(void) { k = 0x1234L; k = swap_bytes(k); // k now contains 0x3412L } timers_off( )

Seite 73 - Binary Arithmetic Operators

144 Functions touch_byte( ) Built-in Function The touch_byte( ) function sequentially writes and reads eight bits o

Seite 74 - Unary Arithmetic Operators

Neuron C Reference Guide 145 ... dataOut = 42; touch_byte_spu(1WIREPIN, dataOut); } touch_first( ) Built-in Function The touch_first( )

Seite 75 - Comparison Operators

146 Functions touch_next( ) Built-in Function The touch_next( ) function executes the ROM Search algorithm as descr

Seite 76 - Integer Conversions

Neuron C Reference Guide 147 touch_read_spu( ) Built-in Function This function applies to 1-Wire bus devices that require the bus to be act

Seite 77 - Signed 32-Bit Performance

148 Functions The touch_reset( ) function does not return until the end of the presence pulse has been detected. Synt

Seite 78

Neuron C Reference Guide 149 { ... int rc; rc = touch_reset_spu(1WIREPIN); } touch_write_spu( ) Built-in Function This function app

Seite 79

Neuron C Reference Guide xvii cp_template_file_len Variable ... 193 fblock_index_map

Seite 80

150 Functions that are all similar, a bit array can be more code-efficient than a series of bitfields because the arr

Seite 81

Neuron C Reference Guide 151 void f(void) { address_copy = *access_address( addr_table_index(my_mt)); // Modify the address_copy her

Seite 82

152 Functions domain/subnet/node address on the network. Typically, cloned devices are intended for low-end systems

Seite 83

Neuron C Reference Guide 153 See the ISO/IEC 14908 (ANSI/EIA/CEA-709.1) Control Network Specification for a description of the data structure

Seite 84

154 Functions } update_nv( ) Function The update_nv( ) function copies from the structure referenced by the nv-entr

Seite 85 - String

Neuron C Reference Guide 155 Syntax #include <access.h> void update_program_id (unsigned char * pid_p); Example #include <access.h&g

Seite 87 - Floating-Point Performance

Neuron C Reference Guide 157 4 Timer Declarations This chapter provides reference information for declaring and using Neuron C timers. N

Seite 88

158 Timer Declarations Timer Object A timer object is declared using one of the following: mtimer [repeating] timer-n

Seite 89 - Function Directory

Neuron C Reference Guide 159 5 Network Variable, Configuration Property, and Message Tag Declarations This chapter describes the network v

Seite 91

160 Network Variable, Configuration Property, and Message Tag Declarations Introduction The external application inte

Seite 92

Neuron C Reference Guide 161 Network Variable Declarations Syntax The complete syntax for declaring a network variable is one of the followin

Seite 93

162 Network Variable, Configuration Property, and Message Tag Declarations sd_string ( concatenated-string-constant )

Seite 94

Neuron C Reference Guide 163 connections can still cause changes to such a configuration network variable. eeprom The network variable is pl

Seite 95

164 Network Variable, Configuration Property, and Message Tag Declarations [signed] long [int] unsigned long [int] s

Seite 96 -  xxx

Neuron C Reference Guide 165 property-reference-list : property-reference-list , property-reference property-reference property-reference : p

Seite 97

166 Network Variable, Configuration Property, and Message Tag Declarations page 171. A range-modification string pro

Seite 98

Neuron C Reference Guide 167 network output SNVT_lev_percent nvoValue[4] nv_properties { static cpMaxSendT // MUST be shared }; Network Va

Seite 99

168 Network Variable, Configuration Property, and Message Tag Declarations ackd (the default) — acknowledged servi

Seite 100 - Example

Neuron C Reference Guide 169 priority | nonpriority [( config | nonconfig )] Specifies whether a network variable update has priority acces

Seite 101

Neuron C Reference Guide xix Neuron C Overview Neuron C is a programming language based on ANSI C that is designed for Neuron Chips and Smart

Seite 102

170 Network Variable, Configuration Property, and Message Tag Declarations Configuration Property Declarations You c

Seite 103

Neuron C Reference Guide 171 the NodeBuilder tool. There could be many similar resource files containing UCPT definitions, and these are man

Seite 104

172 Network Variable, Configuration Property, and Message Tag Declarations cp-option-list : cp-option-list , cp-optio

Seite 105

Neuron C Reference Guide 173 point numbers delimited by a colon. The first number is the lower limit and the second number is the high limit

Seite 106

174 Network Variable, Configuration Property, and Message Tag Declarations device_properties { property-reference-lis

Seite 107

Neuron C Reference Guide 175 page 171. A range-modification string provided in the instantiation of a CP family member overrides any range-m

Seite 108

176 Network Variable, Configuration Property, and Message Tag Declarations }; void f(void) { ... if (nvoValue::cp

Seite 109

Neuron C Reference Guide 177 A message tag declaration can optionally include connection information. The syntax for declaring a message tag

Seite 111

Neuron C Reference Guide 179 6 Functional Block Declarations This chapter provides reference information for functional block declarations

Seite 112 - General

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

Seite 113

xx Predefined Events whereas the messaging service is not standardized with the exception of its usage by the LONWORKS file transfer protocol (LW-FT

Seite 114

180 Functional Block Declarations Introduction The external application interface of a LONWORKS device consists of it

Seite 115

Neuron C Reference Guide 181 ext-name : external_name ( C-string-const ) external_resource_name ( C-string-const ) external_resource_nam

Seite 116 - Example 2

182 Functional Block Declarations A Neuron C program can also implement additional network variables in the functiona

Seite 117

Neuron C Reference Guide 183 the external_name string described above. In this case, the device interface information contains a scope and i

Seite 118

184 Functional Block Declarations The functional block property list begins with the fb_properties keyword. It then

Seite 119

Neuron C Reference Guide 185 fb_properties { cpOffset, // offset for each fblock static cpGain, // gain shared in MyFb1 glob

Seite 120

186 Functional Block Declarations the program. The array entry is an unsigned short. Its declaration, in the <ec

Seite 121

Neuron C Reference Guide 187 Just like for network variable properties, even though a configuration network variable can be uniquely accessed

Seite 123

Neuron C Reference Guide 189 7 Built-In Variables, Objects, Symbols, and Semaphore This chapter provides reference information about the b

Seite 124

Neuron C Reference Guide 1 1 Predefined Events This chapter provides reference information on predefined events. The predefined events desc

Seite 125

190 Built-In Variables, Objects, Symbols, and Semaphore Introduction Neuron C Version 2 provides built-in variables a

Seite 126

Neuron C Reference Guide 191 Built-In Variables The following sections list the Neuron C built-in variables alphabetically, providing relevan

Seite 127

192 Built-In Variables, Objects, Symbols, and Semaphore unsigned input_clock : 3; unsigned comm_type

Seite 128

Neuron C Reference Guide 193 cp_readonly_value_file_len Variable The cp_readonly_value_file_len variable contains the length of the cp_read

Seite 129

194 Built-In Variables, Objects, Symbols, and Semaphore Example 1: signed long switch_state; when (io_changes(switch

Seite 130

Neuron C Reference Guide 195 When an nv_update_occurs event is TRUE, the nv_in_addr variable is set to contain the LONWORKS addressing inform

Seite 131

196 Built-In Variables, Objects, Symbols, and Semaphore nv_in_index Variable The nv_in_index variable contains the

Seite 132

Neuron C Reference Guide 197 unsigned : 0; unsigned : 4; unsigned receive_trans_count : 4; unsig

Seite 133

198 Built-In Variables, Objects, Symbols, and Semaphore Built-In Objects The following sections list the Neuron C bui

Seite 134

Neuron C Reference Guide 199 struct { boolean priority_on; msg_tag tag; int code; int data[MAXDATA]; bo

Seite 135

2 Predefined Events Introduction to Predefined Events An event is a programmatic notification provided by the Neuron firmware that there has been an

Seite 136

200 Built-In Variables, Objects, Symbols, and Semaphore resp_out Object The resp_out object contains an outgoing re

Seite 137

Neuron C Reference Guide 201 Symbol Description _NCC5 Defined for version 5 of the Neuron C compiler. This version corresponds to Version

Seite 138

202 Built-In Variables, Objects, Symbols, and Semaphore __lock { // acquire semaphore f(); } // re

Seite 139

Neuron C Reference Guide 203 A Syntax Summary This appendix provides a summary of Neuron C Version 2.2 syntax, with some explanatory materia

Seite 140 - Additional Features

204 Syntax Summary Syntax Conventions In this syntax section, syntactic categories (nonterminals) are indicated by it

Seite 141

Neuron C Reference Guide 205 Neuron-C-declaration : task-declaration io-object-declaration ; functional-block-declaration ; device-prope

Seite 142

206 Syntax Summary declaration-specifier-list : declaration-specifier-list declaration-specifier declaration-speci

Seite 143

Neuron C Reference Guide 207 Storage Classes The ANSI C storage classes are augmented in Neuron C with the additional classes config, eeprom,

Seite 144

208 Syntax Summary enum-const-list : enum-const-list , enum-const enum-const enum-const : variable-identifier

Seite 145 - Query Status

Neuron C Reference Guide 209 cp-info : cp_info ( cp-option-list ) cp-option-list : cp-option-list , cp-option cp-option-list cp-opti

Seite 146

Neuron C Reference Guide 3 offline online reset timer_expires (unqualified) wink All other predefined events can be used in multiple when cla

Seite 147

210 Syntax Summary bind-info-option : auth ( configurable-keyword ) authenticated ( configurable-keyword ) auth

Seite 148

Neuron C Reference Guide 211 function-parameter-declaration : formal-parameter-declaration prototype-parameter-declaration formal-paramete

Seite 149

212 Syntax Summary abstract-decl-specifier : type-specifier cv-type-qualifier Task Declarations Neuron C contains t

Seite 150

Neuron C Reference Guide 213 parm-declaration : declaration-specifier-list parm-declarator-list ; parm-declarator-list : parm-declarat

Seite 151

214 Syntax Summary message-event : message-event-keyword ( expression ) message-event-keyword message-event-keywo

Seite 152

Neuron C Reference Guide 215 modified-io-object-declarator : io-object-declarator [ io-option-list ] io-option-list : io-option-list io-op

Seite 153

216 Syntax Summary select ( io-object-pin-name ) short single_tc slave slave_b __slow sync ( io-object-pin

Seite 154

Neuron C Reference Guide 217 The functional block name can specify either a scalar or a single-dimensioned array (like a network variable dec

Seite 155

218 Syntax Summary property-instantiation : [ property-qualifier ] cpnv-prop-ident [ property-qualifier ] cp-fami

Seite 156

Neuron C Reference Guide 219 incomplete-stmt : label : incomplete-stmt for-head incomplete-stmt if-else-head incomplete-stmt if-head stat

Seite 157

4 Predefined Events The reference value is the value read the last time the change event evaluated to TRUE. For the unqualified io_changes event, t

Seite 158

220 Syntax Summary choice-expr : logical-or-expr ? expression : choice-expr logical-or-expr logical-or-expr : logi

Seite 159

Neuron C Reference Guide 221 add-op : one of + | - multiplicative-expr : multiplicative-expr mul-op cast-expr cast-expr mul-op : one

Seite 160

222 Syntax Summary Primary Expressions, Built-in Variables, and Built-in Functions In addition to the ANSI C definiti

Seite 161

Neuron C Reference Guide 223 eeprom_memcpy fblock_director get_fblock_count | get_nv_count get_tick_count high_byte interrupt_c

Seite 162

224 Syntax Summary #define INT_MAX 127 #define INT_MIN ((int)(-128)) #define UINT_MAX 255 #define LONG_MAX 32767

Seite 163

Neuron C Reference Guide 225 B Reserved Keywords This chapter lists all Neuron C Version 2.2 reserved keywords, including the standard reser

Seite 164

226 Reserved Keywords Reserved Words List The following list of reserved words includes keywords in the Neuron C lang

Seite 165

Neuron C Reference Guide 227 case (c) changeable_type (2) char (c) charge_pump_enable (f) clock (1) clockedge (1) COMM_IGNORE (e) config (1)

Seite 166

228 Reserved Keywords invert (1) IO_0 (1) IO_1 (1) IO_10 (1) IO_11 (2.1) IO_2 (1) IO_3 (1) IO_4 (1) IO_5 (1) IO_6 (1)

Seite 167

Neuron C Reference Guide 229 nonauthenticated (1) nonbind (1) nonconfig (1) nonpriority (1) numbits (1) nv_array_index (v) nv_in_addr (v) nv_

Seite 168

Neuron C Reference Guide 5 } Example 2 IO_7 input pulsecount total_ticks; when (io_changes(total_ticks) by 100) { ... } io_in_ready Eve

Seite 169

230 Reserved Keywords slave (1) slave_b (1) sleep (f) sleep_flags (et,t) __slow spi (2.1) spi_abort (2.1) spi_get_err

Seite 170

Neuron C Reference Guide 231 _bcd2bin _bin2bcd _bit_input _bit_input_ext _bit_output_ext _bit_output_hi _bit_output_lo1 _bit_output_lo2 _bi

Seite 171

232 Reserved Keywords _io_sci_set_buffer_out _io_scispi_abort _io_scispi_input_ready _io_scispi_output_ready _io_set_

Seite 172

Neuron C Reference Guide 233 _nv_array_update_succeeds _nv_poll _nv_poll_all _nv_update_completes _nv_update_fails _nv_update_occurs _nv_upda

Seite 174

Neuron C Reference Guide 235 Index _ __lock keyword, 201 3 32-bit integers. See signed 32-bit integers A A/D converter, 96, 100 a2d.h include

Seite 175

236 Index bypass mode, 114, 118, 124, 155 byte I/O object, 4, 91, 104, 105 byte.h include file. See include files C c

Seite 176

Neuron C Reference Guide 237 declarator syntax, 210 delay fixed, 79 scalable, 130 delay( ) function, 41, 130 definition, syntax and example,

Seite 177 - Timer Declarations

238 Index fl_sqrt( ) function, 47, 62 fl_sub( ) function, 47, 62 fl_to_ascii( ) function, 47, 66 fl_to_ascii_fmt( ) f

Seite 178 - Timer Object

Neuron C Reference Guide 239 sci_abort( ), 131 sci_get_error( ), 131 service_pin_msg_send( ), 132 service_pin_state( ), 132 set_bit( ), 133 s

Seite 179 - Declarations

6 Predefined Events when (io_out_ready(io_bus)) { io_out(io_bus, &data); } io_update_occurs Event The io_update_occurs event evaluates to T

Seite 180 - Introduction

240 Index I/O object type names, 91 I/O object types optional definitions, 97 I/O objects, xx clock value of, 103 dec

Seite 181

Neuron C Reference Guide 241 M magcard I/O object, 92, 94 magtrack1 I/O object, 92, 94 make_long( ) function, 44 definition, syntax and examp

Seite 182

242 Index configuration property, 164 connection information, 167 const keyword, 162 controlling propagation of outpu

Seite 183

Neuron C Reference Guide 243 O object_disabled keyword, 172 objects built-in, 198 offchip keyword, 163 off-chip memory, 20 offline event, 86,

Seite 184

244 Index repeating timer, 158 reserved words, 226 reset, 191 determining cause of, 120 reset cause register clearing

Seite 185

Neuron C Reference Guide 245 set_netvar_count pragma, 34 set_node_sd_string pragma, 34 set_std_prog_id pragma, 35 SFPTs, xix SHRT_MAX, 223 SH

Seite 186 - Device Property Lists

246 Index alternate clock assignment, 103 I/O input, 101 timer_expires event, 158 definition, syntax and example, 17

Seite 188

Neuron C Reference Guide 7 msg_arrives Event The msg_arrives event evaluates to TRUE once for each a message that arrives. This event can

Seite 189

8 Predefined Events } msg_fails Event The msg_fails event evaluates to TRUE when a message fails to be acknowledged after all retries have been at

Seite 190

Neuron C Reference Guide 9 ... msg_out.tag = tag_out; msg_send(); ... when (msg_succeeds(tag_out)) { ... } nv_update_complet

Seite 191

Neuron C Reference Guide iii Welcome This manual describes the Neuron® C Version 2.2 programming language. It is a companion piece to the Neu

Seite 192

10 Predefined Events Example 1 – Event for a Single Network Variable network output SVNT_abs_humid nvoHumidity; ... nvoHumidity = 32; // This

Seite 193

Neuron C Reference Guide 11 array, the nv_array_index built-in variable indicates the relative index of the element to which the event applie

Seite 194

12 Predefined Events ... when (nv_update_fails(nvoHumidity)) { ... } Example 3 – Event for a Range of Network Variables network output SVNT_a

Seite 195

Neuron C Reference Guide 13 Example 1 – Event for a Single Network Variable network input SNVT_switch nviSwitch; when (nv_update_occurs(nviS

Seite 196 - Message Tags

14 Predefined Events If a program checks for the nv_update_succeeds event, it must check for the nv_update_fails event as well. The alternative is

Seite 197

Neuron C Reference Guide 15 nvoHumidity3; ... nvoHumidity2 = 32; ... when (nv_update_succeeds(nvoHumidity1 .. nvoHumidity3)) {

Seite 198

16 Predefined Events online Event The online event evaluates to TRUE only if the device is offline and an Online network management message is rec

Seite 199

Neuron C Reference Guide 17 Syntax reset Example when (reset) { // initialize peripheral devices, and so on } resp_arrives Event The res

Seite 200

18 Predefined Events Example mtimer countdown; ... countdown = 100; ... when (timer_expires(countdown)) { ... } wink Event The wink

Seite 201

Neuron C Reference Guide 19 2 Compiler Directives This chapter provides reference information for compiler directives, also known as pragmas

Seite 202

iv  Introduction to the LONWORKS Platform (078-0391-01A). This manual provides an introduction to the ISO/IEC 14908 (ANSI/CEA-709.1 and EN14908) Con

Seite 203

20 Compiler Directives Compiler Directives ANSI C permits compiler extensions through the #pragma directive. These d

Seite 204

Neuron C Reference Guide 21 #pragma app_buf_in_size size [, modifier] See Allocating Buffers in Chapter 8, Memory Management, of the Neuron C

Seite 205 - Related Data Structures

22 Compiler Directives The create_cp_value_files_uninit option is used to prevent the compiler from generating config

Seite 206

Neuron C Reference Guide 23 In certain situations when linking a program for a Neuron 3150 Chip or a 3150 Smart Transceiver, it might be nece

Seite 207

24 Compiler Directives #pragma debug option This pragma allows selection of various network debugger features. A pro

Seite 208

Neuron C Reference Guide 25 #pragma disable_servpin_pullup Disables the internal pullup resistor on the service pin. This pullup resistor is

Seite 209 - Symbols, and Semaphore

26 Compiler Directives This directive has no effect for a Series 5000 chip because Series 5000 chips do not have on-c

Seite 210

Neuron C Reference Guide 27 #pragma idempotent_duplicate_off #pragma idempotent_duplicate_on These pragmas control the idempotent request ret

Seite 211 - Built-In Variables

28 Compiler Directives directive defines the myToolkit.lib file within the “c:\LonWorks\myProjects” directory: #pragm

Seite 212

Neuron C Reference Guide 29 This directive is not supported in model files. #pragma net_buf_in_count count [, modifier] See Allocating Buffer

Seite 213

Neuron C Reference Guide v Typeface or Symbol Used for Example italic type abstract elements identifier [square brackets] optional fields

Seite 214

30 Compiler Directives Development Tool, valid values for num are 0 to 127. In Neuron C Version 2.2 (and later), the

Seite 215

Neuron C Reference Guide 31 Level Optimization Performed Notes 1 No optimization Default for debug targets 2 Minimal optimization CP temp

Seite 216

32 Compiler Directives The #pragma optimization directive replaces the following directives: #pragma codegen cp_famil

Seite 217 - Control Network Protocol

Neuron C Reference Guide 33 #pragma relaxed_casting_off #pragma relaxed_casting_on These pragmas control whether the compiler treats a cast t

Seite 218 - Built-In Objects

34 Compiler Directives Note this directive can be used to state compatibility with a guidelines version that is not a

Seite 219

Neuron C Reference Guide 35 #pragma set_std_prog_id hh:hh:hh:hh:hh:hh:hh:hh Provides a mechanism for setting the device’s 8-byte program ID.

Seite 220 - Built-In Symbols

36 Compiler Directives #pragma specify_io_clock string Specify this directive to inform the compiler of the value of

Seite 221 - Built-In Semaphore

Neuron C Reference Guide 37 Neuron 3120E1 Chip, Neuron 3120E2 Chip, and 3120 Smart Transceiver, firmware version 6 (or later) supports either

Seite 222

38 Compiler Directives ... #else #ifdef YYY ... #else #error “You must define either XXX or YYY”

Seite 223 - Syntax Summary

Neuron C Reference Guide 39 3 Functions This chapter provides reference information on the Neuron C built-in and library functions. Built-i

Seite 225 - Declaration Specifiers

40 Functions Introduction This chapter lists Neuron C functions, providing syntax information, descriptions, and exam

Seite 226 - Type Keywords

Neuron C Reference Guide 41 variables and floating-point arithmetic, and a discussion of the use of extended precision variables and extended

Seite 227 - Enumeration Syntax

42 Functions Function Description go_offline( ) Cease execution of the application program interrupt_control( ) En

Seite 228 - Structure/Union Syntax

Neuron C Reference Guide 43 Function Description addr_table_index( ) Determine address table index of message tag application_restart( ) B

Seite 229 - Connection Information

44 Functions Function Description bin2bcd( ) Convert binary data to binary coded decimal high_byte( ) Extract the

Seite 230 - Declarator Syntax

Neuron C Reference Guide 45 Function Description s32_div( ) Divide two signed 32-bit numbers s32_div2( ) Divide a 32-bit signed number by

Seite 231 - Abstract Declarators

46 Functions Function Description s32_rem( ) Return the remainder of a division of two signed 32-bit numbers s32_si

Seite 232 - Function Declarations

Neuron C Reference Guide 47 Function Description fl_from_ulong( ) Convert an unsigned long number to a floating-point number fl_ge( ) Retu

Seite 233 - Complex Events

48 Functions Function Description fl_to_ascii_fmt( ) Convert a floating-point number to a formatted ASCII string fl

Seite 234 - I/O Object Declarations

Neuron C Reference Guide 49 Table 11. Utility Functions Function Description ansi_memcpy( ) Copy a block of memory with ANSI return value a

Seite 235 - I/O Options

Neuron C Reference Guide vii Table of Contents Welcome...

Seite 236

50 Functions Function Description memset( ) Set a block of memory to a specified value:  length greater than or e

Seite 237 - Property List Declarations

Neuron C Reference Guide 51 Function Description io_in( ) Input data from I/O object:  Dualslope input  Edgelog input  Infrared input

Seite 238 - Statements

52 Functions Function Description io_set_clock( ) Set timer/counter clock rate io_set_direction( ) Change directio

Seite 239 - Expressions

Neuron C Reference Guide 53 s32_type some_number = {0, 0, 0, 4}; // initialized to 4 on reset s32_type another_number = {-1, -1, -1, -16};

Seite 240

54 Functions Table 13. Binary Arithmetic Operators Short Name Function add void s32_add(const s32_type *arg1, const

Seite 241

Neuron C Reference Guide 55 Short Name Function neg void s32_neg(const s32_type *arg1, s32_type *arg2); Returns the negative of a signed 32-

Seite 242 - Functions

56 Functions Miscellaneous Signed 32-bit Functions Table 16 lists miscellaneous signed 32-bit functions. Table 16. Si

Seite 243 - Implementation Limits

Neuron C Reference Guide 57 Short Name Function from ulong void s32_from_ulong(unsigned long arg1, s32_type *arg2);Converts a Neuron C unsign

Seite 244

58 Functions Table 20. Signed 32-Bit Function Performance Function Maximum Average Add/subtract 0.10 0.08 Multiply

Seite 245 - Reserved Keywords

Neuron C Reference Guide 59 float_type X, A, B, C; fl_mul(&B, &C, &X); fl_add(&X, &A, &X); The floating-point format

Seite 246 - Reserved Words List

viii nv_update_succeeds Event ... 13 Syntax ...

Seite 247

60 Functions A number of #define literals are defined for use by the application to initialize floating-point structu

Seite 248

Neuron C Reference Guide 61 Example: float_type local_angle; // internal variable network output SNVT_angle_f nvoAngle; // network variable

Seite 249

62 Functions Table 21. Binary Arithmetic Operators Short Name Function add void fl_add(const float_type *arg1, co

Seite 250

Neuron C Reference Guide 63 Short Name Function trunc void fl_trunc(const float_type *arg1, float_type *arg2);Returns the whole number part

Seite 251

64 Functions Short Name Function gt boolean fl_gt(const float_type *arg1, const float_type *arg2); Returns TRUE i

Seite 252

Neuron C Reference Guide 65 Table 25. Floating-Point Conversion Functions Short Name Function to slong signed long fl_to_slong(const float_ty

Seite 253

66 Functions Table 26. Conversions of Floating-Point Numbers to ASCII Strings Short Name Function to ascii void fl_

Seite 254

Neuron C Reference Guide 67 Conversion of ASCII String to Floating-Point Table 27 lists the conversion functions for an ASCII srtring to a fl

Seite 255

68 Functions Function Maximum Average Multiply 1.61 1.33 Divide 2.43 2.08 Square Root 10.31 8.89 Multiply/Divide

Seite 256 - 236 Index

Neuron C Reference Guide 69 Using the NXT Neuron C Extended Arithmetic Translator You can use the NXT Neuron C Extended Arithmetic Translator

Seite 257

Neuron C Reference Guide ix Conversion of Floating-Point to ASCII String ... 65 Conversion of ASCII String to Floa

Seite 258 - 238 Index

70 Functions Syntax type abs (a); Example int i; long l; void f(void) { i = abs(-3); l = abs(-300); } access_add

Seite 259

Neuron C Reference Guide 71 Syntax #include <access.h> const alias_struct *access_alias (int index); Example #include <access.h>

Seite 260 - 240 Index

72 Functions Example #include <access.h> network output SNVT_amp nvoAmpere; nv_struct nv_copy; void f(void) {

Seite 261

Neuron C Reference Guide 73 Example #include <mem.h> unsigned buf[40]; unsigned *p; void f(void) { p = ansi_memcpy(buf, "Hello

Seite 262 - 242 Index

74 Functions Syntax #include <control.h> void application_restart (void); Example #define MAX_ERRS 50 int error

Seite 263

Neuron C Reference Guide 75 Syntax void bin2bcd (unsigned long value, struct bcd *p); For a definition of struct bcd, see bcd2bin, above. Exa

Seite 264 - 244 Index

76 Functions Syntax #include <byte.h> void clr_bit (void *array, unsigned bitnum); Example #include <byte.h&

Seite 265

Neuron C Reference Guide 77 121516 xxx This function is useful in conjunction with the support for the Touch I/O model, but can also be u

Seite 266

78 Functions len Specifies the length of the data buffer, 1 to 255 bytes. A value of 0 represents 256 bytes. Exampl

Seite 267

Neuron C Reference Guide 79 Series 3100 Input Clock Series 5000 System Clock Delay (in microseconds) 625 kHz — 9.6*((max(1,floor(count/16)

Kommentare zu diesen Handbüchern

Keine Kommentare