Re: parallel port timing loop
- From: "Lew Pitcher" <lpitcher@xxxxxxxxxxxx>
- Date: 12 Feb 2007 05:22:39 -0800
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[snip]
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 {
37 char buf[240];
Big buffer...
[snip]
45 while (1) {[snip]
50 printf("Hit return...\n");but small read, and no check of fgets() return value
51 fgets(buf, 5, stdin);
[snip]
55 }
End of while (1) {} loop
while (0);
followed by a while (0) ; loop
56
57 }
HTH
--
Lew
.
- Follow-Ups:
- Re: parallel port timing loop
- From: sonos
- Re: parallel port timing loop
- References:
- parallel port timing loop
- From: sonos
- parallel port timing loop
- Prev by Date: Linux time in millisconds
- Next by Date: Re: Linux time in millisconds
- Previous by thread: parallel port timing loop
- Next by thread: Re: parallel port timing loop
- Index(es):
Relevant Pages
|