Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

RS232 communication


Ponce Oct 2, 2015 10:02 AM

Hi,

I am wondering if someone already has experience with the following:

I want to read position data from a display from Heidenhain (ND 280: http://content.heidenhain.de/doku/oma_nd_pt/html/de/oma-en/index/1242135143200/1242135143141/1242135143141.html), which has a RS232 interface.

Question is: Will I get the data into my CR1000 with the SerialInRecord() command?

KR,

Ponce


JDavis Oct 2, 2015 03:54 PM

I found the manual and the output looks fairly simple.

The data format is fairly simple, but SerialInRecord() might not be the best. The device has a polled interface, so you can reliably get data with SerialIn

I would recommend the following:

SerialFlush
Pulseport for 65ms on the trigger line
SerialIn Use 13 for termination character 15 for timeout

The other way to trigger it is outputting a Ctrl B character with SerialOut or SerialOutBlock.

If you configure the RS232 port for connection to the device, beware that you won't be able to connect your PC to the CR1000 on the RS232 port. You could configure a pair of control ports like Com4 for Pakbus communication. You can do that simply by setting a baud rate for the comport on the datalogger using DevConfig.


Ponce Oct 5, 2015 10:00 AM

Hi JDavis,

thanks for the feedback. We will have the device today and hopfully get it up and running. Was really a nightmare to get the data out of the encoder. I'll let you know about the advances...

KR,

Ponce


Ponce Oct 5, 2015 12:39 PM

Hi JDavis,

I am trying to do the output CTRL B via Serialout(). Question I have is: What do I have to write to get the CTRL-B command communicated via the RS232 port.

KR,

Ponce


Ponce Oct 5, 2015 03:10 PM

Hi JDavis,

works! I am using the following program:


BeginProg
Scan (1,Sec,500,0)
SerialOpen(ComRS232,115200,2,20,500)
SerialFlush(COMRS232)
SerialOut(COMRS232,CHR(2),"",0,100)
SerialIn(Dir,COMRS232,10,13,100)
CallTable Test
NextScan
EndProg

The output is something like - 179.887 G. Now I am facing a problem how to convert that to floating point number.

Thanks for the help!

KR,

Ponce


JDavis Oct 5, 2015 03:14 PM

The easiest way to get a the floating point number out is to use SplitStr with the Numeric option.


Ponce Oct 5, 2015 03:41 PM

Right. Just did that. Only thing I am missing now is the sign (+ or -) for the angle...


Ponce Oct 6, 2015 08:05 AM

Done! Works with Replace() command. Thanks JDavis!!!

Log in or register to post/reply in the forum.