Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Device operations control from software

Status
Not open for further replies.

timsanr

Member level 1
Member level 1
Joined
Apr 13, 2012
Messages
41
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,596
Hi,

I need programming advice. I suppose you met that problem and there are some typical solutions.
I have device which can interpret some commands and then do some related operation. I communicate with it via FTDI USB circuit. My problem is that receiving loop detects if incoming byte is e.g x"55" and if it is true, device sends hex data to PC. But it is also possible send data to device and it can contain x"55" values so device makes bad interpretation and starts to send data to PC.
What is a typical approach in such communication to avoid described situation? I can of course reprogram PC and device software.

It may seem to be stupid question but now I don't know how to do it the best way.

Regards
Tim
 

I'm not sure I understood 100% what the problem was, but I think you're saying that you want to distinguish commands from data.
The information here is not specific to USB:
Often a long sequence is used for the command, i.e. something that is extremely unlikely to occur in the data.
For example, if you sent the characters "___cmd" instead of 0x55 then it is unlikely that they would ever occur in data.
Or, never send raw data, always encapsulate it, e.g. have a header that identifies it as data, and have a length parameter.
 
Yes, it is exactly what I need :)
I think encapsulation. After data analysis, it is too big likelihood that command can occur in data.

Thank you.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top