Syntax, Example, Clear_status( ) function – Echelon Neuron C User Manual

Page 95: Clr_bit( ) function

Advertising
background image

Neuron C Reference Guide

75

Syntax

void bin2bcd (unsigned long

value

, struct bcd *

p

);

For a definition of struct bcd, see

bcd2bin

, above.

Example

void f(void)
{

struct bcd digits;

unsigned long value;

...

value = 1234;

bin2bcd(value,

&digits);

// digits.d1 now contains 0

// digits.d2 now contains 0

// digits.d3 now contains 1

// digits.d4 now contains 2

// digits.d5 now contains 3

// digits.d6 now contains 4

}

clear_status( )

Function

The clear_status( ) function clears a subset of the information in the status

structure (see the retrieve_status( ) function on page 125). The information
cleared is the statistics information, the reset cause register, and the error log.

Syntax

#include <status.h>

void clear_status (void);

Example

when (timer_expires(statistics_reporting_timer))
{
retrieve_status(status_ptr); // get current statistics
report_statistics(status_ptr); // check it all out
clear_status();
}

clr_bit( )

Function

The clr_bit( ) function clears a bit in a bit array pointed to by

array

. Bits are

numbered from left to right in each byte, so that the first bit in the array is the

most significant bit of the first byte in the array. Like all arrays in C, this first

element corresponds to index 0 (

bitnum

0). When managing a number of bits

that are all similar, a bit array can be more code-efficient than a series of

bitfields because the array can be accessed using an array index rather than
separate lines of code for each bitfield. See also the set_bit( ) function and the

tst_bit( ) function.

Advertising