Link here

C V4.0/V4.2 Function Summary


The C V4.0/V4.2 Function Glossary provides detailed descriptions of all of the library routines that customize Control-C for use with the QVGA Controller, Panel-Touch Controller, and QED Board running the QED-Forth V4.0x or V4.2x operating system software targeted to the Freescale 68HC11 microcontroller. These C library routines are defined and declared in a set of header files in the compiler's \FABIUS\INCLUDE\MOSAIC directory. All files are included with the IDE (Integrated Development Environment) which simplifies software development. The IDE includes the Textpad editor and a toolbar that launches the C compiler and the terminal for easy code downloads. This document contains the following:

All the functions described may be found in the C V4.0/V4.2 Function Glossary and the C V4.0/V4.2 Interactive Debugger Glossary.

 

Using header files

The names and contents of the header files are as follows:

Header File Contents
ANALOG.H Device drivers for the 8-bit A/D, 12-bit A/D, and 8-bit D/A analog converters
ARRAY.H Routines that dimension, access and manipulate Forth Arrays in paged memory
COMM.H Serial communications driver functions
FLASH.H Flash memory functions
HEAP.H Heap memory manager functions
INTERUPT.H Interrupt identifiers and functions to facilitate posting interrupt handlers
INTRFACE.H Device drivers for the keypad and LCD display interfaces
MTASKER.H Multitasking executive and elapsed-time clock routines
NUMBERS.H Formatted output for QED floating point numbers, and ANSI/QED conversion
PIA.H Access functions for the onboard Peripheral Interface Adapter chip
QEDREGS.H Macro definitions for all of the 68HC11F1 registers
QEDSYS.H Operating system functions for initialization, autostarting, and error handling
STEPPER.H Stepper motor control primitives
TYPES.H Useful type definitions
USER.H Declarations of USER_AREA and TASK structures, and user variable definitions
UTILITY.H Defines macros such as MIN(), MAX(), ABS(), TRUE and FALSE
WATCH.H Routines that set and read the battery-backed real-time "smart watch"
XMEM.H Fetch, store and bit manipulation functions for extended memory and EEPROM

The following Categorized List of Control-C Library Functions is organized according to these header files. To examine these files, use TextPad (the Mosaic IDE Editor) to open the files in the compiler's \MOSAIC\FABIUS\INCLUDE\MOSAIC directory.

 

Interpreting glossary definitions

Each entry in the C V4.0/V4.2 Function Glossary includes the following elements:

  1. A declaration of the routine. If it is a constant or a macro that does not require any arguments, then the name of the routine is simply presented. If it is a function, or a macro that behaves like a function, then the declaration looks like an ANSI-C function prototype, such as:
    void Emit(uchar c)

    where void tells us that there is no return value, and uchar c tells us that there is a single input parameter that is an unsigned character.

  2. A detailed definition of what the routine does.
  3. A Type: field that specifies whether the routine is a _forth function, a C function, a macro, a constant, or a typedef.
  4. A Related QED-Forth name field that specifies the name of a closely related function or constant that is accessible via the QED-Forth interpreter/compiler using QED-Forth syntax.
  5. A "Header file field that specifies where the routine is defined or declared.

 

Type abbreviations used in function declarations

Standard type specifiers such as char, int, long, and float are used in the glossary declarations. In addition, we use four convenient typedefs that are defined in the TYPES.H header file:

typedef unsigned char uchar;
typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long xaddr;

The meanings of the first three typedefs are obvious; they are abbreviations for unsigned types. The "xaddr" typedef stands for "extended address", and is used when a 32-bit address must be passed as a parameter.

 

The Main Glossary of Control-C Library Functions

The C V4.0/V4.2 Function Glossary presents definitions of all of the functions, constants and macros that are defined and declared in the \FABIUS\INCLUDE\MOSAIC header files. This glossary does not describe standard ANSI-C library functions (such as functions in stdio.h); consult any ANSI-C text for descriptions of the ANSI standard library functions.

