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)