Hello Elliot

I am a newcomer to RT programming but here is my suggestion. You may
want to put a delay in before executing the pulse as follows:

pthread_make_periodic_np(t1, gethrtime() + 50000, 0);
pthread_make_periodic_np(t2, gethrtime() + 100000, 0);

I hope that helps!

Daniel




>From: Elliott Wolin <[EMAIL PROTECTED]>
>To: realtime linux <[EMAIL PROTECTED]>
>Subject: [rtl] One-shot pulse generator doesn't work using RTL
>Date: Thu, 04 May 2000 14:34:44 -0400
>
>Hi,
>
>I must be missing something fundamental.  I don't know why the program 
>below
>doesn't generate a single rectangular pulse on the parallel port with a 
>width of
>50 microsec. (rtlinux 2.2.13, PIII 450).
>
>Rather than the 2nd thread running 50 microsec after the 1st, it runs
>immediately after the 1st, giving 10 microsec pulses.
>
>How do you delay the startup of a thread?
>
>
>                               Sincerely,
>                                       Elliott Wolin
>
>
>===================================================================================
>
>
>/* Produce a single rectangular pulse on parallel port */
>
>#include <asm/io.h>
>#include <rtl.h>
>#include <pthread.h>
>
>#define LPT_PORT 0x378
>
>pthread_t t1,t2;
>
>
>void *fun(void *arg) {
>   outb((int)arg, LPT_PORT);
>   return(0);
>}
>
>
>int init_module(void) {
>   pthread_create (&t1, NULL, fun, (void*)~0x0);  /* rising edge */
>   pthread_create (&t2, NULL, fun, (void*) 0x0);  /* falling edge */
>
>   /* pulse width is 50 microsec */
>   pthread_make_periodic_np (t1, gethrtime(),       0);  /* rising edge */
>   pthread_make_periodic_np (t2, gethrtime()+50000, 0);  /* falling edge */
>
>   return(0);
>}
>
>
>void cleanup_module(void) {
>   pthread_delete_np (t1);
>   pthread_delete_np (t2);
>}
><< wolin.vcf >>

________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

Reply via email to