Intellicom
User's Manual
PREV NEXT INDEX



4. Software

Dynamic C is an integrated development system for writing embedded software. It runs on an IBM-compatible PC and is designed for use with Z-World controllers and other controllers based on the Rabbit microprocessor.

Chapter 4 provides the libraries, function calls, and sample programs related to the Intellicom.

4.1 Dynamic C Libraries

With Dynamic C running, click File > Open, and select Lib. The following list of Dynamic C libraries and library directories will be displayed.


Two library directories are specific to the Intellicom.

Other functions applicable to all devices based on the Rabbit 2000 microprocessor are described in the Dynamic C Premier User's Manual.

4.1.1 Library Directories

The ICOM directory contains libraries required to operate the Intellicom unit.


The TCPIP directory contains libraries with generic TCP/IP functions.


The functions in these libraries are described in the Dynamic C TCP/IP User's Manual included in the manual set with the Dynamic C Premier User's Manual. Additional TCP/IP libraries are added on an ongoing basis.

4.2 Intellicom Function APIs

4.2.1 Board Initialization

void brdInit (void);

Initializes port registers for the operation of the board. Call this function at the beginning of the application.

Return Value

None

See Also

4.2.2 Digital I/O

void digOut (int channel, int value);

Sets the state of a digital output.

Parameters

channel is the output channel number (0, 1, 2, or 3).
value is the output value (0 or 1).

Return Value

None.

See Also

int digIn (int channel);

Reads the state of a digital input.

Parameters

channel is the input channel number (0, 1, 2, or 3).

Return Value

The state of the input (0 or 1).

See Also

4.2.3 Serial Communication

Library files included with Dynamic C provide a full range of serial communications support. The RS232.LIB library provides a set of circular-buffer-based serial functions. The PACKET.LIB library provides packet-based serial functions where packets can be delimited by the 9th bit, by transmission gaps, or with user-defined special characters. Both libraries provide blocking functions, which do not return until they are finished transmitting or receiving, and nonblocking functions, which must be called repeatedly until they are finished. For more information, see the Dynamic C Premier User's Manual and Technical Note 213, Rabbit 2000 Serial Port Software.

The following function calls are specific to the Intellicom.

int serMode (int mode);

User interface to set up up serial communication lines for the Intellicom board. Call this function after serXOpen().

Parameters

mode is the defined serial port configuration of the devices installed.

Return Value

0 if correct mode, 1 if not.

See Also

void serB485Tx();

Sets pin 3 (DE) high to disable Rx and enable Tx.

See Also

void serB485Rx();

Resets pin 3 (DE) low to enable Rx and disable Tx.

See Also

4.2.4 Keypad Controls

void keyProcess (void);

Scans and processes keypad data (up to 8 × 8 matrix) for key assignment, debouncing, press and release, and repeat. Provides debouncing, user-definable key code, separate press and release code (both optional), two- and three-speed auto repeat.

Return Value

None.

See Also

void keyConfig (char cRaw, char cPress, char cRelease, char cCntHold, char cSpdLo, char cCntLo, char cSpdHi );

Assigns user-defined keys to keypad positions. Defines ticks for key debouncing and speed.

Parameters

cRaw is the Raw Key Code Index, a 2 × 6 keypad matrix with the following raw keycode index assignments.
cPress is the Key Press Code, an 8-bit value returned when a key is pressed (0 = Unused). See keypadDef for default press codes.
cRelease is the Key Release Code, an 8-bit value to be returned when a key is released (0 = Unused).
cCntHold is Hold Ticks, how long to hold before repeating (0 = No Repeat).
cSpdLo is Low-Speed Repeat Ticks, how many times to repeat (0 = None).
cCntLo is Low-Speed Hold Ticks, how long to hold before going to high-speed repeat (0 = Slow Only).
cSpdHi isHigh-Speed Repeat Ticks, how many times to repeat after low-speed repeat (0 = None).

Return Value

None.

See Also

char keyGet (void);

Gets next keypress.

Return Value

The next keypress, or 0 if none.

See Also

void keyInit (void);

Initializes keypad process.

Return Value

None.

See Also

void keypadDef();

Configures keypad to default layout:
[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ . ]
[ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 0 ] [Enter]

Return Value

See Also

