本文介绍了WINDOWS.H使用Visual Studio中的串行通信的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的视觉工作室我想转接和接收LPC2148套件一些数据thisI想做Visual Studio中的串行通信。

I m new to the visual studio I want to trnsfer and receive some data from LPC2148 kit for thisI want to do the serial communication in Visual studio.

我在使用TURBOC DOS.H
Bios.h也用于相同的目的,但这些都是对Turbo.C编译

I have used dos.h in turboCBios.h is also used for the same purpose but those are for Turbo.C compiler

在Visual Studio中我找到了一个头文件中的Windows API是writen,但我不知道如何使用它,请帮助

In visual studio I have found a header files Windows in api are writen but I don't know how to use it please help

推荐答案

在Win32的串行通信没有特别照顾,该API是有点麻烦,使用,但在的。

Serial comms in Win32 is not particularly well catered for, the API is somewhat cumbersome to use but is dealt with fairly comprehensively in this article on MSDN.

在.NET 2.0(或更高版本)框架包括一个极好的和易于使用的串行通信类,使整个过程更简单,但你需要使用C ++ / CLI或C#或其他.NET语言来访问这一点。

The .Net 2.0 (and later) Framework includes an excellent and easy to use serial communications class that makes the whole process much simpler, but you'll need to use C++/CLI or C# or some other .NET language to access that.

有关非常简单的串行I / O,你可以随时使用标准输入输出,简单地打开COM * N *设备,其中的 N 的是你要打开的端口号。标准输入输出提供任何手段来设置波特率和成帧等,但是这可以容易地通过经由系统呼叫调用模式命令来实现。这是原油和缺少API级接口的灵活性,但仍足以满足您的需求进行快速和肮脏的解决方案。例如:

For very simple serial I/O you can always use stdio and simply open the COM*n* device where n is the port number you wish to open. Stdio provides no means to set baud rate and framing etc., but this can easily be achieved by invoking the mode command via a system call. It is crude and lacks the flexibility of the API level interface, but may be adequate for your needs for a quick-and-dirty solution. For example:

system( "MODE COM1: BAUD=115200 PARITY=n DATA=8 STOP=1" ) ;
FILE port = fopen( "COM1:", "wb" ) ;
fprintf( port, "hello, world!\n" ) ;
fclose( port ) ;

这篇关于WINDOWS.H使用Visual Studio中的串行通信的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-28 01:23