The routines described in the glossary facilitate control of all of the hardware on the QED Board, including the analog and digital I/O lines, serial communications ports, keypad scanner, character and graphics display interfaces, and battery-backed real-time clock. In addition, the routines provide complete control over the built-in multitasking executive, heap memory manager, interrupt handling capabilities, and operating system features including autostarting your application program.

 

The Interactive Debugger Glossary

The C V4.0/V4.2 Interactive Debugger Glossary describes a set of useful routines that allow you to interactively call C functions and manipulate variables and FORTH_ARRAY data. These versatile routines make it easy to thoroughly test each function in your program over its full range of allowed input parameters.

The environment for the interactive debugger is the QED-Forth interpreter. Thus, while the syntax of the debugger commands is similar to C function prototypes and assignment statements, you will in fact be "talking to" the debugger using the QED-Forth language. The Debugging chapter of the QVGA Manual explains how to use QED-Forth and the debugger routines.

In addition to the debugger keywords that were created for debugging C programs, the glossary also describes some QED-Forth functions that can be interactively called. These useful functions let you write to EEPROM, view memory contents using a DUMP command, capture your application in a Motorola S-record file to facilitate program transfer to flash memory on production boards, change the baud rates of the serial ports, and setup the MAIN program to AUTOSTART each time the QED Board starts up.

The introduction at the top of the C V4.0/V4.2 Interactive Debugger Glossary provides further information.

 

Categorized List of Control-C Library Functions

ANALOG.H

AD12Multiple() AD8ToBuffer() FastSetDAC()
AD12Sample() DIM_AD12_BUFFER() InitAD12andDAC()
AD12ToBuffer() DIM_AD8_BUFFER() InitSPI()
AD8Multiple() FastAD12Multiple() SetDAC()
AD8Off() FastAD12Sample() SPIOff()
AD8On() FastAD8Multiple()
AD8Sample() FastAD8Sample()
 

ARRAY.H

ARRAYBASE() CopyArray() FillArray()
ArrayBase() DELETED() FORTH_ARRAY
ARRAYFETCH() Deleted() NUMCOLUMNS()
ArrayFetch() DIM() NUMDIMENSIONS()
ARRAYMEMBER() Dimensioned() NUMROWS()
ArrayMember() FARRAYFETCH() SIZEOFMEMBER()
ARRAYSIZE() FArrayFetch() SWAPARRAYS()
ARRAYSTORE() FARRAYSTORE() SwapArrays()
ArrayStore() FArrayStore()
COPYARRAY() FILLARRAY()
 

COMM.H

AskKey() ForthEmit() PauseOnKey()
AskKey1() ForthKey() RS485Receive()
AskKey2() InitRS485() RS485Transmit()
Baud1AtStartup() InitSerial2() Serial1AtStartup()
Baud2() Key() Serial2AtStartup()
Beep() Key1() TRANSMITTING
Cr() Key2() UseSerial1()
DisableSerial2() NumInputChars() UseSerial2()
Emit() NumOutputChars() _peekTerminal()
Emit1() PARITY _readChar()
Emit2() PARITY_IN _readTerminal()
ForthAskKey() PARITY_OUT _writeChar()
 

FLASH.H

DownloadMap() PageToRAM() ToFlash()
PageToFlash() StandardMap() WhichMap()
 

HEAP.H

DEFAULT_HEAPEND FromHeap() Room()
DEFAULT_HEAPSTART INIT_DEFAULT_HEAP() ToHeap()
DupHeapItem() IsHeap() TransferHeapItem()
 

INTERUPT.H

ATTACH() IC3_ID PULSE_EDGE_ID
Attach() IC4_OC5_ID PULSE_OVERFLOW_ID
CLOCK_MONITOR_ID ILLEGAL_OPCODE_ID RTI_ID
COP_ID IRQ_ID SCI_ID
DISABLE_INTERRUPTS() OC1_ID SPI_ID
ENABLE_INTERRUPTS() OC2_ID SWI_ID
IC1_ID OC3_ID TIMER_OVERFLOW_ID
IC2_ID OC4_ID XIRQ_ID
 

