8.PMAC host computer-VC programming environment configuration

Source: Internet
Author: User

The knowledge above is pe-win32 in the operation, is aimed at the PMAC subordinate machine programming, now began to explain how the PMAC host computer--pc to communicate with PMaC: to the PMAC to send control signals and to deal with the interrupt response of PMAC. This paper first describes the environment configuration of PMAC VC programming.


1. Folder structure

PMAC PC programming must be installed PComm32, install the following folder structure:



Pmactest.exe is used to test the success of the current installation after PAMC press Finish, Pmactest is the source code of the program

Pcomm32pro. HLP is PComm32 's programming help manual

Vctest and Vbtest folder is a small demo of PC programming

Driver (Debug Version) folder is the various driver and dynamic link Library of PMAC and its import library, etc.

The interface header file for the Include file tail PMaC


2. Drive Structure Model

The contents of the Driver (Debug Version) folder are as follows


The Pcomm32.dll dynamic link library and the import library Pcomm32.lib,.sys are all the drivers of the various interfaces of PMAC.


The entire drive structure model of PMAC is as follows:


As you can see, we provide interface programming for dynamic-link libraries.


3. Code Demo

    • 1. Open the Vctest directory, you will find myRuntime.h and myRuntime.cpp files, together with the above Pcomm32.dll copied into the current project directory.
    • 2. Then add myRuntime.h and MyRuntime.cpp to the current project
    • 3. You can start using the


The simplest test procedure is as follows:

New MFC Program Pmacconnect,pmacconnectdlg.cpp Introduction header File

Add Pcomm Action Library header file # include "MyRuntime.h"
Add a button response, as follows:

void Cpmacconnectdlg::onconnect () {//Dynamically load Pcomm32.dll function if (NULL! = Openruntimelink ()) {AfxMessageBox (TEXT (" Load Pcomm32.dll successfully! "));} Else{afxmessagebox (TEXT ("Load Pcomm32.dll failed!")); return;} Open the specified card number PMAC, which opens the No. 0 card if (TRUE = = Openpmacdevice (0)) {AfxMessageBox ("Open PMaC succeeded!");} Else{afxmessagebox (TEXT ("Open PMaC failed!"));} Close to PMaC connection Closepmacdevice (0);//dynamic Close Pcomm32.dll use Closeruntimelink ();}


Here myRuntime.h and myRuntime.cpp encapsulated the dynamic load PComm.dll function, in fact, is LoadLibrary call, interested can see for themselves. This encapsulates only the common parts, the need for themselves to be modeled as a prototype of the corresponding function from the include/runtime.h to add encapsulation.

This is just to test the connection function, when actually writing the program, we need to initialize the connection at InitInstance or InitDialog, and close the connection when the program exits. In short, it is the first time to open and close one connection at a time, and it is not necessary to open and close each operation frequently.


Code Demo Download Link


Original, reprint please indicate from http://blog.csdn.net/wenzhou1219

8.PMAC PC-VC programming Environment configuration

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.