Hello

Can someone please explain to me what this Pascal line does and if
possible how I could implement it in LabVIEW using the in port and out
port VIs.

the rest of the code is here...

Program serial_adc;

Uses Crt;

Const
    combase=$2f8;    { I/O address of the COM port you are using }
    MCR=combase+4;
    LCR=combase+3;
    MSR=combase+6;

Procedure Initialize_converter;
Begin
   Port[MCR]:=3;    { make DTR line to supply power and set CS input
   of chip to 1 }
   Port[LCR]:=0;    { set clock line of the chip to 0 }
End;

Function Read_value:byte;
Var
   value:byte;
   count:byte;
Begin
   value:=0;
   Port[MCR]:=1;                     { set CS down }
   For count:=0 to 7 Do Begin        { do the bit value eading 7 times
   }
      value:=value SHL 1;            { value=2*value }
      Port[LCR]:=64;                 { clock line up }
      If (port[MSR] and $10)=$10 Then Inc(value);   { read the input
      data and update value }
      Port[LCR]:=0;                  { clock line down }
   End;
   Port[MCR]:=3;                     { set CS up again }
   Read_value:=value;                { return the value }
End;

Begin
   Initialize_converter;            { call initialization routine }
   Repeat
      Writeln(Read_value);          { call reading routine and print
      the value }
   Until KeyPressed;                { repeat until any key is pressed
   }
End.

I just want to know what part that specific line plays in reading of
the COM port. I mean if someone coul explain in an algorith kinda way
the whole 'for loop' I would really appreciate it. I have posted this
question before and even emailed ni but seems like no one has been
able to do it so far, is it impossible to rewrite that particular
Pascal code in LabVIEW? if so what are the alternatives?

Thanks.

Bupe

Reply via email to