1. 程式人生 > >Pcomm使用例項程式碼

Pcomm使用例項程式碼

#include "stdafx.h"
#include <Windows.h>    
#include "PComm.h"
#include <stdio.h>
#include <tchar.h>
#include <SDKDDKVer.h>
#pragma comment(lib, "PCOMM.lib")

int port = 3;

int _tmain(int argc, _TCHAR* argv[])
{


		char str;
		int status = sio_open(port);

		if (status == SIO_OK)
		{
			sio_ioctl(port, B115200, P_NONE | BIT_8 | STOP_1);
		}
		else
		{
			return 0;
		}
		int i = 32;
		str = (char)i;
		sio_write(port, &str, 1);
		i = i + 18;
	return 0;
}