On Thu, May 04, 2000 at 02:34:44PM -0400, Elliott Wolin wrote:
> 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?


You gave them 0 period and RTL scheduler picked a semi-safe 10microseconds
Try making the period 50000 -- see below.

> 
> 
>                               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 */
                                              50000
>   pthread_make_periodic_np (t2, gethrtime()+50000, 0);  /* falling edge */
                                                     50000

>   
>   return(0);
> }
> 
> 
> void cleanup_module(void) {
>   pthread_delete_np (t1);
>   pthread_delete_np (t2);
> }
Content-Description: Card for Elliott Wolin


-- 
---------------------------------------------------------
Victor Yodaiken 
FSMLabs:  www.fsmlabs.com  www.rtlinux.com
FSMLabs is a servicemark and a service of 
VJY Associates L.L.C, New Mexico.

-- [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