INTRFACE.H

AskKeypad() DisplayOptions() PutCursor()
AskKeypress() DISPLAY_HEAP ScanKeypad()
BufferPosition() GARRAY_XPFA ScanKeypress()
CharsPerDisplayLine() InitDisplay() StringToDisplay()
CharToDisplay() IsDisplay() STRING_TO_DISPLAY()
ClearDisplay() IsDisplayAddress() UpdateDisplay()
CommandToDisplay() Keypad() UpdateDisplayLine()
DisplayBuffer() LinesPerDisplay() UpdateDisplayRam()
 

MTASKER.H

Activate() Halt() SEND()
ACTIVATE() InitElapsedTime() Send()
AD8_RESOURCE InstallMultitasker() SERIAL
ASLEEP Kill() SERIAL1_RESOURCE
AWAKE MAILBOX SERIAL2_RESOURCE
BuildTask() MicrosecDelay() SPI_RESOURCE
BUILD_C_TASK() Pause() StartTimeslicer()
ChangeTaskerPeriod() ReadElapsedSeconds() StopTimeslicer()
FMAILBOX RECEIVE() TIMESLICE_COUNT
FORTH_TASK Receive() TryToFSend()
FRECEIVE() RELEASE() TryToGet()
FReceive() Release() TryToSend()
FSEND() RELEASE_AFTER_LINE TRY_TO_FSEND()
FSend() RELEASE_ALWAYS TRY_TO_GET()
GET() RELEASE_NEVER TRY_TO_SEND()
Get() RESOURCE
 

NUMBERS.H

FILL_FIELD FP_QtoC() RANDOM_SEED
FIXED() LEFT_PLACES RIGHT_PLACES
FLOATING() MANTISSA_PLACES SCIENTIFIC()
FPtoString() NO_SPACES TRAILING_ZEROS
FP_CtoQ() PrintFP()
FP_FORMAT Random()
 

PIA.H

ClearHighCurrent() PIASetBits() PPB
InitPIA() PIAStore() PPB_ADDRESS
PIAChangeBits() PIAToggleBits() PPC
PIAClearBits() PPA PPC_ADDRESS
PIAFetch() PPA_ADDRESS SetHighCurrent()
 

QEDREGS.H

See the QEDREGS.H file. All registers are named using the standard names as described in the Motorola 68HC11F1 documentation.

DDRA DDRD PORTA PORTD PORTE
 

QEDSYS.H

Abort() DefaultRegisterInits() NoVitalIRQInit()
Autostart() Execute() PriorityAutostart()
Breakpoint() InitVitalIRQsOnCold() StandardReset()
Cold() InstallRegisterInits() SysAbort()
ColdOnReset() NoAutostart() Warm()
 

STEPPER.H

CreateRamp() SpeedToDuty() StepManager()
 

TYPES.H

EXTENDED_ADDR THIS_PAGE _Q
PAGE_LATCH TWO_INTS
 

USER.H

CURRENT_HEAP TASK UERROR
CUSTOM_ABORT TASKBASE UKEY
CUSTOM_ERROR TIB UP
NEXT_TASK UABORT UPAD
PAD UASK_KEY USER_AREA
SERIAL_ACCESS UDEBUG UTIB
STATUS UEMIT
 

UTILITY.H

ABS() MAX() TRUE
FALSE MIN()
 

WATCH.H

CALENDAR_TIME WATCH_DAY WATCH_MONTH
ReadWatch() WATCH_HOUR watch_results
SetWatch() WATCH_HUNDREDTH_SECONDS WATCH_SECONDS
WATCH_DATE WATCH_MINUTE WATCH_YEAR
 

XMEM.H

