Need help with reading data (Barcodescanner) from a com port. I'm using the mscomm32.ocx. (Navision 370)
Example:
//init
MSComm.CommPort(4); //COM4
MSComm.Settings('9600,N,8,1'); //Parameter
MSComm.InputLen(0); //Sofort senden
MSComm.InBufferCount(0); //Init
MSComm.InputMode(0); //Textmode
MSComm.PortOpen(TRUE); //öffnen
//Read????
Result := MSComm.Input();
Doesn't work.
I tried the nfcomm.ocx before. Doesn't work either.
I have no experience with com port programming an would be thankful for any help (hints or examples).
The barcodescanner is working fine. No problems with hyperterminal.
0
Comments
It means that primary function of the aplication is to use COM scanner as Keyboard scanner...
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
Has someone written an OCX or Automation for this case. Or is there any existing codeexample for the nfcomm.ocx? My try with nfcomm.ocx looks like this:
//init
CLEAR(ComPort);
ComPort.ComX := 3; //com4
ComPort.BaudRate := 6; //9600bps;
ComPort.Parity := 0; //None
ComPort.DataBits := 4; //8 databits
ComPort.DtrDsr := FALSE;
ComPort.RtsCts := FALSE;
ComPort.XonXoff := FALSE;
ComPort.StopBits := 0; //1 Stopbit
ComPort.SaveParam;
Result := ComPort.ReceiveStr;
In terms of initializing the mscomm32 control, you should be ok to leave most properties at their default values.
However, you may find you need to play about with the following in order to get it working with your particular device/scenario:
.InBufferSize
.OutBufferSize
.Settings
I found the following settings worked in my particular case:
Open the COM port to communication:
The code within the Timer event may look something like this
www.NextEqualZero.com
A technical eye on Dynamics NAV
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!