beautypg.com

Keypad, Baud rate inaccuracy, Examples – Moxa Technologies UC-7420/7410 User Manual

Page 86

background image

UC-7420/7410 User’s Manual

Programmer’s Guide

5-10

Baud rate inaccuracy

Divisor = 921600/Target Baud Rate. (Only Integer part)
ENUM = 8 * (921600/Targer - Divisor) ( Round up or down)
Inaccuracy = (Target Baud Rate – 921600/(Divisor + (ENUM/8))) * 100%
E.g.,
To calculate 500000 bps
Divisor = 1, ENUM = 7,
Inaccuracy = 1.7%
*The Inaccuracy should less than 2% for work reliably.

Special Note

1. If the target baud rate is not a special baudrate (e.g. 50, 75, 110, 134, 150, 200, 300, 600, 1200,

1800, 2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800, 921600), the termios
cflag will be set to the same flag.

2. If you use stty to get the serial information, you will get speed equal to 0.

LCM

UC-7420/7410 only supports text mode display, with screen size of 16 cols by 8 rows. The device
node is /dev/lcm. See the examples given below. We provide a private struct defined as follows:

typedef struct lcm_xy {

int x;

// col value, the arrange is 0 - 15

int y;

// raw value, the arrange is 0 - 7

} lcm_xy_t;

Examples

int ioctl(fd, IOCTL_LCM_GOTO_XY, lcm_xy_t *pos);

Move the cursor position to x(col),y(raw) position. The argument 3 is the new position value.

int ioctl(fd, IOCTL_LCM_CLS, NULL);

Clears the LCM display.

int ioctl(fd, IOCTL_LCM_CLEAN_LINE, NULL);

To change one line to all spaces in the current row, and move the cursor to the 0 column of this
row.

int ioctl(fd, IOCTL_LCM_GET_XY, lcm_xy_t *pos);

Get the current cursor position. The value will be returned in argument 3.

int ioctl(fd, IOCTL_LCM_BACK_LIGH_ON, NULL);

Turns the LCM back light on.

int ioctl(fd, IOCTL_LCM_BACK_LIGHT_OFF, NULL);

Turns the LCM back light off.

KeyPad

The device node is /dev/keypad. The key value is defined in moxadevice.h.

int ioctl(fd, IOCTL_KEYPAD_HAS_PRESS, int *flag);

Checks how many keys have been pressed. Argument 3 returns the number of pressed keys. 0
means no keys were pressed.

int ioctl(fd, IOCTL_KEYPAD_GET_KEY, int *key);

Gets the value of the last key that was pressed. This functions only reads one key value for each
function call. The value of the key value is returned in argument 3.