Recent

Author Topic: Reading Serial port data from Nortel/Meridian PBX how to decode?  (Read 47826 times)

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Reading Serial port data from Nortel/Meridian PBX how to decode?
« Reply #45 on: November 20, 2013, 11:46:28 pm »
Looking at your posted data, I have two more questions:

Do you think the number of bytes your app received is smaller/bigger compared with what it should receive, based on your previous results when it worked with the splitter?

Am I right that most of the bytes you received had their upper bits off, and many bytes were just zeros (all bits were off)?

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: Reading Serial port data from Nortel/Meridian PBX how to decode?
« Reply #46 on: November 21, 2013, 12:22:29 am »
when I run my app by itself on com1 the garbage data is smaller by far, but the good data does have a lot of whitespace.

I am thinking it's a issue of how synaser configs the com port, according to the monitor output the procomm/hyperterminal does a lot more with the handshaking.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Reading Serial port data from Nortel/Meridian PBX how to decode?
« Reply #47 on: November 21, 2013, 12:44:25 am »
Quote
when I run my app by itself on com1 the garbage data is smaller by far,...

That could happen if your app were running on a smaller Bits Per Second rate than it should be.


Quote
but the good data does have a lot of whitespace.

You mean a lot of $20 ( or 0010 0000 in binary, for a space char)? I wonder if some of these zeros I saw came from space chars after missing to read their single on bit.

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1290
Re: Reading Serial port data from Nortel/Meridian PBX how to decode?
« Reply #48 on: November 21, 2013, 01:18:05 am »
hello snorkel,

have you tried the component Tlazserial  here :
http://forum.lazarus.freepascal.org/index.php/topic,20481.msg118267.html#msg118267

with flowcontrol to fcXonXoff ? 

Friendly J.P
« Last Edit: November 21, 2013, 01:20:11 am by Jurassic Pork »
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

avra

  • Hero Member
  • *****
  • Posts: 2584
    • Additional info
Re: Reading Serial port data from Nortel/Meridian PBX how to decode?
« Reply #49 on: November 21, 2013, 08:40:27 am »
Was procomm sending a command to get the PBX to send the data?  I have no idea now.

Why don't you open ProComm, find out it's communication port settings (besides baudrate and the usual stuff something like RTS/CTS or XON/XOFF might be also important), and look at the script it uses for talking to PBX and try to replicate that. It shouldn't be too hard, VT100 or not. If I remember well ProComm scripting was fun to play with at the time, but that was ages ago. Maybe you can find some ProComm tutorial and take a look at it? http://www.google.com/search?ie=UTF-8&oe=utf-8&q=procomm+windows+tutorial. You can also try to install clean ProComm on a different PC and then try to talk to PBX without using any scripts that might exist in it's current configuration. That would help to clear things about ProComm using scripts, or you just need to emulate VT100 which PBX might check for before sending data.
« Last Edit: November 21, 2013, 08:44:58 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

tetrastes

  • Hero Member
  • *****
  • Posts: 755
Re: Reading Serial port data from Nortel/Meridian PBX how to decode?
« Reply #50 on: November 21, 2013, 08:58:58 am »
looks like my laz app is missing this:

Handflow: ControlHandShake=(DTR_CONTROL, ERROR_ABORT), FlowReplace=(AUTO_TRANSMIT, AUTO_RECEIVE, TRANSMIT_TOGGLE, RTS_CONTROL, XOFF_CONTINUE), XonLimit=80, XoffLimit=200

Not sure how to set this.

Smth like this

Code: [Select]
port.Config(9600, 8, 'N', SB1, true, false);   // set softflow
port.GetCommState;
port.dcb.XonLim := 80;
port.dcb.XoffLim := 200;
port.dcb.Flags := port.dcb.Flags or dcb_TXContinueOnXoff or dcb_AbortOnError;
port.SetCommState;

or you can set your settings in Config procedure in synaser.pas directly.

Also in noname.gif I see that Procomm has 'Script file: STARTUP'. May be you find smth usefull in this script. - Oh, I am late with this :)
« Last Edit: November 21, 2013, 09:50:29 am by tetrastes »

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: Reading Serial port data from Nortel/Meridian PBX how to decode?
« Reply #51 on: November 21, 2013, 05:07:05 pm »
Thanks everyone for you suggestions.  I have my lazarus service working now:

In/out queue size 4096/0
<20131121095051.702 SYS>
Set timeouts: ReadInterval=65535, ReadTotalTimeoutMultiplier=0, ReadTotalTimeoutConstant=0, WriteTotalTimeoutMultiplier=0, WriteTotalTimeoutConstant=0
<20131121095051.702 SYS>
RTS on
<20131121095051.702 SYS>
DTR on
<20131121095051.702 SYS>
Purge the serial port: RXABORT, RXCLEAR, TXABORT, TXCLEAR
<20131121095051.702 SYS>
Baud rate 9600
<20131121095051.702 SYS>
RTS on
<20131121095051.702 SYS>
DTR on
<20131121095051.702 SYS>
Data bits=8, Stop bits=1, Parity=None
<20131121095051.702 SYS>
Set chars: Eof=0x00, Error=0x00, Break=0x00, Event=0x00, Xon=0x0B, Xoff=0x0D
<20131121095051.702 SYS>
Handflow: ControlHandShake=(DTR_CONTROL, ERROR_ABORT), FlowReplace=(TRANSMIT_TOGGLE, RTS_CONTROL), XonLimit=1024, XoffLimit=1024
<20131121100133.271 RX>

The problem was my config was never getting used because I didn't know the config had to be called after the connect.  doh :-(
so it was defaulting to the system default which was all correct except it did not do the handshake at all.

Let consider this thread closed now :-)


***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

 

TinyPortal © 2005-2018