⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 Moxa多串口卡驱动程序 供大家分享 谢谢
💻 TXT
字号:
Moxa CP-132 device driver under RTX

1.Introduction

this is the readme file for Moxa CP-132 driver application under RTX. It is compatible with CP-132 multiport card made by Moxa company. The driver is in .lib format. You do not need to load and unload RTX driver manually in the RTDLL format.

2.How to use

The package contains the .lib driver whose name is Moxa.lib. You can put it in your application's current directory or the defauft directory for Win32 and RTX .lib files. Then add the Moxa.lib in the "setting->link" option in MS VC++. Complie your own Moxa test. It will do well.

3.tutorial

The package includes a Moxa program which can verify the function of the Moxa APIs.In the application, the polled mode is first tested, then the interrupt mode.

The first API you will meet is:

1.int DeviceSearch (int vendorID,int deviceID,PCI_SLOT_NUMBER *pSlotNumber,PPCI_COMMON_CONFIG  PciData);
The vendorID and deviceID are the indentifiers which can point out the specific card we will use. You must declare pSlotNumber and PciData before this function in order to receive the information.

2.void DeviceInfo(ULONG busNumber,PCI_SLOT_NUMBER slotNumber,PPCI_COMMON_CONFIG pciData);
This function is optional which can get the device information. You can use this one for debug.

3.BOOL OpenMoxaPort(int port, int BandRate, int WordLength, int parity);
In order to use the Moxa card, you have to open the ports. OpenMoxaPort() is the function you can use. Concerning the int port veriable, value 1 means port 1 and value 2 means the 2nd port. The BandRate is from 50 to 56000. You can choose 5,6,7,8 to be Wordlength. They have corresponding stopbit which does not need to be set. Also, parity can be 1,2 which stand for odd and even parity.

4.BOOL OpenPolledMode(int port);
  BOOL OpenInterruptMode(ULONG busNumber,PCI_SLOT_NUMBER *pSlotNumber,PPCI_COMMON_CONFIG  PciData);
You can apply polled mode or interrupt mode for Moxa card. What you need to do is just use this API.

5.BOOL PutChar(int port, UCHAR c);
  UCHAR GetChar(int port);
In the polled mode, use PutChar() and GetChar() function for card read and write. the definition of the port is the same as OpenMoxaPort().

6.BOOL WriteMoxaPort(int port, UCHAR Buffer[]);
  BOOL ReadMoxaPort(int port, UCHAR Buffer[], int ReadByOffset);
In the interrupt mode, use WriteMoxaPort() and ReadMoxaPort() function for card read and write. the definition of the port is the same as OpenMoxaPort().
The write buffer is an array, the length of which is 1024. The read buffer is also an array, but the length is only 32. Every time you write the card, the write buffer refleshes. You must make sure the string you write contains the '\n' charactor!!
The read buffer is a ring buffer. When the buffer is full, the head of the buffer will be rewritten so that the data may lose... You must make sure you have read the buffer before the ring buffer is full.

You can refer to the test program for further consideration. If you have any more problem, please feel free to contact with Masterpiece Company.
 
 
Copyright by Rick Zhang, Beijing Masterpiece Company

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -