Rtc (real time clock), Buzzer, Uart interface – Moxa Technologies UC-7110 User Manual

Page 48

Advertising
background image

UC-7110 Series User’s Manual

UC-7110 Device API

5-2

RTC (Real Time Clock)

The device node is located at /dev/rtc. UC-7110 supports µClinux standard simple RTC
control. You must include <linux/rtc.h> to use these functions.

1. Function: RTC_RD_TIME

int ioctl(fd, RTC_RD_TIME, struct rtc_time *time);

Description: Reads time information from RTC.

2. Function: RTC_SET_TIME

int ioctl(fd, RTC_SET_TIME, struct rtc_time *time);

Description: Sets RTC time.

Buzzer

The device node is located at /dev/console. UC-7110 supports µClinux standard buzzer
control. UC-7110’s buzzer runs at a fixed frequency of 100 Hz. You must include <sys/kd.h>
to use these functions.

1. Function: KDMKTONE

ioctl(fd, KDMKTONE, unsigned int arg);

Description: Buzzer will beep, as stipulated by the function

arguments.

UART Interface

The normal tty device node is located at /dev/ttyM0…ttyM1, and modem tty device node is
located at /dev/cum0 … cum1. UC-7110 Series supports µClinux standard termios control. Moxa
UART Device API supports the configuration of ttyM0 to ttyM1 as RS-232/422/485. To use these
functions, after the Tool Chain package is installed, copy the file “CDROM/libuc7110/uc7110.h”
to the directory “/usr/local/arm-elf/include/” on your PC Linux, and then include <uc7110.h> in
your codes.

#define RS232_MODE 0

#define RS485_2WIRE_MODE

1

#define RS422_MODE 2
#define RS485_4WIRE_MODE

3

1. Function: MOXA_SET_OP_MODE

int mode;
mode=which mode you want to set;

int ioctl(fd, MOXA_SET_OP_MODE, &mode)

Description: Sets the interface mode.

2. Function: MOXA_GET_OP_MODE

int mode;
int ioctl(fd, MOXA_GET_OP_MODE, &mode)

Description: Gets the interface mode.

Advertising