Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Serial port in Windows

Name: Anonymous 2012-01-21 13:00

Is there any way to bypass the ~15ms (i.e. 1 tick) delay between write instructions? I tried using the SerialPort class of .net and Win32 API so far, and both have that 1 tick delay between every write. Reads seem to work just fine.

For your information: I'm currently using .net, however, if there is a way around that 1 tick problem, I'm willing to switch, as I only used .net for the easy form creation.
If possible, I would like to stick to Windows, as I don't have a spare PC for that project at the moment.
My goal is to send an instruction (2 bytes) + data (0-2 bytes) to a µc and get the answer (1 byte instruction, 1..n bytes for data) every 10ms. Baudrate is not an issue, there is plenty of room between the µc's answer and the next instruction sent from the PC.

Name: Anonymous 2012-01-21 13:34

Give yourself an enema

Name: Anonymous 2012-01-21 13:40

Give yourself an enema

Name: 2 2012-01-21 13:45

>>3
That's disgusting

Name: Anonymous 2012-01-21 14:24

Travel back in time to tell yourself what to write to COM before you know it.

Name: Anonymous 2012-01-21 21:21

>>5
That would be great, but how do I know the answers from the µc?

Name: Anonymous 2012-01-21 21:48

>>6
s/5/2/
Fixed

Name: Anonymous 2012-01-22 8:36

the delay is a standard, you could rewrite the device driver to act as fast as possible though it can be tricky on windows

Name: Anonymous 2012-01-22 16:34

>>8
After my research I found out about timeBeginPeriod() for a higher precision timer. That might work with having multiple threads, however I'm not sure how that will work out with the simple protocol we are using (which is strictly sequential). If it works at all that is.
Going for *nix would mean redoing the whole UI, so I'll probably be doing the calculations for the controller on another Atmel and just leave path planning and interpreting the CNC commands to the PC.

Name: Anonymous 2012-01-22 16:57

>>1,9
It seems that your issue is the way you time the writes, or the the way you pause between writes (why do you do it?). What's your problem, really?

Name: Anonymous 2012-01-22 17:39

>>10
A thread, which is basically:
while (active) {
  if (queue.length>0) {
    send instruction via COM;
    read ack/error byte;
    if (ack) read 2 databytes;
  }
}

This always takes ~15ms, meausered with the oscilloscope. The Atmel answer immediatly after the stop bits, so that's not the problem.

Name: Anonymous 2012-01-22 17:41

>>11
*answers

Name: Anonymous 2012-01-22 17:44

Use events, not polling.

Name: Anonymous 2012-01-22 18:03

>>13
Events won't help. The Atmel won't send anything unless instructed to and the answers have predefined lengths, so an event-based approach would only complicate matters.
And as I stated in >>1 reading is not the problem, writing is.

Name: Anonymous 2012-01-22 18:42


Don't change these.
Name: Email:
Entire Thread Thread List