Python calls moxa Pcomm Lite send files via serial Ymodem protocol _python

Source: Internet
Author: User

This article describes the Python call Moxa Pcomm Lite a method for sending files via the Serial Ymodem Protocol, which is written using Python 2.7. The main contents are as follows:

After a long search, finally found the moxa Pcomm Lite. Call PCOMM.DLL can be very convenient through the serial port Xmodem, Ymodem, Zmodem and other protocols to transfer files, without the need to repeat the manufacture of wheels.

Pcomm Lite 1.6 for systems such as Win7, as a DLL file can use any support to invoke the DLL programming language such as VC + +, VB, QT and so on to write applications, point this site download

Here is the Python code at the end of the transmitter:

#encoding =utf-8 from

ctypes import *

dll = Windll. LoadLibrary ("Pcomm.") DLL ")

port = 2 # Specifies serial port COM2

dll.sio_open (Port

, 0x00 | 0x03 | 0x00) # 57600, no checksum, 8-bit data bits, 1-bit Stop bit

def CB (Xmitlen, Buflen, Pbuf, Flen):
  print Xmitlen, Flen,
  print return 
  xmitlen CALLBACK

= Winfunctype (C_int, C_long, C_int, Pointer (C_char), c_long)

CCB = CALLBACK (CB)

dll.sio_ftymodemtx (port, "e:\ Test.jpg ", CCB, 0)

Dll.sio_close (port)

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.