manufacturer of I/O-rich SBCs, operator interfaces, handheld instruments, and development tools for embedded control low cost single board computers, embedded controllers, and operator interfaces for scientific instruments & industrial control development tools for embedded control order our low cost I/O-rich embedded control products embedded controller manufacturer profile single board computers & embedded controllers development tools & starter kits for your embedded design operator interfaces with touchscreens and graphical user interface plug-in expansion modules for digital & analog I/O C language & Forth language integrated development tools, IDE single board and embedded computer accessories embedded controller enclosures, bezels, environmental gaskets

The C Programmer’s Guide to the Mosaic Handheld

Table of Contents

PART 1 GETTING STARTED

Introduction. How to Use This Manual

Chapter 1: Getting to Know Your Handheld Instrument

Chapter 2: Powering Your Handheld

PART 2 PROGRAMMING THE MOSAIC HANDHELD

Chapter 3: Your First Program

Chapter 4: The IDE: Writing, Compiling, Downloading and Debugging Programs

Chapter 5: Making Effective Use of Memory

Chapter 6: Real Time Programming

Chapter 7: Failure and Run-Time Error Recovery

Chapter 8: Programming the Graphical User Interface

PART 3 COMMUNICATIONS, MEASUREMENT, AND CONTROL

Chapter 9: Digital and Timer-Controlled I/O

Chapter 10: Data Acquisition

Chapter 11: Serial Communications

Chapter 12: The Battery-Backed Real Time Clock

Chapter 13: Customizing the Handheld's I/O

PART 4: REFERENCE DATA

Appendix A: GUI Function Reference

Appendix B: Handheld Schematics

Glossary

<< Previous | Next >>

A     B     C     DF    G     H     I     K     LM    N     P     R     S    T    UVWXY   

IMAGE

IMAGE

Type

Constant

Return Value

Integer

Description

The name of a property of a graphic or font object that contains the address of the image data.  The address of the image data is generated by the Mosaic’s Image Conversion Program and stored in the Image Header File.

Usage

Set_Property(graphicSTOP, IMAGE, STOP_BMP);

graphicStop @ IMAGE STOP_BMP Set_Property

Library

library.c

library.4th

IMAGE_WIDTH_DATA

IMAGE_WIDTH_DATA

Type

Constant

Return Value

Integer

Description

The name of a property of a font object that contains the address of the image width data or the array that contains the width in pixels of each character.  The address of the image width data is generated by the Mosaic’s Image Conversion Program and stored in the Image Header File.

Usage

Set_Property(graphicSTOP, IMAGE_WIDTH_DATA, COMIC_SANS_8_DAT);

graphicStop @ IMAGE_WIDTH_DATA COMIC_SANS_8_DAT Set_Property

Library

library.c

library.4th

INT_DATA_ENTRY_EVENT_PROCEDURE

INT_DATA_ENTRY_EVENT_PROCEDURE

Type

Constant

Return Value

Integer

Description

The name of a keypad property that contains the xcfa (extended code field address) of a user defined event procedure.  The event procedure is called after an overloaded data entry key is pressed but before the intrakey timeout period is reached.  The intrakey timeout period is set to a half a second and is not adjustable.  The event procedure can not take or return any parameters, but it can modify variables. The INT_DATA_ENTRY_EVENT_PROCEDURE property is unitialized when Initialize_GUI is called.

 

Usage

Set_Property ( GUI_KEYPAD0, INT_DATA_ENTRY_EVENT_PROCEDURE,  (long)

    delete_event_procedure_ptr );

GUI_KEYPAD0 INT_DATA_ENTRY_EVENT_PROCEDURE cfa.for Delete_Event_Procedure

    Set_Property

Library

library.c

library.4th

See Also

DATA_ENTRY_EVENT_PROCEDURE

IN_DISPLAY

IN_DISPLAY

Type

Constant

Return Value

Integer

Description

The name of a screen property that indicates the location of the screen’s data buffer (where images are drawn into) is in the display controller.  All GUI Toolkit screens have their data buffers located in the display controller.  All other screens have their data buffers located in the GUI Heap.  This property is read only.  Possible contents of this property are the booleans GUI_TRUE and GUI_FALSE.

Usage

longFlag = Get_Property(GUI_SCREEN2, IN_DISPLAY);

GUI_SCREEN2 IN_DISPLAY Get_Property flag 2!

Library

library.c

library.4th

void Initialize_Battery ( void )

Initialize_Battery( -- )

Type

Function

Description

