Chapter 4 Software Development

This concludes the description of Port 7. To use the port, manipulate the above registers within the program. For further details on registers for other ports and Port 7 operation, refer to Chapter 5 in the MSM6657 Family User's Manual.

4-4-2. Changing LED2 Color

The next page gives sample code (port7exp.c) that changes the color of the LED connected to Port 7.

This sample program calls std_init_573(), a support function for initializing the MSM66Q573 on the JOB60851 board, so be sure to include the corresponding source code file (stdrw573.c) on the compiler command line.

CL665S /T m66573 /H /WIN port7exp.c stdrw573.c l66ks50s.lib <Enter>

This sample program uses the secondary function, serial port, for Port 7's lowest four bits to send character strings to the terminal emulator running on the host personal computer by setting the lower halves of Port Mode (P7IO) and Port Secondary Function Control (P7SF) Registers to the following values.

P7IO

=

0xC2;

/*

1100_-010

*/

/* Configure Port 7 pin 1 for output */

P7SF

=

0x03;

/*

0000_-011

*/

/* Configure Port 7 pins 1 and 0 for secondary function */

See Section 4.5 "Standard I/O over Serial Link" below for a different approach.

page 4-24

Page 59
Image 59
Oki JOB60851 user manual Changing LED2 Color