Application notes
Version 8 dated 15.03.00
191
Siemens Information and Communication Products
8.4.2.17
int WriteComm(idComDev, lpvBuf, cbWrite)
int idComDev;
/* identifier of comm. device
*/
const void FAR* lpvBuf;
/* address of data buffer
*/
int cbWrite;
/* number of bytes to write
*/
The WriteComm function writes to the specified communications device.
8.5
SW download (Version update)
The Flashloader functions under Windows 95/98/NT for updating and loading SW into the M20 module via the serial
interface of the M20Terminal. An implementation of SW download without using the M20T module is also described.
8.5.1
M20: HW setup
For Downloading SW into the M20 without the use of the M20T, following preparations have to be made to enable M20
to communicate with the PC via the serial interface cable.
Tools and components required:
If not already installed on the application a minimum serial interface 1) between the M20 and a computer is required.(The
signals RTS, CTS, DSR and DTR are not necessary for SW-update.)
Note
:
1) The signals RTS, CTS, DSR and DTR are not necessary for SW-update.
int WriteComm(idComDev, lpvBuf, cbWrite)
Parameter
Description
idComDev
Specifies the device to receive the bytes. The OpenComm function returns this value.
lpvBuf
Points to the buffer that contains the bytes to be written.
cbWrite
Specifies the number of bytes to be written.
Return value
The return value specifies the number of bytes written, if the function is successful.
< 0 if an error occurs, making the absolute value of the return value the number of bytes written.
Example
None
Comments
To determine what caused an error, use the GetCommError function to retrieve the error value and
status.
For serial ports, the WriteComm function deletes data in the transmission queue if there is not
enough room in the queue for the additional bytes. Before calling WriteComm, applications should
check the available space in the transmission queue by using the GetCommError function. Also,
applications should use the OpenComm function to set the size of the transmission queue to an
amount no smaller than the size of the largest expected output string.
See also
GetCommError, OpenComm, TransmitCommChar
M20 pins
Signal
Comments
18-22, 58-62
DC_IN
-
17, 23-25, 38, 43,
56, 57, 63-65
GND
-
8
IGNITION
Connect IGNITION to DC_IN
30
BOOTCODEEN
2
)
Provide a switch between BOOTCODEEN and POWER_ON.
74
POWER_ON
10
USCRX
A level shifter from 2.8 V logic to V.24/RS232 is required (must be
connected to pin 3 on a computers 9-pin Sub-D serial port)
72
USCTX
A level shifter from 2.8 V logic to V.24/RS232 is required (must be
connected to pin 2 on a computers 9-pin Sub-D serial port)