Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: serial communication with hex strings
Replies: 6   Last Post: Dec 28, 2012 11:31 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
abdur.engineer@gmail.com

Posts: 2
Registered: 2/23/09
Re: serial communication with hex strings
Posted: Feb 23, 2009 11:45 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Jan 30, 10:32 pm, "Ken " <robin...@kuchera.com> wrote:
> "David" <d...@bigcompany.com> wrote in message <glsogh$c1...@fred.mathworks.com>...
> > "Ken " <robin...@kuchera.com> wrote in message <glsl90$gn...@fred.mathworks.com>...
> > > Im trying to output a HEX string to a camera to makes it turn a filter on. The command is '8101040102FF'. I've made a small m.file to do it. When i run the m.file the filter doesnt turn on.  
> > > Im not sure if the HEX string is being output ftom the m.file  to the com port because nothing happens.

>
> > > code
>
> > > s=serial('COM1');
> > > set(s,'BaudRate', 9600);
> > > set(s,'DataBits', 8);
> > > set(s,'StopBits', 1);
> > > fopen(s);
> > > Str=('8101040102FF');
> > > sprintf('%s %X','8101040102FF')
> > > fclose(s);

>
> > your sprintf statement is malformed.  you have 2 substitutions, %s and %X but only one value which is a string.
>
> > and are you sure the camera wants the digits as a string, or does it want them as binary bytes?
>
> the camera wants them as bytes


Ken:
I have the same problem as above. Have you been able to find a
solution to this.
In my case, I am trying to control a pump. The manufacturer provided
with their own software which works fine, however attempting to pass
the same hex command strings using either hyper terminal or matlab
does not yield any response from the pump. Any help in solving this
problem is appreciated.
Regards



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.