Saturday 25 February 2017

Cypress PSoC VT100 Code Example

Summary
As an alternative interface to one of my projects, basic VT100 functionality was implemented across serial (USB) on a Cypress PSoC4 BLE device. The Cypress iprintf code was used with a wrapper to implement basic VT100 features.

The screen capture below shows basic control of text and colour.

VT100 Example in TeraTerm
VT100 Example in TeraTerm

As a starting reference the
Bash Hackers website was used for the VT100 escape codes. A plethora of information can be found at sites such as Technopedia, TermSys, NorthEastern Uni, ASCII-Table and ISP to name a handful. What has been provided is only a portion of the total VT100 commands available.

Code for the PSoC
For Cypress Creator development environment a separate VT100 source and header file were created with the necessary escape commands.


VT100 Commands
VT100 Commands
Foreground and background colors.


VT100 Colours
VT100 Colours

Cypress already provide a PSoC Creator example project with iprintf, which works effectively as the low level interface. A reference to this library was included in VT100 code.

To use a number of commands at once or to configure the location of the cursor a few functions were written, prototypes below. There is room to improve these functions but for testing they function as required.


VT100 Function Prototypes
VT100 Function Prototypes

Usage in the software main shown below.

VT100 Example Usage
VT100 Example Usage


Testing
Testing was also performed with other terminal packages such as PuTTY and RealTerm.

VT100 Example in PuTTY (Windows)
VT100 Example in PuTTY (Windows)
TermPuTTY under Ubuntu Mate, customised settings

VT100 Example in PuTTY (Ubuntu Mate)
VT100 Example in PuTTY (Ubuntu Mate)

RealTerm was placed in ANSI mode with good results, except for the colours.

VT100 Example in RealTerm
VT100 Example in RealTerm

Downloads


vt100.c
vt100.c

vt100.h
vt100.h



Change Summary

Version 1.02 (15 March 2017)
  • Added GPL details
  • Corrected two text command enumerations
  • Updated PSoC Creator project
Version 1.01 (11 March 2017)
  • Added defines for background colour
  • Changed names of foreground colour defines
  • Updated PSoC Creator project
Version 1.00 (26 February 2017)
  • Created PSoC Creator project for initial vt100 commands


1 comment: