Moxa Technologies UC-7420/7410 user manual KeyPad, Baud rate inaccuracy, Special Note, Examples

Page 86

UC-7420/7410 User’s Manual

Programmer’s Guide

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 {

-

15

int

x; //

col

value,

the arrange is 0

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.

5-10

Image 86
Contents UC-7420/7410 User’s Manual Third Edition, JuneDisclaimer Copyright NoticeTrademarks Table of Contents Chapter UC Finder Appendix B Windows Tool Chain Introduction Introduction ‰ Hardware IntroductionOverview Package ChecklistProduct Features UC-7410-LXProduct Hardware Specifications Appearance Appearance and DimensionsHardware Introduction Dimensions LED Name Color Meaning Hardware Block DiagramLED Indicators Reset to default Button Reset-type ButtonsReset Button Real Time ClockPlacement Options Wall or CabinetDIN-Rail Mounting Wiring RequirementsHardware Connection Description Pin Signal Connecting the PowerConnecting to the Network Grounding UC-7420/7410CompactFlash Connecting to a Serial DeviceConnecting to the Console Port Pin RS-232 RS-422 RS-485Software Introduction Software ArchitectureJournaling Flash File System JFFS2 Software PackageSoftware Version Comparison Table Protocol stacks and utilities Directory Change‰ Configuring the Ethernet Interface Getting StartedSerial Console Powering on UC-7420/7410Connecting UC-7420/7410 to a PC 192.168.3.127 255.255.255.0 Default IP Address NetmaskTelnet Console 192.168.4.127 255.255.255.0SSH Console Windows UsersLinux Users Configuring the Ethernet InterfaceModifying Network Settings with the Serial Console Static IP addressesDynamic IP addresses Default IP address is 192.168.5.127, netmask Configuring the Wlan via the Pcmcia InterfaceModifying Network Settings over the Network IEEE802.11b#vi /etc/wlan/wlancfg-any IEEE802.11g Setting Explanation SettingKey1Str, Key2Str, Key3Str, Key4Str-Sets strings Key1 to Key4 TurboRate-Enables or disables TurboRate Checking the Flash Memory Space Installing the Tool Chain LinuxTest Program-Developing Hello.c StepCompiling Hello.c You should receive the following responseUploading Hello to UC-7420/7410 and Running the Program Testing EnvironmentDeveloping Your First Application Compiling tcps2.c #mount -t iso9660 /dev/cdrom /mnt/cdromUploading tcps2-release and Running the Program PuTTY#jobs // use this command to check if the program is running Testing Procedure Summary UC-7420/7410 User’s ManualUC-7420/7410 User’s Manual ‰ System Version Information ‰ System Image Backup Managing Embedded LinuxUpgrading the Firmware System Image BackupSystem Version Information Upgrading the firmware will erase all data on the Flash ROM#upramdisk #cd /mnt/ramdisk Loading Factory Defaults Firmware version V1.5 and later versions Backing Up the User File SystemFirmware versions earlier than V1.5 not including Enabling and Disabling Daemons UC-7420/7410 User’s Manual Managing Embedded Linux Setting the Run-Level Adjusting the System Time Setting the Time ManuallyUpdating the Time Automatically Example shell script to update the system time periodicallyNTP Client Enable the cron daemon manually Cron-daemon to Execute Scheduled CommandsChange mode of fixtime.sh Enable cron when the system boots upCF Mass Storage Connecting PeripheralsUSB Mass Storage Managing Communications ‰ Iptables ‰ NATEnabling the Telnet/ftp server Web Service-ApacheTelnet / FTP Disabling the Telnet/ftp serverUsr/www/cgi-bin Saving a Web Page to the CF Card Use the following commands to restart the Apache web server Iptables Local Host Packets Usage Observe and erase chain rulesDefine policy for chain rules ExamplesAppend or delete rules IptmacEnabling NAT at Bootup NAT ExampleDial-up Service-PPP Example 2 Connecting to a PPP server over a hard-wired link How to check the connection UP Loopback RunningNFS Network File System Setting up UC-7420/7410 as an NFS ServerSetting up a Machine for Incoming PPP Connections #vi /etc/exportsSetting up UC-7420/7410 as an NFS Client Mail Steps 2Open VPN Internet IFS=‘ Create link symbols to enable this script at boot time Destination Gateway Genmsk Flags Metric Use Iface Now ping Host B from Host a by typing Setup 3 Routed IP Destination Gateway Genmsk Flags Metric Use Iface Programmer’s Guide Linux Tool Chain Introduction Address Size ContentsFlash Memory Map Cross Compiling Applications and Libraries Debugging with GDBObtaining help Tools Available in the Host EnvironmentBuzzer Device APIRTC Real Time Clock WDT Watch Dog Timer Input Int fd File handle from swtdopen return value Output Special Note User application example ExampleSwtddisableswtdfd Int mainint argc, char *argv Pidt sonpid Example to set the baud rate Example to get the baud rateSpecial Note KeyPadBaud rate inaccuracy ExamplesMake File Example UC Finder Installing the Software Windows UC FinderUC-7420/7410 User’s Manual UC Finder Broadcast Search Linux ucfinder File manager System CommandsBusybox V0.60.4 Linux normal command utility collection EditorMoxa special utilities ProcessOther Windows Tool Chain Introduction Introduction Installation Procedure Select the Root DirectoryUC-7420/7410 User’s Manual Windows Tool Chain Introduction UC-7420/7410 User’s Manual Windows Tool Chain Introduction Using the Bash Shell GDB debug tool-Insight UC-7420/7410 User’s Manual Windows Tool Chain IntroductionUC-7420/7410 User’s Manual Windows Tool Chain Introduction Service Information Moxa Internet Services Following services are providedProblem Report Form Moxa Product † UC-7410-LX † UC-7420-LX Serial NumberProduct Return Procedure