如何使用MAXQ串行驱动程序开发应用-How to Use

[09-13 17:04:22]   来源:http://www.88dzw.com  控制技术   阅读:8871

文章摘要:Abstract: The application note demonstrates how to configure the MAXQ2000 microcontroller EV kit and MAXQ development environment for serial communication. Sample code in C demonstrates the usage and limitations of the MAXQ serial driver, and how to implement RTS/CTS flow control using the MAXQ seri

如何使用MAXQ串行驱动程序开发应用-How to Use,标签:计算机控制技术,工厂电气控制技术,http://www.88dzw.com
Abstract: The application note demonstrates how to configure the MAXQ2000 microcontroller EV kit and MAXQ development environment for serial communication. Sample code in C demonstrates the usage and limitations of the MAXQ serial driver, and how to implement RTS/CTS flow control using the MAXQ serial driver.

Introduction

This application note describes how to develop applications using the MAXQ serial driver library on the MAXQ2000 microcontroller evaluation (EV) kit. The MAXQ serial driver is available for the IAR Embedded Workbench® for MAXQ and Rowley Associates' CrossWorks for MAXQ, two integrated development and debugging environments for MAXQ applications using C and assembly languages. Sample code in C demonstrates MAXQ serial-driver usage and limitations, and how to implement RTS/CTS flow control using the MAXQ serial driver.

MAXQ Serial-Driver Overview

The MAXQ serial driver provides a set of C functions which enable the user to configure the MAXQ UART for serial communication. These functions are listed in the source file, maxq_serial.h, supplied in the MAXQ2000 EV kit.

The MAXQ serial driver provides the following features.
  1. Even, odd, and none parity.
  2. Separate transmit and receive internal buffers. The size of these buffers is defined at compile time.
  3. Non-blocking serial_write and serial_read routines.
  4. A serial_isr() function that should be called as part of the interrupt handler by the user application. It computes the parity as "per configuration" and transmits/receives the data on the serial line.
  5. Support for the flow control at the application level. The function serial_stopTx() stops the transmission of serial data, and serial_restartTx() restarts the serial transmission.
The source code for the MAXQ2000 serial driver is available here. The driver can be ported for other MAXQ devices by modifying a few configuration parameters as follows.
  1. maxq_config.h contains compiler-specific configuration parameters. Modify the following lines in the file to suit your device and compiler:
    // user configurable options here
    #define COMPILER_IAR
    #define DEVICE_MAXQ2000
    
    The above two lines specify that the driver will be compiled for IAR and MAXQ2000. To compile the driver for CrossWorks for MAXQ, modify the lines as below:
    // user configurable options here
    #define COMPILER_ROWLEY
    #define DEVICE_MAXQ2000
    
  2. The above two lines let the user include device-specific files for either the IAR or CrossWorks tool chains. maxq_serial.h contains driver-specific configuration parameters: driver buffer size, serial-port number, and crystal frequency in Hz. Change the following code to change the driver buffer size:
    #define RX_RNG_SIZE 256
    #define TX_RNG_SIZE 256
    
    Modify the following code to specify the serial port (SERIAL_PORT0 for serial port 0, SERIAL_PORT1 for serial port 1) for which you want the driver configured:
    // specify which serial port you are using
    #define SERIAL_PORT0
    
    Modify the following code to change the crystal clock used for the EV kit. The MAXQ2000 EV kit uses a 16MHz crystal:
    #define XTAL_CLK 16000000             // 16,000,000Hz
    

Hardware and Software Requirements

To run the application provided in this application note, you need a MAXQ2000 EV kit, a +5V power supply with minimally 200mA capacity, a PC with two serial ports (one for downloading the application onto the EV kit, and the other for communication between the MAXQ application and PC application), a straight-through serial cable, the MAXQ development tool set (IAR Embedded Workbench or CrossWorks 1.0), and the Java™ runtime environment on your PC (including the commApi and BlackBox example).

[1] [2] [3]  下一页


Tag:控制技术计算机控制技术,工厂电气控制技术控制技术