Embedded carriage return in device command

A plugin that allows for end user development of multiple RS232 device control systems.
jwr
Senior Member
Senior Member
Posts: 134
Joined: Sat Oct 25, 2008 11:13 am
Contact:

Embedded carriage return in device command

Postby jwr » Tue Jul 27, 2010 12:23 pm

I'm trying to send a very basic command to a device that requires a carriage return followed by a line feed for the command. I setup the device on the correct serial port and then the following device command:

S1MODE?<<\13>>

I specified the terminator as 10 (linefeed).

When I test this command I was expecting to see "S1MODE?" followed by a carrige return then a linefeed. Here is what I see in portmon:

0.00026589 IRP_MJ_WRITE Serial7 SUCCESS Length 9: 0D 53 31 4D 4F 44 45 3F 0A

The carrige return is before the command and the terminator (linefeed) is at the end of my command. This doesn't work with my device. It has to have a carrige return then linefeed after each command.

I also checked to see if there was some residual character in the output from the prior test... I removed the <<\13>> from the command and as expected the string output in portmon has no carrige return.

0.00025422 IRP_MJ_WRITE Serial7 SUCCESS Length 8: 53 31 4D 4F 44 45 3F 0A

Is there something I'm doing wrong here?

User avatar
CinemarDave
Site Admin
Site Admin
Posts: 10535
Joined: Fri Feb 07, 2003 8:56 am
Location: Planet Earth
Contact:

Re: Embedded carriage return in device command

Postby CinemarDave » Tue Jul 27, 2010 12:44 pm

What happens if you just specify the carriage return as the terminating char? Most devices ignore the linefeed and trigger on the carriage return.

jwr
Senior Member
Senior Member
Posts: 134
Joined: Sat Oct 25, 2008 11:13 am
Contact:

Re: Embedded carriage return in device command

Postby jwr » Tue Jul 27, 2010 1:16 pm

I tried the command without the <<\13> and using 10 as the terminator and the device doesn't respond. I also tried the command without the <<\10>> and using 13 as the terminator and the device didn't respond to that either.

Using Hyperterm I'm able to see the device will only respond to a valid command followed by CR then LF. It even ignores the command if the CR and LF are switch around.

Any idea why the <<\13>> at the end of my command is placed at the beginning when the command is sent to the device?

jwr
Senior Member
Senior Member
Posts: 134
Joined: Sat Oct 25, 2008 11:13 am
Contact:

Re: Embedded carriage return in device command

Postby jwr » Fri Jan 21, 2011 12:36 pm

Hey Dave,

I'm still needing for this issue to be addressed. Can you help me understand why the carraige return is placed at the beginning of the command when I specified it at the end?


Return to “MLGenericDevice”

Who is online

Users browsing this forum: No registered users and 1 guest