To: The HP-VEE Reflector
From: Tomas Tungel
Ericsson Infocom Systems AB
etxtomt@tn.ericsson.se
Subject: Communication over RS232
RS232 Communication - DATA LOST IN TRANSFER TO VEE
--------------------------------------------------
I have a problem concerning communication over the RS232. We are
using HP-VEE 3.12 primary on a HP-UX system HP9000s300. We need
to implement a piece of code that can communicate with a shell
controlled program on a microprocessor over RS232. We are running
on 9600 baud, n81. The shells commandprompt is a ">". The data
returned at command looks like this:
"text
"
"text
"
">"
We think that the most simple way to recieve the data is to
get the messages character by character (because we don't get
a string terminator "
" for the prompt line) - long strings
(using ">" as string terminator) does not work (we get a
timeout instead!). We don't wan't to timeout the prompt because
sometimes we have to wait pretty long for an answer from the
microprocessor (like a difficult RAM-test).
The problem occurs when we recieve a lot of data to VEE from the
RS232 interface. It might be easy to illustrate it by showing
you a transfer:
Send from processor:
====================
********** Select from items below **************
R size addr (length) ....... : Read memory, size=B||W||L
W size addr data (length) .. : Write memory, size=B||W||L
S x [ y .. z ] ........ .... : test Sequence
L x ........................ : Number of Loop laps
T x [ y .. z ] ............. : set Trigger
G .......................... : Go
E [ON||OFF] ................ : Echo mode
O [V || T || A] ............ : Output mode
M [G || T] ................. : Test mode
C .......................... : Continue
H .......................... : Help
D .......................... : Display setup
B baudrate ................. : Set baudrate
DL [offset] ................ : Download SREC
IDTF startaddress........... : Install DTFs
VER ........................ : Version of this program
1 ......................... : Short RAM test
2 ......................... : Long RAM test
3 ......................... : Checksumtest of PROM
4 ......................... : In file:MyTest.c Testfunction subtest
5 ......................... : In file:MyTest.c Testfunction walktest
>
Recieved in VEE:
================
*****................... : Help
D .......................... : Display setup
B baudrate ................. : Set baudrate
DL [offset]................. : DownLoad SREC file
IDTF startaddress .......... : Install DTFs
VER ........................ : Version of this program
1 ......................... : Short RAM test
2 ......................... : Long RAM test
3 ......................... : Checksumtest of PROM
4 ......................... : In file:MyTest.c Testfunction subtest
5 ......................... : In file:MyTest.c Testfunction walktest
What we return each time we try is different, but it always
look pretty similar - it goes fine in the beginning, then we
lose some data and then it seems to be ok again...
We checked that all data is transfered through the cable by using
an external RS232 LINE MONITOR when running in VEE - no data seems
to be missing "outside" VEE.
We have also checked the transfers using a BUS I/O Monitor for the
RS232 in HP-VEE and the data that appears there seems to be similar
to what our VEE-program thinks that it recieves.
We have tried to write a piece of code in RMB Basic that does
the same thing and it works fine! We recieve all data. This is
an extract of the RMB-program:
720 Sc=9 ! Set Sc to Serial9
730 ASSIGN @Serial TO Sc
740 ASSIGN @Buffer TO BUFFER Temp$
800 CONTROL Sc,0;1 ! Reset the RS232 port
810 CONTROL Sc,3;9600 ! Set BAUD rate to 9600
820 CONTROL Sc,4;IVAL("00011",2) ! Set communications to n,8,1
830 CONTROL Sc,12;32 ! Turn off handshake
890 OUTPUT Sc USING "+,K";Command$ ! Send command
910 TRANSFER @Serial TO @Buffer;DELIM ">",WAIT ! Transfer message to buffer
920 ENTER @Buffer USING "#,-K";Temp$ ! Enter message to Temp$
950 Length=LEN(Temp$) ! otherwise return error
960 IF Temp$[Length,Length]=">" THEN
970 Error$=""
980 ELSE
990 Error$="ERROR IN "&Command$
1000 END IF
1020 FOR N=1 TO Length-1 ! Change LF+CR to CR+LF
1030 IF Temp$[N,N+1]=CHR$(10)&CHR$(13) THEN
1040 Temp$[N,N+1]=CHR$(13)&CHR$(10)
1050 END IF
1060 NEXT N
1080 Message$="Command: "&Temp$[1,Length-1] ! Message in order without ">"
Finally we tried the VEE-program on a demo version of HP-VEE 3.2
for PC and IT WORKED fine there (but a bit slow)!!! This is the
character by character-program and not reading strings. But CR and LF
is displayed in a log-window - shall I strip this or can it be
displayed correctly?
What is wrong here? How should we write our program to avoid a
timeout and long data processing? How can we make a VEE-program that
works like the RMB-program?
Thanks in advance!!!
/Tomas
=============================================================================
Addr: ERICSSON TELECOM AB Mail: etxtomt@tn.ericsson.se
Attn Tomas Tungel WWW: http://www.geocities.com/Athens/1660
TN/ETX/XA/KD Tel: +46 8 7192658
S-126 25 STOCKHOLM Fax: +46 8 7197503
SWEDEN Exch: +46 8 7190000
To: The HP-VEE Reflector
From: Tomas Tungel
Ericsson Infocom Systems AB
etxtomt@tn.ericsson.se
Subject: Communication over RS232
RS232 Communication - DATA LOST IN TRANSFER TO VEE
--------------------------------------------------
I have a problem concerning communication over the RS232. We are
using HP-VEE 3.12 primary on a HP-UX system HP9000s300. We need
to implement a piece of code that can communicate with a shell
controlled program on a microprocessor over RS232. We are running
on 9600 baud, n81. The shells commandprompt is a ">". The data
returned at command looks like this:
"text
"
"text
"
">"
We think that the most simple way to recieve the data is to
get the messages character by character (because we don't get
a string terminator "
" for the prompt line) - long strings
(using ">" as string terminator) does not work (we get a
timeout instead!). We don't wan't to timeout the prompt because
sometimes we have to wait pretty long for an answer from the
microprocessor (like a difficult RAM-test).
The problem occurs when we recieve a lot of data to VEE from the
RS232 interface. It might be easy to illustrate it by showing
you a transfer:
Send from processor:
====================
********** Select from items below **************
R size addr (length) ....... : Read memory, size=B||W||L
W size addr data (length) .. : Write memory, size=B||W||L
S x [ y .. z ] ........ .... : test Sequence
L x ........................ : Number of Loop laps
T x [ y .. z ] ............. : set Trigger
G .......................... : Go
E [ON||OFF] ................ : Echo mode
O [V || T || A] ............ : Output mode
M [G || T] ................. : Test mode
C .......................... : Continue
H .......................... : Help
D .......................... : Display setup
B baudrate ................. : Set baudrate
DL [offset] ................ : Download SREC
IDTF startaddress........... : Install DTFs
VER ........................ : Version of this program
1 ......................... : Short RAM test
2 ......................... : Long RAM test
3 ......................... : Checksumtest of PROM
4 ......................... : In file:MyTest.c Testfunction subtest
5 ......................... : In file:MyTest.c Testfunction walktest
>
Recieved in VEE:
================
*****................... : Help
D .......................... : Display setup
B baudrate ................. : Set baudrate
DL [offset]................. : DownLoad SREC file
IDTF startaddress .......... : Install DTFs
VER ........................ : Version of this program
1 ......................... : Short RAM test
2 ......................... : Long RAM test
3 ......................... : Checksumtest of PROM
4 ......................... : In file:MyTest.c Testfunction subtest
5 ......................... : In file:MyTest.c Testfunction walktest
What we return each time we try is different, but it always
look pretty similar - it goes fine in the beginning, then we
lose some data and then it seems to be ok again...
We checked that all data is transfered through the cable by using
an external RS232 LINE MONITOR when running in VEE - no data seems
to be missing "outside" VEE.
We have also checked the transfers using a BUS I/O Monitor for the
RS232 in HP-VEE and the data that appears there seems to be similar
to what our VEE-program thinks that it recieves.
We have tried to write a piece of code in RMB Basic that does
the same thing and it works fine! We recieve all data. This is
an extract of the RMB-program:
720 Sc=9 ! Set Sc to Serial9
730 ASSIGN @Serial TO Sc
740 ASSIGN @Buffer TO BUFFER Temp$
800 CONTROL Sc,0;1 ! Reset the RS232 port
810 CONTROL Sc,3;9600 ! Set BAUD rate to 9600
820 CONTROL Sc,4;IVAL("00011",2) ! Set communications to n,8,1
830 CONTROL Sc,12;32 ! Turn off handshake
890 OUTPUT Sc USING "+,K";Command$ ! Send command
910 TRANSFER @Serial TO @Buffer;DELIM ">",WAIT ! Transfer message to buffer
920 ENTER @Buffer USING "#,-K";Temp$ ! Enter message to Temp$
950 Length=LEN(Temp$) ! otherwise return error
960 IF Temp$[Length,Length]=">" THEN
970 Error$=""
980 ELSE
990 Error$="ERROR IN "&Command$
1000 END IF
1020 FOR N=1 TO Length-1 ! Change LF+CR to CR+LF
1030 IF Temp$[N,N+1]=CHR$(10)&CHR$(13) THEN
1040 Temp$[N,N+1]=CHR$(13)&CHR$(10)
1050 END IF
1060 NEXT N
1080 Message$="Command: "&Temp$[1,Length-1] ! Message in order without ">"
Finally we tried the VEE-program on a demo version of HP-VEE 3.2
for PC and IT WORKED fine there (but a bit slow)!!! This is the
character by character-program and not reading strings. But CR and LF
is displayed in a log-window - shall I strip this or can it be
displayed correctly?
What is wrong here? How should we write our program to avoid a
timeout and long data processing? How can we make a VEE-program that
works like the RMB-program?
Thanks in advance!!!
/Tomas