Moxa Technologies EM-1240-LX user manual RTC Real-time Clock, Buzzer, Uart Interface

Page 49

EM-1240-LX User’s Manual

EM-1240-LX Device API

RTC (Real-time Clock)

The device node is located at /dev/rtc. The EM-1240-LX 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. The EM-1240-LX supports µClinux standard buzzer control. The EM-1240-LX’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/com0 … com1. The EM-1240-LX 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, include <moxadevice.h> in your application.

#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.

5-2

Image 49
Contents First Edition, November EM-1240-LX User’s ManualCopyright Notice Table of Contents Chapter EM-1240-LX Device API Introduction Product Features Package ChecklistOverview EM-1240-LXHardware Specifications Product SpecificationsSoftware Specifications EM-1240 Development Kit Embedded Module Hardware Block Diagram AppearanceEM-1240 Embedded Module EM-1240 Development Kit Dimensions LED Indicators Installing the EM-1240-LXWiring Requirements Connecting the Power Connecting Data Transmission CablesGrounding the EM-1240-LX Connecting to a Serial Device Connecting to the NetworkInternal SD Socket Reset ButtonAdditional Functions Serial Console PortReal-time Clock Getting Started Connecting the EM-1240-LX to a PC Powering on the EM-1240-LXConsole Port Telnet Default IP Address Default Netmask192.168.3.127 255.255.255.0 192.168.4.127 255.255.255.0Configuring the Ethernet Interface Dhcpcd -p -a eth0 & dhcpcd -p -a eth1 Ifconfig eth0Installing a Secure Digital SD Memory Card Developing Your Applications Installing the EM-1240-LX Tool ChainStep #mount -t iso9660 /dev/cdrom /mnt/cdromEM-1240-LX User’s Manual PATH=/usr/local/arm-elf/bin$PATH Compiling Hello.c#make Uploading Hello to the EM-1240-LX# chmod 755 hello #./hello Running Hello on the EM-1240-LXCflags = Make File Example CodeSoftware Package EM-1240-LX Software Architecture Journaling Flash File System JFFS2 Flash Context Flash Address Size Access controlAdditional information about JFFS2 is available at Bin Dev EM-1240-LX Software PackagePtyp0 Ppp Pio Rtc Ram1 Ram0 Null Kmem Mem Cua0 Console Tty ‰ Iptables ‰ NAT Configuring the EM-1240-LXEnabling and Disabling Daemons Example default enableAdding a Web Default Home Page addressLocal Host Packets Usage Define policy rules, and Append or delete rulesExamples Define policy for chain rules NAT Example Enabling NAT at BootupConfiguring PPPoE Configuring Dial-in/Dial-out ServiceDial-out Service Dial-in ServiceDynamic Driver Module Load/Unload How to Mount a Remote NFS ServerUpgrading the Kernel Ramdiskupkernel em1240-1.x.bin /ramdiskrebootUpramdisk Cd ramdiskUpramdisk Cd ramdisk Upgrading the Root File System & User DirectoryRamdiskbackupfs /ramdisk/usrdisk-backup User Directory Backup-EM-1240-LX to PCMirroring the Application Program and Configuration Loading Factory DefaultsAutostarting User Applications on Bootup Checking the Kernel and Root File System VersionsCat /etc/version FsversionEM-1240-LX Device API Buzzer RTC Real-time ClockUart Interface UC Finder Windows UC Finder EM-1240-LX User’s Manual UC Finder EM-1240-LX User’s Manual UC Finder Linux UC Finder Busybox µClinux normal command utility collection System CommandsFile manager EditorProcess NetworkOther Moxa Special UtilitiesSnmp Agent with MIB II & RS-232 Like Group Ip MIB Tcp MIB Udp MIB Snmp Agent with MIB II & RS-232 Like GroupRFC1317 RS-232 like group supported variables Rs232 MIB Snmp MIBEM-1240-LX FAQ Service Information Following services are provided Moxa Internet ServicesMoxa Product † EM-1240-LX Serial Number Problem Report FormProduct Return Procedure