且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

RS-485通讯

更新时间:2023-02-07 22:33:23

这真的取决于您的BSP。阅读提供的文档或联系您的提供商。

This is really down to your BSP. Read the documentation provided or contact your provider.

COM端口号不会是1-4。您必须使用WIN32 API调用来实现通信。请看: -

The COM port number no dought will be from 1-4. You would have to use the WIN32 API calls to achieve communications. Look at :-

HANDLE WINAPI CreateFile(

  __in      LPCTSTR lpFileName,

  __in      DWORD dwDesiredAccess,

  __in      DWORD dwShareMode,

  __in_opt  LPSECURITY_ATTRIBUTES lpSecurityAttributes,

  __in      DWORD dwCreationDisposition,

  __in      DWORD dwFlagsAndAttributes,

  __in_opt  HANDLE hTemplateFile

);

HANDLE WINAPI CreateFile(
  __in      LPCTSTR lpFileName,
  __in      DWORD dwDesiredAccess,
  __in      DWORD dwShareMode,
  __in_opt  LPSECURITY_ATTRIBUTES lpSecurityAttributes,
  __in      DWORD dwCreationDisposition,
  __in      DWORD dwFlagsAndAttributes,
  __in_opt  HANDLE hTemplateFile
);

这将使您可以访问该端口,然后使用Read& WriteFile等有很多组件和例子可供查看。谷歌吧。

This will give you access to the port, then use Read & WriteFile etc. There are many components and examples out there to look at. Google it.