نمایش نتایج 1 تا 4 از 4

نام تاپیک: serial port

  1. #1

    serial port

    می خوام به پورت serial اطلاعات بفرستم و بگیرم . چی کار کنم
    (کامل بگیدا)

  2. #2
    این کد توی دلفی هست
    https://barnamenevis.org/showth...highlight=hcom
    تبدیلش به builder هم که بلدی
    You never know what you can do until you try

  3. #3
    نه داداش شرمندتم بلد نیستم
    می شه بگی
    چاکرتم

  4. #4
    سلام
    دقیقا از سایت http://www.bcbdev.com/ کپی کردم.
    Q: Send and receive data from a serial port (RS-232) 

    Answer
    DOS programmers may be familiar with how to send and receive serial data by reading and writing directly from the port's hardware. In windows, you do not interface with the hardware directly. Instead, you use the CreateFile, ReadFile, and WriteFile API functions to send and receive data. The following code snippet demonstrates how to open a serial port and send the message "hello world".
    void __fastcall TForm1::Button1Click(TObject *Sender)
    {
    HANDLE hCom = CreateFile("COM1",
    GENERIC_READ | GENERIC_WRITE,
    0,
    NULL,
    OPEN_EXISTING,
    0,
    NULL );
    if(hCom)
    {
    DCB dcb;
    ZeroMemory(&dcb, sizeof(dcb));
    dcb.DCBlength = sizeof(dcb);
    dcb.BaudRate = 57600;
    dcb.ByteSize = 8;
    dcb.Parity = NOPARITY; // NOPARITY and friends are
    dcb.StopBits = ONESTOPBIT; // #defined in windows.h
    // Set the port properties and write the string out the port.
    if(SetCommState(hCom,&dcb))
    {
    DWORD ByteCount;
    const char *msg = "Hello world!";
    WriteFile(hCom,msg, strlen(msg),&ByteCount,NULL);
    }
    CloseHandle(hCom);
    }
    }
    This code example demonstrates how to get started with serial port programming in windows, but it is far from being complete. For more information, read the help section entitled "Communications" in the win32.hlp help file. The API provides a host of functions for configuring the port.
    Note: The communications API functions are not that easy to work with from code. You may want to explore using a class or component that encapsulates the serial port. Turbopower sells a product called AsyncPro that can be used for serial communication. There are also some freeware alternatives out there. I also have a a class that encapsulates the serial port. You can download it from the table below. My class is very simple, and probably not quite as powerful as some of the third party products that you can buy. But it does make it a lot easier to send and receive data when compared with the raw api calls. Note that my class is just that, a class. It is not a graphical component.

    موفق باشید

تاپیک های مشابه

  1. Serial Port
    نوشته شده توسط silentrise در بخش C#‎‎
    پاسخ: 3
    آخرین پست: دوشنبه 10 دی 1386, 06:57 صبح
  2. همه ی حاضران توجه کنند : خواندن از serial port بدون API
    نوشته شده توسط misytaz در بخش برنامه نویسی در 6 VB
    پاسخ: 0
    آخرین پست: چهارشنبه 24 مرداد 1386, 17:30 عصر
  3. serial port dar vb
    نوشته شده توسط saharfiroozabadi در بخش برنامه نویسی در 6 VB
    پاسخ: 2
    آخرین پست: دوشنبه 11 مهر 1384, 05:59 صبح
  4. سئوال حرفه ای در مورد Serial Port
    نوشته شده توسط ILOVEVB در بخش برنامه نویسی در 6 VB
    پاسخ: 5
    آخرین پست: یک شنبه 26 تیر 1384, 12:19 عصر
  5. Serial Port
    نوشته شده توسط ar_monti@ در بخش برنامه نویسی در Delphi
    پاسخ: 7
    آخرین پست: سه شنبه 30 فروردین 1384, 16:15 عصر

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •