Moxa DA-683-DPP-T-W7E [31/35] Sin _gettchar n _tstoi sin do switch n if char 1 display the di do status case 1 open device hdiodev mxdgio_open for inti 0 i di_port_number i get digital input port_no i ndata mxdgio_get_input_signal hdiodev port_no _tprintf _t di d d r n port_no ndata
![Moxa DA-683-DPP-T-W7E [31/35] Sin _gettchar n _tstoi sin do switch n if char 1 display the di do status case 1 open device hdiodev mxdgio_open for inti 0 i di_port_number i get digital input port_no i ndata mxdgio_get_input_signal hdiodev port_no _tprintf _t di d d r n port_no ndata](/views2/1199564/page31/bg1f.png)
Sample Code for Digital I/O Control
Below we reproduce the LED control code. This is a simple function that
u
u
s
s
e
e
r
r
s
s
m
m
a
a
y
y
f
f
r
r
e
e
e
e
l
l
y
y
m
m
o
o
d
d
i
i
f
f
y
y
t
t
o
o
s
s
u
u
i
i
t
t
t
t
h
h
e
e
i
i
r
r
n
n
e
e
e
e
d
d
s
s
.
.
/* Copyright (C) MOXA Inc. All rights reserved.
This software is distributed under the terms of the
MOXA License. See the file COPYING-MOXA for details.
*/
#include "stdafx.h"
#include <windows.h>
#include "..\\Include\\mxdev.h"
#define DI_PORT_NUMBER 4
#define DO_PORT_NUMBER 4
int _tmain(intargc, _TCHAR* argv[])
{
HANDLE hDioDev;
intport_no;
int data;
intnData = 0;
intnRet = 0;
int port = 0;
int mode = 0;
int n = 0;
TCHAR sin;
TCHAR smode;
_tprintf(_T("DIO Test Program\r\n"));
_tprintf(_T("\t (0) Exit Program\r\n"));
_tprintf(_T("\t (1) Display DO & DI\r\n"));
_tprintf(_T("\t (2) Set DO value\r\n"));
sin = _gettchar();
n = _tstoi(&sin);
do
{
switch (n)
{
// if char == '1', display the DI/DO status
case 1:
// Open device
hDioDev = mxdgio_open();
for (inti = 0; i< DI_PORT_NUMBER; i++)
{
// Get digital input
port_no = i;
nData = mxdgio_get_input_signal( hDioDev, port_no);
_tprintf(_T("DI[%d] = %d\r\n"), port_no, nData);
}
Содержание
- Da 683 windows embedded standard 7 software manual 1
- First edition april 2014 1
- Www moxa com product 1
- Copyright notice 2
- Da 683 windows embedded standard 7 software manual 2
- Disclaimer 2
- Technical support contact information 2
- Trademarks 2
- Www moxa com support 2
- Table of contents 3
- Introduction 4
- Software components 5
- System initialization 6
- Attention 7
- Create a new user account 7
- Enabling embedded filters 8
- Enhanced write filter 9
- Overview 9
- Enabling enhanced write filter 10
- Committing data and or disabling ewf 11
- Configuring file based write filter 12
- File based write filter 12
- Overview 12
- Excluding files from fbwf protection 14
- Managing temporary files cached in the overlay 16
- Customizable sample code 17
- Sample code for customizing the da 683 18
- The dio control walkthrough 18
- The led control walkthrough 19
- C programs example 20
- The watchdog control code walkthrough 20
- Watchdog control code 20
- System recovery 21
- Overview setting up the recovery environment 22
- Recovery 22
- Step 1 prepare the usb drive 22
- Tuxboot windows 23 exe 22
- Attention 23
- F home partimag 23
- Recovery os_image 23
- Step 2 setting the bios to boot via usb 23
- F home partimag 24
- Step 3 opt create a custom system image 24
- Home partima 25
- Warning 26
- Step 4 reset bios to original state 27
- Step 5 perform a test restoration 28
- A sample code for da 683 customization 30
- Sample code for da 683 customization 30
- Include include mxdev h define di_port_number 4 define do_port_number 4 int _tmain intargc _tchar argv handle hdiodev intport_no int data intndata 0 intnret 0 int port 0 int mode 0 int n 0 tchar sin tchar smode _tprintf _t dio test program r n _tprintf _t t 0 exit program r n _tprintf _t t 1 display do di r n _tprintf _t t 2 set do value r n 31
- Sample code for digital i o control 31
- Sin _gettchar n _tstoi sin do switch n if char 1 display the di do status case 1 open device hdiodev mxdgio_open for inti 0 i di_port_number i get digital input port_no i ndata mxdgio_get_input_signal hdiodev port_no _tprintf _t di d d r n port_no ndata 31
- Copyright c moxa inc all rights reserved 33
- Include include mxdev h define led_port_number 8 int _tmain intargc _tchar argv handle hleddev intport_no int data intnled 0 intnret 0 int port 0 int mode 0 int n 0 tchar sin tchar smode _tprintf _t led test program r n _tprintf _t t 0 exit program r n _tprintf _t t 1 display led r n _tprintf _t t 2 set led value r n 33
- Sample code for led control 33
- Sin _gettchar n _tstoi sin do switch n if char 1 display the led output status case 1 open device hleddev mxgpio_open for inti 0 i led_port_number i get digital input port_no i nled mxgpio_get_data hleddev port_no _tprintf _t led d d r n port_no nled 33
- This software is distributed under the terms of the 33
- The watchdog control sample code 35
Похожие устройства
- Moxa DA-683-DPP-T-W7E Руководство по программной части (Linux)
- Moxa DA-683-DPP-T-W7E Руководство по программной части (Windows)
- Moxa DA-683-SP-LX Инструкция по эксплуатации
- Moxa DA-683-SP-LX Руководство по быстрой установке
- Moxa DA-683-SP-LX Технические характеристики
- Moxa DA-683-SP-LX Руководство по программной части (Windows 7)
- Moxa DA-683-SP-LX Руководство по программной части (Linux)
- Moxa DA-683-SP-LX Руководство по программной части (Windows)
- Moxa DA-683-SP-XPE Инструкция по эксплуатации
- Moxa DA-683-SP-XPE Технические характеристики
- Moxa DA-683-SP-XPE Руководство по быстрой установке
- Moxa DA-683-SP-XPE Руководство по программной части (Windows)
- Moxa DA-683-SP-XPE Руководство по программной части (Linux)
- Moxa DA-683-SP-XPE Руководство по программной части (Windows 7)
- Moxa DA-683-SP-W7E Инструкция по эксплуатации
- Moxa DA-683-SP-W7E Технические характеристики
- Moxa DA-683-SP-W7E Руководство по быстрой установке
- Moxa DA-683-SP-W7E Руководство по программной части (Windows)
- Moxa DA-683-SP-W7E Руководство по программной части (Linux)
- Moxa DA-683-SP-W7E Руководство по программной части (Windows 7)