AddXaddrOffset() FetchLong() StoreFloat()
ChangeBits() FetchLongProtected() StoreFloatProtected()
ClearBits() FillMany() StoreInt()
CmoveMany() SetBits() StoreLong()
CountedString() StoreChar() StoreLongProtected()
FetchChar() StoreEEChar() StringMove()
FetchFloat() StoreEEFloat() ToggleBits()
FetchFloatProtected() StoreEEInt() XaddrDifference()
FetchInt() StoreEELong()
 

Categorized List of QED-Forth Debugger and System Configuration Functions

Assignment, Fetching and Function Calling

=CHAR CHAR INT
=FLOAT CHAR* INT*
=INT DO[] LONG
=LONG FLOAT LONG*
CALL.CFN FLOAT*
 

EEPROM Storage

(EE!) (EEC!) (EE2!) (EEF!)
 

Hex Dump and Receive

DUMP DUMP.S1 RECEIVE.HEX
DUMP.INTEL DUMP.S2
 

Numeric I/O

. FP_CtoQ PrintFP
D. FP_QtoC U.
DECIMAL HEX
 

Operating System and Memory Management

ABORT INSTALL.REGISTER.INITS SERIAL2.AT.STARTUP
AUTOSTART MAIN SP!
BAUD1.AT.STARTUP NO.AUTOSTART STANDARD.MAP
BAUD2 NO.VITAL.IRQ.INIT STANDARD.RESET
CFA.FOR PAGE.TO.FLASH TO.FLASH
COLD PAGE.TO.RAM USE.SERIAL1
COLD.ON.RESET PRIORITY.AUTOSTART USE.SERIAL2
DEFAULT.REGISTER.INITS RESTORE WARM
DOWNLOAD.MAP SAVE WHICH.MAP
INIT.VITAL.IRQS.ON.COLD SERIAL1.AT.STARTUP WORDS
 

Library Functions That Disable Interrupts

This section summarizes the functions and macros that temporarily disable interrupts. These routines are summarized to assist you in planning the time-critical aspects of your application.

Certain Control-C library functions temporarily disable interrupts by setting the I bit in the condition code register. The glossary entries for these words detail the length of time that interrupts are disabled. These routines are summarized here to assist you in planning the time-critical aspects of your application.

The library provides a set of uninterruptable memory operators that disable interrupts for a few microseconds during the memory access. These are very useful in applications where several tasks or interrupt routines must access a shared memory location:

ChangeBits() ClearBits() ClearHighCurrent()
FetchFloatProtected() FetchLongProtected() PIAChangeBits()
PIAClearBits() PIASetBits() PIAToggleBits()
SetBits() SetHighCurrent() StoreFloatProtected()
StoreLongProtected() ToggleBits()

Accessing the PIA (Peripheral Interface Adapter) and LCD display require the insertion of wait states, and the architecture of the QED Board requires that interrupts be disabled while a wait state memory access is in progress. In addition to the PIA routines listed above, the following routines disable interrupts to insert wait states:

AskKeypad() AskKeypress() CharToDisplay()
ClearDisplay() CommandToDisplay() DisplayOptions()
InitDisplay() InitPIA() IsDisplayAddress()
Keypad() PIAFetch() PIAStore()
PutCursor() ScanKeypad() ScanKeypress()
StringToDisplay() STRING_TO_DISPLAY() UpdateDisplay()
UpdateDisplayLine() UpdateDisplayRam()

The multitasker mediates access to shared resources and ensures smooth transfer of information among tasks. The routines that manage resource variables and mailboxes must disable interrupts for short periods of time to ensure proper access to shared resources and messages. Consequently, the following routines temporarily disable interrupts:

FRECEIVE() FReceive() FSEND()
FSend() GET() Get()
RECEIVE() Receive() SEND()
Send() TryToFSend() TryToGet()
TryToSend() TRY_TO_FSEND() TRY_TO_GET()
TRY_TO_SEND()

Some of these routines also call Pause() to give other tasks a chance to run while waiting for a resource or message; as explained below, Pause() also disables interrupts. Consult their glossary entries for details.

