Table of Contents

24.1.5.2 RS232 Terminal Projects

Two RS232 terminal projects are presented to you. It has proved advantageous for the authors to use the terminal projects as a starting point for application programs with the serial RS232 interface, in which they are adapted, extended or specialized.

24.1.5.2.1 Terminal Project 1

The first project is an extensively tested and fully functional example for the use of Gambas for serial (RS232) communication. The source code is licensed under the Creative Common License and can be adapted as a basis for own applications. The following characteristics characterize the project:

BILD 1
Figure 24.1.5.2.1: Dialog for configuring the serial interface

BILD 2
Figure 24.1.5.2.2: Sending text

24.1.5.2.2 Terminal Project 2

The second project is based on project 1 and does without a separate dialog for setting the transfer parameters. It is integrated into the main window. No settings of the serial interface and window positions are saved. There are some enhancements in the functional scope:

BILD 3
Figure 24.1.5.2.3: Sending ASCII text

The source code section for displaying received text is interesting if it is utf8-encoded. The basis of the conversion is the understanding of how characters are encoded in Unicode - with the subset UTF8. The following pages describe this coding in a very understandable way:

The complete source code for both terminal projects can be found in the download area.

24.1.5.3 RS232 Project

The attached project for the long-term measurement of temperatures is a project that has been developed in its current version on the basis of the two presented RS232 terminal projects. The special feature of this project is that control is only possible via the context menu of the tray icon and the temperature values read out can be saved in a log file.

Download