| MiniCom (OP6800) User's Manual |
4. Software
Dynamic C Premier is an integrated development system for writing embedded software. It runs on an IBM-compatible PC and is designed for use with Z-World single-board computers and other devices based on the Rabbit microprocessor.
Chapter 4 provides the libraries, function calls, and sample programs related to the OP6800.
You have a choice of doing your software development in the flash memory or in the static RAM included on the OP6800. The advantage of working in RAM is to save wear on the flash memory, which is limited to about 100,000 write cycles.
NOTE An application can be developed in RAM, but cannot run standalone from RAM after the programming cable is disconnected. All standalone applications can only run from flash memory. The disadvantage of using flash memory for debug is that interrupts must be disabled for approximately 5 ms whenever a break point is set in the program. This can crash fast interrupt routines that are running while you stop at a break point or single-step the program. Flash memory or RAM is selected on the Options > Compiler menu.
Dynamic C Premier provides a number of debugging features. You can single-step your program, either in C, statement by statement, or in assembly language, instruction by instruction. You can set break points, where the program will stop, on any statement. You can evaluate watch expressions. A watch expression is any C expression that can be evaluated in the context of the program. If the program is at a break point, a watch expression can view any expression using local or external variables.
4.1 Programming Cable
The programming cable has a level converter board in the middle of the cable since the OP6800 programming port supports CMOS logic levels, and not the higher voltage RS-232 levels that are used by PC serial ports. When the programming cable is connected, Dynamic C running on the PC can hard-reset the OP6800 and cold-boot it. The cold boot includes compiling and downloading a BIOS program that stays resident while you work. If you crash the target, Dynamic C will automatically reboot and recompile the BIOS if it senses that a target communication error occurred or that the BIOS source code has changed.
4.1.1 Switching Between Program Mode and Run Mode
The OP6800 is automatically in Program Mode when the programming cable is attached, and is automatically in Run Mode when no programming cable is attached. See Figure 17.
4.1.2 Detailed Instructions: Changing from Program Mode to Run Mode
1. Disconnect the programming cable from header J1 of the OP6800 module.
2. Reset the OP6800 by unplugging the AC adapter, then plugging it back in.
The OP6800 is now ready to operate in the Run Mode.
4.1.3 Detailed Instructions: Changing from Run Mode to Program Mode
1. Attach the programming cable to header J1 of the OP6800 module.
2. Reset the OP6800 by unplugging the AC adapter, then plugging it back in. Alternatively, you may press <Ctrl-Y> on your PC if Dynamic C is running.
The OP6800 is now ready to operate in the Program Mode.
4.2 OP6800 Libraries
With Dynamic C running, click File > Open, and select Lib. The following list of Dynamic C libraries and library directories will be displayed.
![]()
Four library directories provide function calls that are specific to the OP6800 or to its features.
- OP6800--libraries associated with OP6800 serial communication, I/O, and initialization. The functions in the OP68xx.LIB library are described in Appendix D, "OP6800 Function APIs."
- DISPLAYS\GRAPHIC--libraries associated with the LCD display. The functions in these libraries are described in Appendix D, "OP6800 Function APIs."
- KEYPADS-libraries associated with the keypad. The functions in these libraries are described in Appendix D, "OP6800 Function APIs."
- TCPIP--libraries specific to using TCP/IP functions.
Other generic functions applicable to all devices based on the Rabbit 2000 microprocessor are described in the Dynamic C Premier User's Manual.
4.2.1 TCP/IP Libraries
The TCPIP directory contains libraries with generic TCP/IP functions for the OP6800.
- ARP.LIB--address resolution protocol functions.
- BOOTP.LIB--bootstrap protocol functions.
- BSDNAME.LIB--BSD-style socket routines.
- DCRTCP.LIB--TCP/IP functions.
- DNS.LIB--handles host name resolution.
- FTP_CLIENT.LIB--FTP client functions.
- FTP_SERVER.LIB--FTP server functions.
- HTTP.LIB--HTTP handler.
- ICMP.LIB--ICMP handler.
- IP.LIB--handles the network layer (just above the link layer and the device driver).
- MD5.LIB--implements the MD5 algorithm defined in TCP/IP RFC 1321.
- NET.LIB--general networking API. This is the "top-level" library for the networking library suite. It includes the packet-driver interface.
- PKTDRV.LIB--packet driver functions.
- POP3.LIB--POP3 functions.
- REALTEK.LIB--packet driver functions for the RealTek RTL8019AS.
- SMTP.LIB--SMTP handler.
- TCP.LIB--transmission control protocol.
- UDP.LIB--user datagram protocol.
- VSERIAL.lib--virtual Telnet functions.
- ZSERVER.lib--miscellaneous TCP/IP server data structures and routines.
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.
4.3 Sample Programs
Sample programs are provided in the Dynamic C Samples folder. The sample program PONG.C demonstrates the output to the STDIO window.
The various directories in the Samples folder contain specific sample programs that illustrate the use of the corresponding Dynamic C libraries.
The OP6800 folder provides sample programs specific to the OP6800. Each sample program has comments that describe the purpose and function of the program. Follow the instructions at the beginning of the sample program.
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 OP6800 must be in Program mode (see Section 4.1, "Programming Cable,") and must be connected to a PC using the programming cable as described in Section 2.1, "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. Information on using the TCP/IP features and sample programs is provided in Section 5, "Using the TCP/IP Features."
4.3.1 Board ID
The following sample program can be found in the SAMPLES\OP6800 subdirectory.
- BOARD_ID.C--Detects the type of single-board computer and displays the information in the STDIO window. For the OP6800, the STDIO window should show OP6800.
4.3.2 Demonstration Board
The following sample programs are found in the DEMO_BD subdirectory in SAMPLES\OP6800.
- BUZZER.C--Demonstrates the use of the buzzer on the Demonstration Board. Remember to set the jumper across pins 1-2 of header JP1 on the Demonstration Board (see Figure C-4) to enable the buzzer on. When you finish with BUZZER.C, it is recommended that you reconnect the jumper across pins 2-3 of header JP1 on the Demonstration Board to disable the buzzer.
- KEYPAD.C--Flashes the LED above a keypad button when the corresponding keypad button is pressed. The corresponding LED on the Demonstration Board will also flash if a keypad button in the top row of the keypad is pressed. A message is also displayed on the LCD.
- SWITCHES.C--Flashes the LED on the Demonstration Board and the OP6800 when the corresponding pushbutton switch on the Demonstration Board is pressed. A message is also displayed on the LCD.
4.3.3 Digital I/O
The following sample programs are found in the IO subdirectory in SAMPLES\OP6800.
- DIGIN.C--Demonstrates the use of the digital inputs. By pressing a pushbutton switch on the Demonstration Board, you can view an input channel toggle from HIGH to LOW on your PC monitor. The four pushbutton switches correspond to IN00-IN03 on the OP6800. IN04-IN12 can also be toggled by momentarily grounding the inputs.
- DIGOUT.C--Demonstrates the use of the sinking high-current outputs. By pressing a pushbutton switch on the Demonstration Board, you can view an output channel toggle the corresponding LEDs on/off. The four pushbutton switches correspond to OUT07-OUT10.
4.3.4 Serial Communication
The following sample programs are found in the RS232 subdirectory in SAMPLES\OP6800.
- PUTS.C--Transmits and then receives an ASCII string on Serial Ports B and C. It also displays the serial data received from both ports in the STDIO window.
- RELAYCHR.C--This program echoes characters over Serial Port B to Serial Port C. It must be run with a serial utility such as Hyperterminal.
The following sample programs are found in the RS485 subdirectory in SAMPLES\OP6800.
- MASTER.C--This program demonstrates a simple RS-485 transmission of lower case letters to a slave OP6800. The slave will send back converted upper case letters back to the master OP6800 and display them in the STDIO window. Use SLAVE.C to program the slave OP6800.
- SLAVE.C--This program demonstrates a simple RS-485 transmission of lower case letters to a slave OP6800. The slave will send back converted upper case letters back to the master OP6800 and display them in the STDIO window. Use MASTER.C to program the master OP6800.
4.3.5 LCD/Keypad Module Sample Programs
The following sample programs are found in the 122x32_1x7 subdirectory in SAMPLES\LCD_Keypad.
- ALPHANUM.C--Demonstrates how to create messages using the keypad and then displaying them on the LCD display.
- COFTERMA.C--Demonstrates cofunctions, the cofunction serial library, and using a serial ANSI terminal such as Hyperterminal from an available COM port connection.
- DISPPONG.C--Demonstrates output to LCD display.
- DKADEMO1.C--Demonstrates some of the LCD/keypad module font and bitmap manipulation features with horizontal and vertical scrolling, and using the GRAPHIC.LIB library.
- FUN.C--Demonstrates drawing primitive features (lines, circles, polygons) using the GRAPHIC.LIB library
- KEYBASIC.C--Demonstrates the following keypad functions in the STDIO display window:
- - default ASCII keypad return values.
- - custom ASCII keypad return values.
- - keypad repeat functionality.
- KEYMENU.C--Demonstrates how to implement a menu system using a highlight bar on a graphic LCD display. The menu options for this sample are as follows.
- 1. Set Date/Time
- 2. Display Date/Time
- 3. Turn Backlight OFF
- 4. Turn Backlight ON
- 5. Toggle LEDs
- 6. Increment LEDs
- 7. Disable LEDs
- LED.C--Demonstrates how to toggle the LEDs on the LCD/keypad module.
- SCROLLING.C--Demonstrates scrolling features of the GRAPHIC.LIB library.
- TEXT.C--Demonstrates the text functions in the GRAPHIC.LIB library. Here is a list of what is demonstrated.
- 1. Font initialization.
- 2. Text window initialization.
- 3. Text window, end-of-line wraparound, end-of-text window clipping, line feed, and carriage return.
- 4. Creating 2 different TEXT windows for display.
- 5. Displaying different FONT sizes.
4.3.6 TCP/IP Sample Programs
TCP/IP sample programs are described in Chapter 5.
4.4 Font and Bitmap Converter
A Font and Bitmap Converter tool is available to convert Windows fonts and monochrome bitmaps to a library file format compatible with Z-World's Dynamic C applications and graphical displays. Non-Roman characters can also be converted by applying the monochrome bitmap converter to their bitmaps.
Start the Font and Bitmap Converter tool by double-clicking on the fbmcnvtr.exe file in the Dynamic C directory. You then select and convert existing fonts or bitmaps. Complete instructions are available via the Help menu that is in the Font and Bitmap Converter tool.
Once you are done, the converted file is displayed in the editing window. Editing may be done, but should not be necessary. Save the file as libraryfilename.lib, where libraryfilename is a file name of your choice.
Add the library file(s) to applications with the statement #use libraryfilename.lib, or by cutting and pasting from the library file(s) you created into the application program.
NOTE If you used the #use libraryfilename.lib statement, remember to enter libraryfilename.lib into lib.dir, which is located in your Dynamic C directory. You are now ready to add the font or bitmap to your application using the glXFontInit or the glXPutBitmap function calls.
| Z-World http://www.zworld.com Voice: (530) 757-3737 FAX: (530) 757-3792 sales@zworld.com |