Using RS-232 and Printing to LCD

From Mech
Revision as of 18:46, 28 May 2006 by Hwang (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Getting Started

1.Plug the Seetron BPI-216 LCD display into the COM1 serial port of the target PC, and power the display (see the LCD display’s user’s guide for more information) If you wish to use COM2, see “Changing COM Ports” later in this article.

2.Copy the file RS232Async_Messages.m into your work folder. This file contains a struct that holds configuration parameters for the RS232_Send block within the BPI_216_Send subsystem. Open the BPI_216_Send.mdl file and copy the BPI_216_Send block into your own model. The other blocks in BPI¬_216_Send.mdl are just for demonstration purposes.

3.To output text to the BPI-216 LCD display using the BPI_216_Send block, the system that is deciding which message to output needs to output an integer of data type “double” (see “double” in the MATLAB help files for more information on data types). The BPI_216_Send subsystem will read this integer and display the corresponding message. Note: the default time step of BPI_216_Send is 0.01 seconds. BPI_216_Send’s time step need to be an integer multiple of your main system’s time step.

Figure 1 shows how to hook up the system: File:Figure1.jpg Figure 1

4. Open BPI_216_Send, and then open Message Bank/Selector. Find the switch-case control structure in the embedded MATLAB function. This is where we will store the messages. See Figure 2: