# Optical Forums > Ophthalmic Optics >  Data trace send/rec port serial rs232c

## edu23800

Hello. I'm a system developer and i'm initializing a integration with the Tracer LT 980 Satellite Nidek, using serial port RS232c.
I'm having troubles in establishing a session with the device. I've done the configuration of the serial port (9600,8,N,1), as I've read in the OMA Protocol, as soon as I made a connection with the Tracer automatically will be send a request of initialization.


According the OMA Protocol, I have to send the following datas:


<ACK>
<FS>ANS=INI<CR/LF>
STATUS=0<CR/LF>
<RS>
<GS>


But, before I send those datas, I have to received these datas:


<FS>REQ=INI<CR/LF>
<RS>
<GS>


Besides not receive any datas sending "REQ=INI", I don't receive any information of the device.
I've tried sending those commands bellow, but i don't get any answer as well. Only when I send "<ENQ>(ASCI 5 ou 0x05)", I receive a "<ACK>(ASCII 6 ou 0x06)" and nothing else.


<LF><DLE><SOH><STX>REQ=TRC<DLE><ETX>
0x10,0x02,0x05,0x01,0x07,0x06,0x10,0x03,0x0E


My main question is : Which is the correct way to send those codes?


ps.: The fields between tags "<>" will be changed to ASCII Code.


Thanks,
Eduardo

----------


## MikeAurelius

Go back to the basics.

Check your wiring of the -232 plugs - do the correct pins have continuity all the way through the system?
Check the length of the wiring - -232 has a max length of about 25-50 meters to ensure proper signal strength
If you need a null-modem, is it in place? Is it the correct one?

Double check your protocols on ALL the machines in the connection.
Double check that the machine is capable of -232 reception, meaning there is no problem with the -232 interface.
Double check that the machine is configured to receive data through the -232 line instead of another line.

----------


## edu23800

Hello Mike, thanks for the answer.
I've already done all those checks. I'm using the software "Utility Tracer" and it's working well, and the program is able to read the datas sent by the Tracer LT 980.
It's in my own application that I don't know how to send datas and receive the answers.

Regards,
Eduardo

----------


## Wes

Please see the following:

https://www.thevisioncouncil.org/members/standards

https://www.thevisioncouncil.org/sit...Final-2014.pdf

----------


## MakeOptics

> Hello. I'm a system developer and i'm initializing a integration with the Tracer LT 980 Satellite Nidek, using serial port RS232c.
> I'm having troubles in establishing a session with the device. I've done the configuration of the serial port (9600,8,N,1), as I've read in the OMA Protocol, as soon as I made a connection with the Tracer automatically will be send a request of initialization.
> 
> 
> According the OMA Protocol, I have to send the following datas:
> 
> 
> <ACK>
> <FS>ANS=INI<CR/LF>
> ...


That is a newer tracer so you can be sure it supports auto format initialization, The specs say 1000 points around a lens and you have USB, LAN, and Serial (RS232C). My guess is that the baud rate you've choosen is too slow. Try to get into the settings of the tracer and get the baud rate. Then match that rate on your computer. Before you even get there check your cable to make sure it is a Null modem or Straight through depending on if your tracer is considered a if it is a DTE device you need a null modem cable a DCE needs a straight through. You can buy a simple adapter at radoi shack to cross over your cables if you need to. Anyway once your sure that the device and host have the channels to communicate, then try turning the machine on while connected and software running your machine should send the request for initialization. From there your response packet looks good enough it should elicit a response.

----------


## edu23800

> Please see the following:
> https://www.thevisioncouncil.org/members/standards
> https://www.thevisioncouncil.org/sit...Final-2014.pdf


Wes, thanks for the feedback. 
I've already read those guides and unfortunately I didn't had success.

----------


## edu23800

> That is a newer tracer so you can be sure it supports auto format initialization, The specs say 1000 points around a lens and you have USB, LAN, and Serial (RS232C). My guess is that the baud rate you've choosen is too slow. Try to get into the settings of the tracer and get the baud rate. Then match that rate on your computer. Before you even get there check your cable to make sure it is a Null modem or Straight through depending on if your tracer is considered a if it is a DTE device you need a null modem cable a DCE needs a straight through. You can buy a simple adapter at radoi shack to cross over your cables if you need to. Anyway once your sure that the device and host have the channels to communicate, then try turning the machine on while connected and software running your machine should send the request for initialization. From there your response packet looks good enough it should elicit a response.


Hello MakeOptics, according to the guide, I've set the tracer's baud rate to 9600 and besides, as I said, I'm using another software (Utility Tracer) to make communication tests and the software made a perfectly communication, returning all calculated datas. 
My only problem is when I use my own software, cause I can't find a way to send any request that makes sense to the Tracer. Do you have any example of data exchange with a tracer?

----------


## MakeOptics

> Hello MakeOptics, according to the guide, I've set the tracer's baud rate to 9600 and besides, as I said, I'm using another software (Utility Tracer) to make communication tests and the software made a perfectly communication, returning all calculated datas. 
> My only problem is when I use my own software, cause I can't find a way to send any request that makes sense to the Tracer. Do you have any example of data exchange with a tracer?


What programming language are you using?

The only reason, I suggested checking connection speed and cabling is the very same reason computer repair techs ask you if it's plugged in or turned on, it saves us both a lot of aggravation.  It sounds like you have everything set up, so it's the communication.


Try tracing a frame and sending that data to your software.  The reasoning is the device initializes communication and we can use a no initialization protocol which is supported by all devices, that should allow you to see the data being sent.  If we can get data transferred to your host then post that data and we will interpret and go from there.  I have studied the protocol very well, but have always been lacking a tracer to test code on, so if you post packets I can walk you through what they mean and the correct response.

You can also purchase software from Eltima that creates a virtual com port so that you can monitor Ulility Tracer's raw data, this will allow you to see the handshake in progress by performing what's referred to as "a man in the middle", this hack can allow you to eaves drop on the current setup.  This will allow you to see a days worth of data and determine how to code that example.  I found it much easier then interpreting the DCS manual, but ultimately I use both.  I discussed this tactic with an industry software provider, and over the years I was able to circumvent a PhiTracer's lock codes through VisionWeb and even had that software available here on this forum before the heat caught up with me.  That was when my nickname was PhiTrace which was really me trying to stay anonymous and post that one bit of software for my clients.

----------


## Wes

> Hello MakeOptics, according to the guide, I've set the tracer's baud rate to 9600 and besides, as I said, I'm using another software (Utility Tracer) to make communication tests and the software made a perfectly communication, returning all calculated datas. 
> My only problem is when I use my own software, cause I can't find a way to send any request that makes sense to the Tracer. Do you have any example of data exchange with a tracer?


PM sent.

----------


## Wes

How is the serial connector pinned out?  The Nidek/Santinelli machines need a null modem connector.  Pin 2 should be green wire instead of red, pin 3 should be red wire instead of green.  Pin 5 should be yellow wire.   The next bit of instruction may sound odd, but I've hooked up a few dozen of these: jump pins 4 and 6 to each other, and pins 7 and 8 to each other as well.  See crappy picture:

----------


## MakeOptics

> How is the serial connector pinned out?  The Nidek/Santinelli machines need a null modem connector.  Pin 2 should be green wire instead of red, pin 3 should be red wire instead of green.  Pin 5 should be yellow wire.   The next bit of instruction may sound odd, but I've hooked up a few dozen of these: jump pins 4 and 6 to each other, and pins 7 and 8 to each other as well.  See crappy picture:


4 and 6, signify that there is no DSR/DTR communication.
7 and 8, signify that there is no RTS/CTS communication.

Newer equipment can both talk and listen at the same time "full duplex", older equipment used to actually send a signal through one of the above lines and wait for a response back before transmitting data.  By creating a loop in essence when a signal goes over the DSR or RTS line it loops right back to itself as a response signal on the DTR or CTS lines and begins communication.  Thanks for sharing that, I used to set up com0com and modify those variables to virtually connect, never actually though of using a jumper.

----------


## shanbaum

The DCS requires the device (the tracer, in this case) to initiate the communications session.  If the tracer isn't doing that, it could be that it will only send with one or both of the handshake lines high - DTR and CTS.  You might try looping DTR and DSR, and CTS and RTS, on the the tracer's side of the connection, as Wes recommended.  

Those lines don't actually transport signals; they're either high or low, indicating ready or not.

There is literally nothing you can (or must) send to the tracer to get it to send data to you.  It must initiate the session.

----------


## MakeOptics

```
//VCA Reserved Characters Hexidecimal values un-escaped


var FS = '\u001C';
var GS = '\u001D';
var DC1 = '\u0011';
var DC3 = '\u0013';
var ACK = '\u0006';
var NAK = '\u0015';
var ESC = '\u001B';
var RS = '\u001E';
var SUB = '\u001A';
var CR = '\u000D';
var LF = '\u000A';
var field_seperator = '\u003B'; // hex for ";"
var label_seperator = '\u003D'; // hex for "="
var code_seperator = '\u002C'; // hex for ","
var mandatory_record_flag = '\u002A'; //hex for "*"
var unknown_data_indicator = '\u003F'; // hex for "?"


function VCArecords(stream) {
	var records = {};
	var temp = [];
	var lines = stream.split(CR + LF);
	
	for(var x in lines) {
		temp = lines[x].split(label_seperator);
		
		//every record set
		if(records.hasOwnProperty(temp[0])) {
			records[temp[0]] = records[temp[0]].concat(temp[1].split(field_seperator));	
		} else {
			records[temp[0]] = temp[1].split(field_seperator);
		}	
	}
    records.RR = records.R.slice(0,records.TRCFMT[1]+1);
    records.RL = records.R.slice(records.TRCFMT[6]*(-1));
    if(records.hasOwnProperty("A")) {
        records.AR = records.A.slice(0,records.TRCFMT[1]+1);
        records.AL = records.A.slice(records.TRCFMT[6]*(-1));
    }
    if(records.hasOwnProperty("ZFMT")) {
        records.ZR = records.Z.slice(0,records.ZFMT[1]+1);
        records.ZL = records.Z.slice(records.ZFMT[6]*(-1));
    }
    if(records.hasOwnProperty("ZA")) {
        records.ZAR = records.ZA.slice(0,records.ZFMT[1]+1);
        records.ZAL = records.ZA.slice(records.ZFMT[6]*(-1));
    }


	return records;
}
```

_Example: (fiddle) http://jsfiddle.net/4g0p309r/5/_

This is a Javascript library that takes in a stream and returns an object that has OMA records in it.  Not to be used for commercial purposes, without express consent.

Yes, Javascript is useful two examples:

1. Chrome now has Serial support baked into the new version.
2. Node.js

*Documentation:*

The function returns an object which can be referenced using dot notation to gain access to all valid labels that are available in the OMA file.  Keep in mind that this combines all record sets with similar labels, however (R, A, Z, ZA) record sets also have a corresponding (RR, RL, AR, AL, ZR, ZL, ZAR, ZAL) record set for each eye . 

The TRCFMT and ZFMT, data is combined for right and left, I access the data array position 1 for the right lens and 6 for the left lens.

No error checking, if anyone plans on using the code I can work with them to refine.

*If anyone is willing to donate a tracer (OMA Compliant) I can further develop this into an open source trace software for uploading to Vision Web with the possibility of Shape Modification.*  The above code is an interpretation function, but before I can put any effort into a communications function I would need a unit to test it on.  Here is a proof of concept to prove it can and will be done when funds or equipment are available.

----------


## MakeOptics

New and improved version.

----------


## edu23800

The problem that tracer wasn't sending any data, was that the communication wasn't made in the OMA protocol, but in the machine's language. That's why I coudn't translate anything.
But now, I'm receiving in the OMA pattern, and sending exactly what you guys told me, I've made the connection perfectly. Thanks for everyone for the time and the patience.

----------


## MakeOptics

The 1st HTML5 App based Tracer Interface.  Sure I have seen ActiveX components in browsers that allow interface with a tracer, but that requires IE or some hacking around, this is a chrome app that can work on a cheap $199 chromebook and be just as functional without having to install drivers through VisionWeb to upload traces.  Ain't technology grand.

I was able to interface and initialize a National Optronics 4Ti Tracer via the OMA handshake method outlined in the DCS.  Traces can be archived, viewed to scale, and uploaded to VisionWeb to transmit to the lab.  Archived traces can also be loaded and viewed in the software.

Thank you Barry Santini for the offer to donate a Tracer, had I not have purchased one I would have taken you up on the offer.

----------


## MakeOptics

Next phase of development auto populate visionweb with the trace from the tracer or a locally saved OMA file (e.g like from silhouette labs).  Locally saved traces can currently be pulled into the software and viewed as well as saved from the program.

Next steps:
1) Auto load visionweb.
2) Shape modifications.
3) Drill editor.
4) Connect to edger for a full browser based mini-LMS.





*INDUSTRY FIRST HTML5 TRACER SOFTWARE, INDUSTRY FIRST LINUX TRACER SOFTWARE, INDUSTRY FIRST MAC TRACER SOFTWARE*

----------


## edu23800

Hello. I have another question about the communication.
I'm connecting with the tracer and receiving the data when I press the button to scan the frame glasses (because I'm sending a "REQ" command manually).
But now I need to initialize the process of scan the frame glasses without pressing manually the button, just sending a command with my program. But I can't establish a requisition, the tracer didn't answer and I don't know how to do it.

This's what i'm sending:
<FS>REQ=TRC<CR/LF>
STATUS=5;INITIALIZE<CR/LF>
JOB=1<CR/LF>
DO=B<CR/LF>
TRCFMT=1;1000;E;R;F<CR/LF><RS><GS>


Does anyone have some idea?

----------


## shanbaum

> Hello. I have another question about the communication.
> I'm connecting with the tracer and receiving the data when I press the button to scan the frame glasses (because I'm sending a "REQ" command manually).
> But now I need to initialize the process of scan the frame glasses without pressing manually the button, just sending a command with my program. But I can't establish a requisition, the tracer didn't answer and I don't know how to do it.
> 
> This's what i'm sending:
> <FS>REQ=TRC<CR/LF>
> STATUS=5;INITIALIZE<CR/LF>
> JOB=1<CR/LF>
> DO=B<CR/LF>
> ...


If the tracer allows you to do that, it is not doing it in a standard way, because the standard provides no way to do it. I recommend pushing the button.

----------


## edu23800

> If the tracer allows you to do that, it is not doing it in a standard way, because the standard provides no way to do it. I recommend pushing the button.


I use as example the "Tracer Utility" to do the integration in my own software and the tracer utility is able to inicialize the process without pressing any button in the tracer, so, as I can see, the tracer does have this function.
Did you know how to proceed?

----------


## MakeOptics

> I use as example the "Tracer Utility" to do the integration in my own software and the tracer utility is able to inicialize the process without pressing any button in the tracer, so, as I can see, the tracer does have this function.
> Did you know how to proceed?


Why don't you create a virtual com port, loop back the tracer utility program to your virtual com port and monitor the commands being sent.  That way you can figure out the specific command to start tracing remotely.  Like Robert mentioned their is no standard way of doing what you are asking, but the standards do allow for custom or experimental commands which are ignored by standard compliant equipment.  Usually those records start with an underscore "_", if you monitor a virtual port and see any record with an "_" this would most likely be your remote button code.

----------