A method that initializes the GUI battery object and starts the 8-bit A/D which is used to read the battery voltage and charger state.  Initialize_Battery must be called before Read_Battery. Be sure to install the appropriate jumpers on the Motherboard to connect the A/D inputs to the battery and the charger.  If all 8 Port E lines are required by an application, do not install the jumpers on the Motherboard and don’t call Initialize_Battery or Read_Battery. To monitor the battery and use the remaining Port E lines as digital or analog inputs, get the 8 bit A/D resource before reading and then release the resource when finished.

Usage

Initialize_Battery();

Initialize_Battery

Library

library.c

library.4th

See Also

Read_Battery

void Initialize_GUI ( xaddr heap start, xaddr heap end )

Initialize_GUI ( xaddr1 \ xaddr2 – | xaddr1 = heap start, xaddr2 = heap end )

Type

Function

Input Parameters

heap_start          A 32 bit number that specifies the starting location of the GUI Heap.  The heap must reside at a valid RAM location.  All GUI objects reside in the GUI heap.

heap_end           A 32 bit number that specifies the ending location of the GUI Heap.

Description

Initializes the GUI Toolkit by: setting up a heap for the GUI Toolkit; setting up and activating a task for the GUI Toolkit; and, configuring the display, GUI Screens, GUI Keypads, GUI Font, and pen objects. Initializes the timeslicer to 0 and then starts the timeslicer.  Error checking is performed to assure that Initialize_GUI has not already been called.  Calling any other GUI Toolkit method before calling Initialize_GUI will crash the Handheld Controller.  Errors include: GUI_EXISTS.

Usage

Initialize_GUI( START_GUI_HEAP, END_GUI_HEAP);

START_GUI_HEAP END_GUI_HEAP Initialize_GUI

Library

library.c

library.4th

void Insert_Key ( uint keypad, uint key, uint key_position )

Insert_Key ( keypad_object \ key_object \ key_position )

Type

Function

Input Parameters

keypad_object    A 16 bit number that refers to the keypad object that we’re inserting the key into.

key_object         A 16 bit number that refers to the key object that will be inserted into the keypad.

key_position      A number from 0 to 15 or 20 to 34 that sets the position of the key object in the keypad.

Description

Inserts a key into a keypad at the specified position. There are four valid keypads, one for each GUI screen.  The valid keypads are GUI_KEYPAD0, GUI_KEYPAD1, GUI_KEYPAD2, and GUI_KEYPAD3. Once a key is inserted into a keypad and the keypad’s screen is visible, the key will become active and will respond to presses.  The locations of the valid key positions are shown in the following table.

Table A‑1      The physical location of the valid key positions for a keypad.

0

4

8

12

1

5

9

13

2

6

10

14

3

7

11

15

20

24

28

32

21

25

29

33

22

26

30

34

23

27

31

On / Off

Errors include: INVALID_KEY, KEY_POS_OUT_OF_RANGE, and INVALID_KEYPAD.

Usage

Insert_Key( GUI_KEYPAD0, actionkeyStop, 8);

GUI_KEYPAD0 actionkeyStop 8 Insert_Key

Library

library.c

library.4th

See Also

GUI_KEYPAD0, GUI_KEYPAD1, GUI_KEYPAD2, GUI_KEYPAD3, VISIBLE

INVALID_FONT

INVALID_FONT

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the font object associated with a textbox or the GUI Toolkit is not valid.

Usage

Set_Property(textboxMesg, TEXTBOX_FONT, (ulong) graphicStop);

If (Read_Error() == INVALID_FONT)

{

  printf(“Attempted to use an invalid font for textboxMesg.\n”);

  Clear_Error();

}

textboxMesg @ TEXTBOX_FONT graphicStop @ u>d Set_Property

Read_Error INVALID_FONT =

if

  cr .” Attempted to use an invalid font for textboxMesg.”

  Clear_Error

endif

 

Library

library.c

library.4th

INVALID_IMAGE

INVALID_IMAGE

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the address of the image data is not valid.

Usage

Set_Property(graphicStop, IMAGE, GUI_FALSE);

If (Read_Error() == INVALID_IMAGE)

{

  printf(“Image for graphicStop is not valid.\n”);

  Clear_Error();

}

graphicStop @ IMAGE GUI_FALSE Set_Property

Read_Error INVALID_IMAGE =

if

  cr .” Image for graphicStop is not valid.”

  Clear_Error

endif

Library

library.c

library.4th

INVALID_KEY

INVALID_KEY

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the key reference is not valid.

Usage

Insert_Key(GUI_KEYPAD0, graphicStop, 8);

If (Read_Error() == INVALID_KEY)

{

  printf(“graphicStop is not a valid key object.\n”);

  Clear_Error();

}

GUI_KEYPAD0 graphicStop @ 8 Insert_Key

Read_Error INVALID_KEY =

if

  cr .” graphicStop is not a valid key object.”

  Clear_Error

endif

Library

library.c

library.4th

INVALID_KEYPAD

