Table of Contents

Lab09 - Terminal thread command interface

This excersise provides description of the PC based application and requirements related to this application. The app is expected to join all the previously explained components together. Mainly it will use these parts:

The final application will be named: NucTer.

Requirements

The application will allow for:

Hints

This section provides some advices related to single tasks.

Thread

Command line interface

The application will allow to pass these paramters on the command line:

Standard and error outputs

The standard output will be used for user interaction. The error output will be used to report problems with serial port access (open, read, write, close) and commands problems, e.g. wrong command reporting: lab10.

Input file and its flow control

The input data set is just a list of commands in a text file which will be read one by one and send to the device. The responses will be available through standard and error output.

The flow control file will alow for usign the predefined data sets and sending specific commands to the device in relation with the user actions - mainly the joystick movements.

The flow control file is divided into sections:

// comment line 
#label:PartA: //start of a block

#label:PartB:

#label:PartC:

#label:PartD:

Every section will use a set of commands

// comment line 
#label:PartA: //start of a block
*IDN?
LED OFF
#goto:PartB:

#label:PartB:

or the commands can be read from external file

// comment line 
#label:PartA: //start of a block
#include:InitDataSet.txt: // the TXT file contains just a list of commands, e.g.: "*IDN?\nLED OFF\n"

#label:PartB:

The flow control is controlled mainly by the joystic unit

// comment line 
#label:PartA: //start of a block
#include:InitDataSet.txt: // the TXT file contains just a list of commands, e.g.: "*IDN?\nLED OFF\n" 

#label:PartB:
#include:IntroDataSet2.txt: // e.g.: "DRAW:SETFONT 12\nDRAW:TEXT 64,120,Press: Up or Down,1\n" 
// wait for joystick for 5 seconds - if no action then use JOY_NONE = it will go to else section
#wait_for_joystick:5000:JOY_NONE:
#if:JOY_UP:goto:PartD:
#if:JOY_DOWN:goto:PartC:
#else:goto:PartB:

#label:PartD:
// nothing, file is finished and the app closes itself
#exit:

#label:PartC
DRAW:CLEAR 2
DRAW:SETTEXTCOLOR 3 
DRAW:CIRCLE 49,20,10
DRAW:CIRCLE 79,20,10
DRAW:SETTEXTCOLOR 2 
DRAW:LINE 55,40,60,45 
DRAW:LINE 68,45,73,40 
DRAW:LINE 60,45,68,45 
DRAW:SETFONT 12
DRAW:TEXT 64,120,Nucleo RULEZ!,1
DRAW:TEXT 64,120,Press Left or Right!,1
// no parameter for #wait_for_joystick = wait forewer
#wait_for_joystick:
#if:JOY_LEFT:goto:PartA:
#if:JOY_RIGHT:goto:PartB:
#else:goto:PartC: