RS-232 loopback test

This page allows you to perform RS-232 loopback test using DMComPort coclass. When you click Test! button, the script embedded into this page opens selected COM port in the binary mode and writes to it 256 bytes (0..255). If RxD and TxD pins are properly connected, all these bytes will be immediately received and you will see confirmation message.

WARNING!!! Incorrect operation with RS-232 connector may result in unrecoverable hardware destruction (e.g. by electrostatic discharge). Before you try to attach anything to the RS-232 port, you must ensure that you exactly know connector pins layout. A good idea is to use 1 kOhm resistor to short-circuit RxD and TxD pins (#2 and #3 on D9 connector as shown on the photo) instead of paper clip, scissors or another metallic object that may unintentionally touch another pins.

RS-232 loopback

COM port #:  

For your convenience, source code of the script is shown below:

dim Buf(255), Idx
for Idx=0 to 255

sub TestBtn_onclick
dim A(255), I, S
  S=PortNum.value & ",9600,0,8,0,-1"
  if not ComPort.IsActive then ComPort.Open(S)
  for I=0 to 255
end sub

sub ComPort_OnRead(A)
dim I, F
  for I=0 to UBound(A)
  if Idx=256 then
    for I=0 to 255
      if Buf(I)<>I then F=false
    if F then MsgBox "RS-232 loopback test passed!"
  end if
end sub

sub window_onunload
  call ComPort.Close
end sub