INVALID_KEYPAD

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the keypad reference is not valid.

Usage

Insert_Key(GUI_SCREEN0, actionkeyStop, 8);

If (Read_Error() == INVALID_KEYPAD)

{

  printf(“GUI_SCREEN0 is not a valid keypad.\n”);

  Clear_Error();

}

GUI_SCREEN0 actionkeyStop @ 8 Insert_Key

Read_Error INVALID_KEYPAD =

if

  cr .” GUI_SCREEN0 is not a valid keypad.”

  Clear_Error

endif

Library

library.c

library.4th

INVALID_OBJECT

INVALID_OBJECT

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the object reference is not valid.

Usage

Set_Property(invalidObj, IMAGE, STOP_BMP);

If (Read_Error() == INVALID_OBJECT)

{

  printf(“Attempted to set a property for an invalid object.\n”);

  Clear_Error();

}

invalidObject @ IMAGE STOP_BMP Set_Property

Read_Error INVALID_OBJECT =

if

  cr .” Attempted to set a property for an invalid object.”

  Clear_Error

endif

Library

library.c

library.4th

INVALID_PLOT

INVALID_PLOT

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the plot object reference is not valid.

Usage

Add_Data(graphicStop, 14);

If (Read_Error() == INVALID_PLOT)

{

  printf(“Attempted to add data to an invalid plot object.\n”);

  Clear_Error();

}

graphicStop @ 14 Add_Data

Read_Error INVALID_PLOT =

if

  cr .” Attempted to add data to an invalid plot object.”

  Clear_Error

endif

Library

library.c

library.4th

INVALID_PROPERTY

INVALID_PROPERTY

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the property is not valid.

Usage

Set_Property(graphicStop, TEXTBOX_FONT, STOP_BMP);

If (Read_Error() == INVALID_PROPERTY)

{

  printf(“Attempted to set an invalid property for graphicStop.\n”);

  Clear_Error();

}

graphicStop @ TEXTBOX_FONT STOP_BMP Set_Property

Read_Error INVALID_PROPERTY =

if

  cr .” Attempted to set an invalid property for graphicStop.”

  Clear_Error

endif

Library

library.c

library.4th

INVALID_SCREEN

INVALID_SCREEN

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the screen object reference is not valid.

Usage

Load(invalidObj, graphicStop, 0, 0);

If (Read_Error() == INVALID_SCREEN)

{

  printf(“Attempted to load a graphic into an invalid screen.\n”);

  Clear_Error();

}

invalidObj @ graphicStop @ 0 0 Load

Read_Error INVALID_SCREEN =

if

  cr .” Attempted to load a graphic into an invalid screen.”

  Clear_Error

endif

Library

library.c

library.4th

INVALID_SHIFT_VALUE

INVALID_SHIFT_VALUE

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the shift value is not SHIFT_UP, SHIFT_DOWN, or SHIFT_NEUTRAL.

Usage

Set_Property(GUI_KEYPAD0, SHIFT_STATE, GUI_TRUE);

If (Read_Error() == INVALID_SHIFT_VALUE)

{

  printf(“Invalid shift state value.\n”);

  Clear_Error();

}

GUI_KEYPAD0 SHIFT_STATE GUI_TRUE Set_Property

Read_Error INVALID_SHIFT_VALUE =

if

  cr .” Invalid shift state value.”

  Clear_Error

endif

Library

library.c

library.4th

INVALID_TEXTBOX

INVALID_TEXTBOX

Type

Constant

Return Value

Integer

Description

The name of an error that indicates the textbox object reference is not valid.

Usage

STRING_TO_TEXTBOX(graphicStop, “hello”);

If (Read_Error() == INVALID_TEXTBOX)

{

  printf(“Attempted to write a string into an invalid textbox.\n”);

  Clear_Error();

}

graphicStop @ “ hello” String_To_Textbox

Read_Error INVALID_TEXTBOX =

if

  cr .” Attempted to write a string into an invalid textbox.”

  Clear_Error

endif

Library

library.c

library.4th

INVERT

INVERT

Type

Constant

Return Value

Integer

Description

The name of a textbox property that inverts the background and rendered text of a textbox.  With the INVERT property set to true, the background pixels are turned on and the pixels that render the text are turned off.  The INVERT property of a textbox is set to GUI_FALSE when the textbox is instantiated.

Usage

Set_Property(textboxString, INVERT, GUI_TRUE);

textboxString @ INVERT GUI_TRUE Set_Property

Library

library.c

library.4th

<< Previous | Next >>


Home|Site Map|Products|Manuals|Resources|Order|About Us
Copyright (c) 2006 Mosaic Industries, Inc.
Your source for single board computers, embedded controllers, and operator interfaces for instruments and automation