Click here to Skip to main content
15,893,790 members
Home / Discussions / C#
   

C#

 
GeneralRe: serial port and data sequencing problem...? Pin
Mir_As24-Jun-07 12:08
Mir_As24-Jun-07 12:08 
GeneralRe: serial port and data sequencing problem...? Pin
Mir_As24-Jun-07 12:19
Mir_As24-Jun-07 12:19 
GeneralRe: serial port and data sequencing problem...? Pin
rahvyn624-Jun-07 12:25
rahvyn624-Jun-07 12:25 
GeneralRe: serial port and data sequencing problem...? Pin
Mir_As24-Jun-07 12:29
Mir_As24-Jun-07 12:29 
GeneralRe: serial port and data sequencing problem...? Pin
rahvyn624-Jun-07 12:34
rahvyn624-Jun-07 12:34 
GeneralRe: serial port and data sequencing problem...? Pin
Mir_As24-Jun-07 12:41
Mir_As24-Jun-07 12:41 
GeneralRe: serial port and data sequencing problem...? Pin
rahvyn624-Jun-07 12:46
rahvyn624-Jun-07 12:46 
GeneralRe: serial port and data sequencing problem...? Pin
Luc Pattyn24-Jun-07 13:11
sitebuilderLuc Pattyn24-Jun-07 13:11 
Sorry, but I doubt the entire concept of your project.


1)
Reality check: you want to send 6 bytes of data at 9600 Baud ?
with 1 start bit, 1 stop bit, no parity bit, a byte takes 10 bit times (a bit time is
1 second divided by the baudrate), that leads to a maximum of 960 bytes per second
(lets call this 1000 bytes per second, or 1 msec/byte for easier calculations).
Assuming you could send just 6 bytes (i.e. no overhead)
you will need almost 6 msec to transfer the amount of data you want to transfer every msec !?!?

2)
if 9600 Baud is the maximum your serial port (PC or target) can support, you are stuck.
You need more bandwidth, i.e. a higher baudrate, or a different interface hardware all together;
alternatively (and preferably, assuming data is not changing much) you should select some setup
with buffering+compression at the producer side (target), and buffering+decompression
at the consumer side (PC).

3)
you dont need separation characters between the six bytes, they serve no purpose;
you do need something that shows which byte is the first of a series of six.
Lets assume you use 7 bytes: 1 special character indicating "start of data", followed
by 6 data bytes. Your "start of data" value might also occur in one of the data bytes,
and hence you could have a case of mistaken synchronization, but if you test for that
and react properly, it will solve itself after a while (unless you are really unlucky;
to understand assume 5 of the 6 values you need to send happen to also have that special
value: how then can you tell to what channel belongs the one byte that differs ???)

4)
It will not be obvious to get the PC listen to the serial data in real-time; PCs are
not good in real-time stuff, they tend to do a whole lot of things, some in foreground,
some in background, and typically fast enough to satisfy the human user (who tolerates
delays of 10 or 100 msec, and occasionally a full second).
If you need better, you must work with "real-time" priorities, which easily will ruin
the behavior of all other processes unless you get everything correct, not a simple job.

5)
The normal way to connect a device (such as a robot arm) to a computer (such as a PC)
is by having a smarter target that executes intelligent commands, and reports higher-level
results (things like: rotate 20 degrees per second for the next 3 seconds; and "rotation'
done; new position=...". At that pace, you can easily have the PC follow the target.

Compare this with a printer: you send one byte to instruct it to print one character,
the PC does not control the paper movement, the head movement, the ink nozzles, the ribbon,
whatever; and the feedback is "page done" or "out of paper", not "paper has moved another
tenth of an inch".

6)
it is my conviction the requirements and/or the concept of this project exceed your
current technical skills and expertise, especially on PC side (embedded systems are easier
to program, and sending data is easier than correctly receiving it!).
You will need to rethink, and you probably will need much more help than any CodeProject forum
can offer you.


Anyway, I hope some of the above information will help you somehow.

Smile | :)



GeneralRe: serial port and data sequencing problem...? Pin
Mir_As24-Jun-07 13:45
Mir_As24-Jun-07 13:45 
AnswerRe: serial port and data sequencing problem...? Pin
Ed.Poore24-Jun-07 13:33
Ed.Poore24-Jun-07 13:33 
GeneralRe: serial port and data sequencing problem...? Pin
Mir_As24-Jun-07 14:16
Mir_As24-Jun-07 14:16 
GeneralRe: serial port and data sequencing problem...? Pin
Ed.Poore24-Jun-07 22:38
Ed.Poore24-Jun-07 22:38 
GeneralRe: serial port and data sequencing problem...? Pin
Mir_As24-Jun-07 22:57
Mir_As24-Jun-07 22:57 
QuestionHorizontal Scrollbar on Panel Pin
rahvyn624-Jun-07 8:43
rahvyn624-Jun-07 8:43 
QuestionFormChild reference to FormChild in FormMDI Pin
hoangsamac24-Jun-07 7:34
hoangsamac24-Jun-07 7:34 
AnswerRe: FormChild reference to FormChild in FormMDI Pin
Dave Kreskowiak24-Jun-07 12:49
mveDave Kreskowiak24-Jun-07 12:49 
GeneralRe: FormChild reference to FormChild in FormMDI Pin
hoangsamac25-Jun-07 4:07
hoangsamac25-Jun-07 4:07 
GeneralRe: FormChild reference to FormChild in FormMDI Pin
Dave Kreskowiak26-Jun-07 2:39
mveDave Kreskowiak26-Jun-07 2:39 
GeneralRe: FormChild reference to FormChild in FormMDI Pin
hoangsamac27-Jun-07 5:13
hoangsamac27-Jun-07 5:13 
AnswerRe: array of bitmaps Pin
Guffa24-Jun-07 8:05
Guffa24-Jun-07 8:05 
QuestionSome question about add-in Pin
imagic24-Jun-07 5:44
imagic24-Jun-07 5:44 
AnswerRe: Some question about add-in Pin
Jasmine250124-Jun-07 8:32
Jasmine250124-Jun-07 8:32 
GeneralRe: Some question about add-in Pin
DavidNohejl24-Jun-07 8:42
DavidNohejl24-Jun-07 8:42 
GeneralRe: Some question about add-in [modified] Pin
imagic24-Jun-07 19:36
imagic24-Jun-07 19:36 
GeneralRe: Some question about add-in Pin
Jasmine250125-Jun-07 10:38
Jasmine250125-Jun-07 10:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.