I have some Pascal code writen for an 8bit Serial ADC circuit. I have had a look at the Pascal code and I made an attemp at implementing it in labVIEW but obviously it didnt work.
The Pascal code writes/reads to the DTR, RTS and CTS lines which I was able to do with little success, I used the property node and chose 'modem line settings' which gave me the options to write to the lines i mentioned above. The problem is with the way the Pascal code addresses the different lines. If you look at the Const: in the pascal code, it consists of the combase add, the MCR(DTR) add, LCR(RTS) add and the MSR(CTS) add, how can I do that in LabVIEW because the open visa session vi only allows you to specify visa resource name e.g. asrl1::instr etc.
the other thing I don't understand is the 1st and 3rd line in the 'for loop' of the Pascal code. how can I implement the 3rd line? Another thing is that the Pascal code sets the MCR(DTR) line to an integer value 3 which when I do in labVIEW comes up with an error, it only allows me to write either 1 or 0?? Can anyone help by telling me where to start from? Below is the Pascal code. I have attached my current vi which does not work.
the circuit diagram for the 8bit adc can be found here...
http://www.hut.fi/Misc/Electronics/circuits/ad_serial.html
Pascal Code........
Program serial_adc;
Uses Crt;
Const
combase=$3f8; { 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 }
Delay(1200);
Until KeyPressed; { repeat until any key is pressed }
End.
.........
thanks a lot
Bupe