Io_set_clock( ) built-in function, Syntax – Echelon Neuron C User Manual

Page 123

Advertising
background image

Neuron C Reference Guide

103

{
io_set_baud(iosci,

SCI_38400);

// Optional baud change

}

io_set_clock( )

Built-in Function

The io_set_clock( ) built-in function allows an application to specify an alternate
clock value for any input or output timer/counter object that permits a clock

argument in its declaration syntax. The objects are listed below:

dualslope

edgelog

frequency

infrared

oneshot

ontime

period

pulsecount

pulsewidth

stretchedtriac

triac

For multiplexed inputs, use the io_select( ) function to specify an alternate clock.

When io_set_clock( ) is used, the I/O object automatically discards the first value

obtained.
You can call this function at any time. However, if your application specifies an
alternate clock value, it must call this function within the reset task and after

each call to the io_select() function.

Syntax

void io_set_clock (

io-object-name

,

clock-value

);

io-object-name

The I/O object name that corresponds to

io-object-name

in

the I/O declaration. This built-in function is used only for

timer/counter I/O objects.

clock-value

Required clock selector value in the range of 0 to 7 (for

Series 3100 devices) or 0 to 15 (for Series 5000 devices), or

a variable name for the clock. This value overrides a
clock value specified in the object’s declaration.


You can use a TCCLK_* macro value from <echelon.h> to

specify the clock selector value. For Series 3100 devices,

you can use the macros whose values are in the range
0..7; for Series 5000 devices, you can use any of the

macros (values 0..15) for increased clock resolution.


However, for Series 5000 devices, you cannot specify a

value that defines a clock rate that is higher than one-half

of the device’s system clock. For example, if your system
clock rate is 20 MHz, you can specify any TCCLK_* macro

that defines a 10 MHz or lower clock rate (that is, you

Advertising