The following routines temporarily disable interrupts to ensure that a new task is not corrupted while it is being built:

BuildTask() BUILD_C_TASK()

ReadElapsedSeconds() disables interrupts to ensure that the elapsed time clock is not updated while it is being read.

The multitasker is charged with smoothly transferring control among tasks via timeslicing or cooperative task switching. The timeslicer is an interrupt service routine associated with output compare#2. The timeslicer's interrupt service routine disables interrupts for the duration of a task switch which requires 25 microseconds, plus 3.25 microseconds for each ASLEEP task encountered in the task list. The cooperative task switch routine, Pause(), switches tasks in (27 + 3.25n) microseconds, where n is the number of ASLEEP tasks encountered in the round robin task list. Of this time, interrupts are disabled for (20 + 3.25n) microseconds.

The Pause() routine (which temporarily disables interrupts) is called by the following built-in device drivers:

ForthEmit() ForthKey() Emit()
Emit1() Emit2() Key()
Key1() Key2() Keypad()
ScanKeypad()

The following device driver routines GET() and RELEASE() resource variables, and so disable interrupts for short periods of time:

AD12Multiple() AD12Sample() AD12ToBuffer()
AD8Multiple() AD8Sample() AD8ToBuffer()
AskKey() AskKey1() AskKey2()
Emit() Emit1() Emit2()
ForthAskKey() ForthEmit() ForthKey()
Key() Key1() Key2()
PauseOnKey() SetDAC()

The battery-backed real-time clock option shares the RAM socket on the QED Board. While the "watch" is being read or set by the routines

ReadWatch() SetWatch()

the RAM cannot be accessed, so interrupts cannot be properly serviced. Therefore these routines disable interrupts for approximately 0.5 msec while the watch is being accessed.

All of the routines that write to the EEPROM disable interrupts for 20 msec per programmed byte. This results from the 68HC11's design which prohibits any EEPROM locations from being read while other EEPROM locations are being modified. Since all interrupts are vectored through EEPROM, interrupts cannot be serviced while an EEPROM storage operation is in progress. The following fundamental EEPROM storage functions:

StoreEEChar() StoreEEFloat() StoreEEInt() StoreEELong()

disable interrupts for 20 msec per programmed byte. These routines are smart enough to avoid programming a byte that already has the correct contents. The following routines may modify EEPROM locations:

ATTACH() Attach() Autostart()
ColdOnReset() DefaultRegisterInits() DownloadMap()
InitVitalIRQsOnCold() InstallMultitasker() InstallRegisterInits()
IsDisplay() NoAutostart() Serial1AtStartup()
Serial2AtStartup() StandardMap() StandardReset()
StartTimeslicer()

All of the routines that write to the Flash memory disable interrupts for 20 msec per programmed sector, where a standard sector is 256 bytes. This results from the flash architecture which prohibits any flash locations from being read while other flash locations are being modified. Since interrupts invoke flash-resident code, interrupts cannot be serviced while an flash storage operation is in progress. The following flash routines disable interrupts:

PageToFlash() PageToRAM() PriorityAutostart() ToFlash()

The following routines disable interrupts and do not re-enable them:

Cold() DISABLE_INTERRUPTS() Warm()

DISABLE_INTERRUPTS() and its assembly language counterpart SEI explicitly set the I bit in the condition code register. The routines ENABLE_INTERRUPTS and the assembler mnemonic CLI clear the I bit to globally enable interrupts. The restart routines Cold() and Warm() disable interrupts to ensure that the initialization process is not interrupted.

 
This page is about: Sorted Lists of C Language Library Functions, Controllers Based on 68HC11 Microcontroller, V4 Debugger and Configuration Functions, Functions that Disable Interrupts – Provides subject sorted lists of the C language library functions for Mosaic's controllers based on the 68HC11 microcontroller, including V4 debugger and configuration functions and functions that disable interrupts.
 
 
Navigation