4.2.5 Display Controls

void dispContrast (char vcontrast);

Sets display contrast.

Parameters

Suggested values are 40-128 for high to low contrast, although 4-252 can be used. Contrast adjustment not supported on VFDs.

Return Value

None.

See Also

void dispCursor (unsigned int wStyle);

Sets cursor type: on, off, or blinking.

Parameters

wStyle is one of the following cursor macros:

Return Value

None.

See Also

void dispGoto (unsigned wX, unsigned wY);

Positions the cursor.

Parameters

wX is the column position, 0 to 19.
wY is the row position, 0 to 3.

Return Value

None.

See Also

void dispClear (void);

Clears the display and homes cursor.

Return Value

None.

See Also

void dispPutc (char cByte);

Puts a character on the display.

Parameter

cByte is the character to display.

Return Value

None.

See Also

void dispPrintf (char *pcFormat, ...);

Prints formatted string to the display, similar to printf call.

Parameter

pcFormat is the formatted string.

Return Value

None.

See Also

void dispOnoff (int onOff);

Turns the display on or off.

Parameters

Set or write 1 to turn the display on. Clear or write 0 to turn the display off.

Return Value

None.

See Also

void dispBacklight (int onOff);

Sets the backlight on or off. Not supported on VFDs.

Parameters

Set or write 1 to turn the backlight on. Clear or write 0 to turn the backlight off.

Return Value

None.

See Also

void dispInit();

Initializes the display. Specifically, the function reinitializes the display controller, clears the display, and puts a nonblinking underline cursor in the top left position.

Return Value

None.

See Also

4.2.6 Speaker Controls

void spkrOut (unsigned int wFreq, unsigned int wAmp );

Outputs speaker frequency and volume with various frequency and voltage values.

Parameters

wFreq--suggested frequency values are from 575 Hz to 3,000 Hz: for example, enter 1000 for 1 kHz. Values less than 575 (575 Hz) will be ignored.
wAmp--voltage amplitude (volume) values are 0, 1, 2, and 3: 0 = off, and 3 = loudest volume.

Return Value

None.

4.3 Sample Programs

Sample programs are provided in the Dynamic C Samples folder, which is shown below.


The various folders contain specific sample programs that illustrate the use of the corresponding Dynamic C libraries. For example, the sample program PONG.C demonstrates the output to the STDIO window.

The ICOM and TCPIP folders provide sample programs specific to the Intellicom board. Each sample program has comments that describe the purpose and function of the program. Follow the instructions at the beginning of the sample program.

Let's take a look at the ICOM folder.


The programs TCP_SEND.C and TCP_RESPOND.C are meant to be executed on two different Intellicom boards so that the two boards communicate with each other. In the absence of a second board, PCSEND.EXE (used with TCP_SEND.C) and PCRESPOND.EXE (used with TCP_RESPOND.C) in the SAMPLES\ICOM\WINDOWS directory can be used on the PC console side at the command prompt. Both the executables and the C source code are located in the WINDOWS directory.

Using PCSEND

PCSEND.C is the source code for PCSEND.EXE used on the PC console side to communicate with an Intellicom board. The executable PCSEND.EXE is similar to TCP_SEND.C, but is run at the command prompt to communicate with an Intellicom board running TCP_RESPOND.C.

Using PCRESPOND

PCRESPOND.C is the source code for PCRESPOND.EXE used on the PC console side to communicate with an Intellicom board. The executable PCRESPOND.EXE is similar to TCP_RESPOND.C, but is run at the command prompt to communicate with an Intellicom board running TCP_SEND.C.

4.4 Using Dynamic C

To run a sample program, open it with the File menu (if it is not still open), compile it using the Compile menu, and then run it by selecting Run in the Run menu. The Intellicom must be in Program mode (see Section 3.1, "Switching Between Program Mode and Run Mode") and must be connected to a PC using the programming cable as described in Section 4, "Programming Cable Connections".

More complete information on Dynamic C is provided in the Dynamic C Premier User's Manual. TCP/IP-specific functions are described in the Dynamic C TCP/IP User's Manual.


Z-World
http://www.zworld.com
Voice: (530) 757-3737
FAX: (530) 757-3792
sales@zworld.com
PREV NEXT INDEX