User manual

ASURO - 65
-
C for ASURO
To receive characters, ASURO uses a function SerRead (). The  rst parameter contains a variable
in which the received characters are to be stored. The second parameter de nes how many
characters will be received and the third parameter de nes a timeout: if within a certain time period
(a number of processor clock cycles) no data has been received the SerRead () -function will
be aborted. By using a number “0” however, the function will wait until all characters have been
received. An example will illustrate this function.
ASURO is to receive a message “Hi, here I am” by IR-interface. By a string de nition
char message [] = ”01234567890123456789”
we  rst allocate some storage space for the expected text. Of course the storage space must be
big enough to contain the expected message.
SerRead (message,13,0)
Read 13 characters and wait until 13 characters have been received. We now consider the text
string
“Hi, here I am” has been sent. The function will now overwrite the  rst 13 characters of the
prede ned string
message with
“Hi, here I am”, resulting in a string:
Hi, here I am 3456789
9.2. Overview of the ASURO-Functions
A few functions have been developed to support ASURO’s programming. These functions are by
no means optimal solutions and for some purposes it is a good idea to write special functions.
All functions have been developed as de ned in declarations and may be understood by
inspecting the examples.
Just to avoid misinterpretations: controlling functions like motor-controls or display-functions
change a status, which will remain valid until changed again. A green LED display will remain
green until changed to another colour or switched off.