Differences between standard c and isacc c – Phonetics Sensaphone ISACC 5000 User Manual

Page 107

Advertising
background image

107

Chapter 8: C Programming

DIFFERENCES BETWEEN STANDARD C AND ISACC C

For those of you who are familiar with C programming, note that there are some differences
between standard C and ISACC’s C compiler. The following items will be helpful to be
aware of:

1.

With ISACC C, every IF, ELSE, FOR, DO, and WHILE must have a set of brackets

{} after it.

2.

Condition clauses must be grouped together into pairs.

Standard C will allow:

IF ((condition1) && (condition2) && (condition3))

ISACC C requires:

IF (((condition1) && (condition2)) && (condition3))

3.

There are no shortcut statements such as:

i++;
red+=5; or
bits&=5;

However, statements such as the following are allowed if placed inside parentheses:

IF ( (x=input(5)) ==0)

4.

Bitwise operators are not implemented. There are no:

bitmask = bitmask & 4;

5.

ISACC C only works with base ten integers. No floating point or hexadecimal
numbers can be used unless you implement them in your C program. However,
doing so takes up the limited code space. Remember, you only have 8k of listing
space, and 2k of compiled space.

6.

Variables declared before the main statement retain their values after the program has
been executed. This provides the programmer with nonvolatile memory between
runs of the program. This is useful for accumulating, timing, and most ISACC appli-
cations.

7.

There are no user defined functions or procedures.

8.

The run through, don't loop if you can avoid it philosophy.

Avoid the use of WHILE loops. This will lengthen the execution and response time
of your C program, and serves no advantage. Write your programs such that they run
straight through and exit. If your program is checking for a certain condition to
occur, using a WHILE loop will cause your program to concentrate on that one
condition unnecessarily. Since the program will execute at regular time intervals, you
can use an IF statement and achieve the same or even better results. For example, we
need a program to perform two independent tasks. The first task is to set output 9 on
for 60 seconds whenever input 1 closes. The second task is to change the datalogger
rate to once per second upon closure of input 2.

Advertising
This manual is related to the following products: