Download RiState Programming Manual

Transcript
Table of Contents
Introduction ______________________________________________________________ 4
What are the steps to developing a program? _______________________________________ 4
What is state logic? _____________________________________________________________ 4
Definition____________________________________________________________________________
Simple example of state logic ____________________________________________________________
A more useful example of state logic _______________________________________________________
Adding a little to our example ____________________________________________________________
4
5
5
6
Structure of a program ______________________________________________________ 8
Basic structure _________________________________________________________________ 8
Task and state definitions ________________________________________________________ 8
Task Execution Rate ____________________________________________________________ 9
If, then, else __________________________________________________________________ 10
Changing states _______________________________________________________________ 10
Operators and expressions __________________________________________________ 13
The assignment operator (equal sign) _____________________________________________ 13
Arithmetic operators___________________________________________________________ 13
Relational operators ___________________________________________________________ 13
Bitwise operators ______________________________________________________________ 14
The ( ) operator _______________________________________________________________ 14
Compound assignments ________________________________________________________ 14
Operator precedence___________________________________________________________ 15
Variables ________________________________________________________________ 16
Predefined local variables_______________________________________________________ 16
User defined local variables _____________________________________________________ 17
The “v_” prefix ______________________________________________________________________ 18
Expanding the scope of local variables ____________________________________________ 18
I/O variables _________________________________________________________________ 18
IO General Types ____________________________________________________________________
IO Reference ________________________________________________________________________
IO Attributes ________________________________________________________________________
Common IO variable definitions _________________________________________________________
18
19
19
20
The pre-processor _________________________________________________________ 21
#option
option_name ________________________________________________________ 21
#define identifier character_sequence _____________________________________________ 21
Programming Tools _______________________________________________________ 23
PAGE 2 OF 30
STATE LOGIC PROGRAMMING
06/09/2009