Virtual Console

From CANopen-Lift
Jump to navigation Jump to search
CANopen Terminal


CANopen virtual terminal for CiA 417, Object 600Ah

Tip: The Object 600Ah for the virtual terminal will be defined as CiA 417 V 1.0.5. That means that there are some changes to the initial proposal with the object 1026h (CiA 301).


General

A CANopen device can be used or controlled using the Object 600Ah. The display and the keyboard are located in another CANopen appliance (Virtual Terminal)

The mentioned Object should always be included in the drive unit.

There are 2 remote control channels:

  • An input channel (stdin), and
  • an output channel (stdout)


 Object 600Ah Subindex 1 is stdin (Standard-input: Keyboard)
 Object 600Ah Subindex 2 is stdout (Standard-output: screen)

If the signs Object 600Ah, subindex 2 are ready the device send output to the virtual termnial. The zero sign (0) means no sign available. The control sequences VT-52 can be used to control the cursors.

To control a key manually the keycode (1...225) should be written in the Object 600Ah, subindex 1. Some keys will be send as escape keys (VT-52).


Data exchange process via SDO

The output device (virtual terminal) polls the Object 600Ah, subindex 2 cyclically. If it reads a char different than zero (0), it will be displayed on the terminal. The control sequences VT-52 will be used to control the cursor.

If there are no chars available, the polling time could be longer.

To manually control a key a keycode will be written in the Object 600Ah, subindex 1.


Data exchange process via MPDO

There is the posibility of using in- and output data via MPDO to accelerate the process.

Display-output (Device -> Virtual terminal):

 COB-ID:       0x500 + Node-ID device
 Lenght:        8 Bytes
 Address:      Node-ID device (Source)
 Multiplexor:  600Ah, Subindex 2
 Data:         DWORD up to 4 characters

Keyboard input (Virtual Terminal -> device):

 COB-ID:       0x500 + Node-ID virtual terminal
 Lenght:        8 Bytes 
 Address:      0x80 + Node-ID device (Destination)
 Multiplexor:  600Ah, Subindex 1
 Data:         DWORD up to 4 characters

To switch-on the display-output via MPDO the virtual terminal sends either a number different from zero (0) or Cntrl-A (01h). Cntrl-A activates the time monitoring, that means that the virtual terminal has to send a keycode (eg, Cntrl-A) almost every second. If the device does not recieve any sign in 4s the display-output will be switched-off.

To deactivate the display-output, the virtual terminal sends Cntrl-D (04h) or, if the time monitoring (Cntrl-A) is on, the virtual terminal is automatically switched-off when it does not recieve any sign.

In order not to overload the bus, one should not send more than 2 MPDO pro 10ms (inhibit timer 5 ms)

Character set

The character set ISO-8859-15 (siehe ISO-8859-15) can be used to enconde the characters (umlauds)

Keyboardcodes (Virtual keys)

The following ASCII-codes can be use to control the menu:

Dez. Hex Char Meaning
24 0x18 CAN End key (Cntrl-X)
45 0x2D '-' Minus key
43 0x2B '+' Plus key
13 0x0D CR Enter key
27 65 0x1B 0x41 ESC A up arrow key
27 66 0x1B 0x42 ESC B Down arrow key
27 67 0x1B 0x43 ESC C right arrow key
27 68 0x1B 0x44 ESC D left arrow key
27 80 0x1B 0x50 ESC P F1 key
27 81 0x1B 0x51 ESC Q F2 key
27 82 0x1B 0x52 ESC R F3 key
27 83 0x1B 0x53 ESC S F4 key


The device decides itself how to read the keys. Its assumed that not all the virtual terminals send all the keys.

Minimun requirements for the VT52 control sequences

Code Name Meaning
ESC A Cursor up The cursor will move up one line. If it is y in the first row there will not be any reaction.
ESC B Cursor down The cursor will move down one line. If it is in the last row, there will no be any reaction.
ESC C Cursor right The cursor will move one row to the left. Total right, no reaction.
ESC D Cursor left The cursor will move one row to the left. Total left, no reaction.
ESC E Clear home The screen will be switched-off, the cursor will go up to the left.
ESC H Cursor home The cursor will go up to the left.
ESC I Cursor up and insert The cursor moves up one row . If it is in the first row, an empty row will show up. The following rows descend.
ESC J Clear to end of frame The screen will be switched off from the cursor.
ESC K Clear to end of line The rows will be cleared from the cursor to the end.
ESC L Inser line New rows will be inserted by the cursor row. The rest of the screen will move one line down.
ESC M Delete line Clears the row where the cursor is. The other lines move up. The last one will be cleared.
ESC Yyx Move Cursor Move the cursor to the line y and the column x. 32 should always be added at the X and Y position . (x = 0 ... 19, y = 0 ... 3)
ESC e Cursor on Switch-on the cursor
ESC f Cursor off Switch-off the cursor
ESC j Store cursor The current position of the cursor will be saved.
ESC k Restore cursor The cursor will move to the position stored with ESC j.
ESC l Clear line The cursor row will be cleared up. Then the cursor goes to the start line.
ESC o Clear line to cursor The cursor row will be cleared up from the start to the cursor.

Proposal for new control sequences

With a new command, the possibility should be created, the properties of the output and input device (terminal) to ask.

The device shall transmit

 ESC Z = Identify terminal type

The controller/terminal shall answer

 ESC [<a_rows>;<a_colums>;<g_rows>;<g_colums>;<keymap>] = Terminal features
 
 a_rows, a_columns:  ASCII-Mode Count rows/columns
 g_rows, g_colums:   Graphics-Mode Count rows/columns
 keymap:             0 = normal/standard, 1 = cursor keys (up, down, left right), 2 = +/- keys (end, -, +, CR)

Example:

 ASCII-Mode only and standard keys:    ESC [4;20]
 ASCII-Mode only and cursor-keys:      ESC [4;20;;;1] oder ESC [4;20;0;0;1]
 Graphics-mode and standard-key:       ESC [4;20;64;128]
 Graphics-mode and cursor-keys:        ESC [4;20;64;128;1]

Additionally to enter graphics mode, a command is required:

 ESC g = Enter graphic mode