Re: parallel port timing loop



On Feb 11, 9:49 pm, "sonos" <dspcyp...@xxxxxxxxx> wrote:
Hi,

I am starting a gnu JTAG project and am puzzled about the parallel
port. When I run the parapin example below, the port continues to
toggle pins despite closing the terminal. Why?

Good question. Have you disabled signals (SIGHUP, etc) to the process?
A terminating signal seems to be the only way to stop your program.

BTW, you have two infinite loops in your code. It looks like you tried
to blend a while() loop and a do/while() loop together, and got two
loops instead.

Also,
1) you allocate a 240 byte buffer, but then tell fgets() to only use
5 bytes of it
2) you never test the return value of fgets() to determine when/if
stdin has reached EOF
3) your tinyurl redirects to a password protected site, which makes
looking at your diagnostics difficult


You can view the logic
analyzer output here...

http://preview.tinyurl.com/2fbnsp

26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <unistd.h>
29
30 #include "parapin.h"
31
32 int main(int argc, char *argv[])
33 {
[snip]
37 char buf[240];

Big buffer...

[snip]
45 while (1) {
[snip]
50 printf("Hit return...\n");
51 fgets(buf, 5, stdin);
but small read, and no check of fgets() return value

[snip]
55 }

End of while (1) {} loop


while (0);

followed by a while (0) ; loop

56
57 }

HTH
--
Lew

.



Relevant Pages

  • Re: Threading and Serial port issue
    ... I am using the Opennetcf Port class to handle the serial comms. ... I then sit in a loop waiting for data to arrive. ... private void SetupBoard_Click ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Serial Communication Problem
    ... I have no problems reading from a serial port within a sub-thread. ... the basic loop within the thread, ... > The problem is that function WaitCommEvent never return! ...
    (microsoft.public.windowsxp.embedded)
  • SSA Cabling and Adapter problem
    ... A2 -> Port 16 ... So the A loop is fine, ... The server is an S7A with two I/O drawers, ... There is a seventh adapter in the server, not connected to any disks at all, ...
    (AIX-L)
  • Re: serial port question.
    ... Note that you have left the port in non-blocking mode. ... the termios settings are for raw mode and the VTIME and VMIN ... dependent upon that configuration, and when used as an example ... necessarily must be in a loop. ...
    (comp.os.linux.hardware)
  • SUMMARY: Sun Qlogic HBA + Compaq/HP SAN Switch Issues
    ... I had failed to specify exactly which HBA card I was using. ... talk Fabric Mode (or connect on the F_Port in order for proper switch ... cannot do Fabric Mode...only Loop mode which is why this is not working. ... Bind by World Wide Port Name: ...
    (SunManagers)