LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Old program in pascal using serial to convert in labview

Hi all,

I have to convert an old pascal program using serial in labview, but I 'm not good with serial, so I need help.
The Code in Pascal is:

with reg do
begin

writeln(' fichier de travail: ',nom);
ah:=$00;
dx:=$01; It is initialisation of the serial
al:=$A3;
Intr($14,reg);
writeln('Attente de donn‚es');


repeat
ah:=$02;
dx:=$00;
intr($14,reg);
until ah=0;

repeat
ah:=$02;
dx:=$00;
Intr($14,reg)
until al=4;

writeln(' R‚
ception of datas:');
Chaine:='';
data:=0;
k:=0;

Somme:=0;
SommeCarre:=0;
repeat
inc(k);
repeat
ah:=$02; this code is my problem
dx:=$00;
Intr($14,reg);
if al=4 then begin
{$r-}
Val(Chaine,Intensite,Erreur);
chaine:='';
{$r+}
End;

if (al<>13) and (al<>10) and (al<>32)
and (al<>0) and (al<>4) then Begin
chaine:=chaine+chr(al);

end;
until al=4;


So if anyone can convert to labview this code, it will be helpfull for me.
My problem is the reception of data
Great thanks.
Greg S.
CNRS
LV 7.1 8.2 8.6 2009 2011 2012 2013 2014
LPMC - CNRS
N'oubliez pas de complimenter cela fait toujours plaisir.
0 Kudos
Message 1 of 4
(2,429 Views)
First of all this is not pascal but 'p'assembly.
What you should do in LabVIEW using VISA or the old serial vi's is init the serial port(or open the visa session) and start reading characters one by one.
After that build a string out of it and try to understand what it means.
The best you can do is take the serial example and run it.
greetings from the Netherlands
0 Kudos
Message 2 of 4
(2,429 Views)
As far as I understand ypur program makes the following things:
1. Initialisation of COM port
ah:=$00; //function of initialisation
dx:=$01; //00 - for COM1, 01 - for COM2
al:=$A3; //rate;parity;stopbits
Intr($14,reg); //execution of initialisation
2.Read port until the moment when it returns something (ah=0):
repeat
ah:=$02; // read port
dx:=$00; // COM1
intr($14,reg); //make readings
until ah=0; //untill no error
3. Read port until it returns 4;
repeat
ah:=$02;
dx:=$00;
Intr($14,reg)
until al=4; // untill 4 in port buffer
4.Then you read port and compare data with 10, 13, 32, 0, 4 and make some calculations.
As
I remember 10 is a termination character, 13 - tabulation, 32 - space.
It is strange that you make intialisation and readings for different ports (dx:=$01; and dx:=$00;)

You may use Visa functions and Init Read Serial functions in LV to solve your problem.

Oleg Chutko
0 Kudos
Message 3 of 4
(2,429 Views)
thKS for this answer, I know this is strange about the different port, this prog was made ten years ago when I wasn't in function. I will try with basic serial function.
Regards
Greg
Greg S.
CNRS
LV 7.1 8.2 8.6 2009 2011 2012 2013 2014
LPMC - CNRS
N'oubliez pas de complimenter cela fait toujours plaisir.
0 Kudos
Message 4 of 4
(2,429 Views)