![Eaton MVX9000 Series Скачать руководство пользователя страница 123](http://html1.mh-extra.com/html/eaton/mvx9000-series/mvx9000-series_user-manual_3986462123.webp)
Group 90 — Communications
MVX9000 User Manual
5-75
Descriptions of
Parameter Settings
Communication Program of PC
The following is a simple example of how to write a communication program for
Modbus ASCII mode on a PC using C language.
#include<stdio.h>
#include<dos.h>
#include<conio.h>
#include<process.h>
#define PORT 0x03F8 /* the address of COM1 */
/* the address offset value relative to COM1 */
#define THR 0x0000
#define RDR 0x0000
#define BRDL 0x0000
#define IER 0x0001
#define BRDH 0x0001
#define LCR 0x0003
#define MCR 0x0004
#define LSR 0x0005
#define MSR 0x0006
unsigned char rdat[60];
/* read 2 data from address 2102H of AC drive with address 1 */
unsigned char tdat[60]={':','0','1','0','3','2','1','0','2', '0','0','0','2','D','7','\r','\n'};
void main(){
int i;
outportb(PORT+MCR,0x08); /* interrupt enable */
outportb(PORT+IER,0x01); /* interrupt as data in */
outportb(PORT+LCR,(inportb(PORT+LCR) | 0x80));
/* the BRDL/BRDH can be access as LCR.b7==1 */
outportb(PORT+BRDL,12); /* set baudrate=9600, 12=115200/9600*/
outportb(PORT+BRDH,0x00);
outportb(PORT+LCR,0x06); /* set protocol, <7,N,2>=06H
<7,E,1>=1AH, <7,O,1>=0AH
<8,N,2>=07H, <8,E,1>=1BH
<8,O,1>=0BH */
for(i=0;i<=16;i++){
while(!(inportb(PORT+LSR) & 0x20)); /* wait until THR empty */
outportb(PORT+THR,tdat[i]); /* send data to THR */
}
i=0;
while(!kbhit()){
if(inportb(PORT+LSR) & 0x01){ /* b0==1, read data ready */
rdat[i++]=inportb(PORT+RDR); /* read data form RDR */
} } }
Содержание MVX9000 Series
Страница 2: ......
Страница 4: ...ii MVX9000 User Manual This page intentionally left blank ...
Страница 16: ...xiv MVX9000 User Manual This page intentionally left blank ...
Страница 124: ...Group 90 Communications 5 76 MVX9000 User Manual Descriptions of Parameter Settings This page intentionally left blank ...
Страница 133: ...MVX9000 User Manual A 1 Technical Data Appendix A Inside this chapter Technical Data Technical Data A 2 ...
Страница 139: ...MVX9000 User Manual B 1 Parameter Tables Appendix B Inside this chapter Parameter Tables MVX9000 Parameter Listing B 2 ...
Страница 168: ...Extension Input Output P N MVXEIO C 14 MVX9000 User Manual Accessories This page intentionally left blank ...
Страница 169: ...MVX9000 User Manual D 1 Dimensions Appendix D Inside this chapter Dimensions Digital Keypad D 2 Drives D 4 ...
Страница 174: ...D 6 MVX9000 User Manual Dimensions This page intentionally left blank ...
Страница 178: ...E 4 MVX9000 User Manual Declaration of Conformity This page intentionally left blank ...
Страница 179: ......