Alexander Lichius schrieb:
> Hi Sven,
>
> Monday, December 11, 2000, 10:04:38 PM, you wrote:
>
> ...
> SB> My problem is, that the value that i wrote at the
> SB> pthread_make_periodic_np-function (especially the period)
> SB> doesn't correspond with them in real life. I don't use very low values
> SB> here, about 0.5 or 1s (as specified
> SB> in the "hello world" example. But even them, didn't work.
>
> SB> I know that i "drive" an old version (pre 7) of RT-Linux, but i had not
> SB> enough time to upgrade to pre9 :-)
> SB> I hope that's not the problem...
>
> SB> Did i make a(some) Mistake(s) in constructing my application?
>
> what do you mean with the data you write doesn't correspond to to
> real-life data. did you compare your signal input with the measured
> data, e.g. you connect a constant voltage to your a/d card and in your
> thread you get a different one?
That's not the problem, i still use a signal-generator as input device for the
a/d card.
What i meant is, that the period for the, so called "measurement thread"
doesn't
correspond with the expected one. For example, i will measure 10 Samples with
an period
of 1 sec. So i expect, that the data is written not before the 10 sec elapse.
>
> perhaps it is a range problem of your a/d adaptor. if you are
> expecting it to have a bipolar range and it really has an unipolar one
> than you could get some errors. perhaps you could be more specific or
> provide some code snippet to look at.
Okay, here it comes...
First my thread code:
-----------------
void *init_converting_code(void *param)
{
struct sample samp;
struct timespec delay;
delay.tv_sec=0;
delay.tv_nsec=25000; /*25us=25000ns*/
while(1)
{
outb(0, AD_CARD+2);
outb(128, AD_CARD+2); /*some further init, after this i had
to wait minimum 25us second*/
nanosleep(&delay, NULL);
help=inb(AD_CARD+2) & 15;
help=help*256;
result=inb(AD_CARD+1) + help;
volt=result*2.44;
samp.now=now;
now=now++;
samp.voltage=volt;
rtf_put(0, &samp, sizeof(samp));
pthread_wait_np();
}
return 0;
}
Then the handler fo fifo nr.7:
----------------------
int my_handler(unsigned int fifo)
{
struct my_msg_struct msg;
int err;
while ((err=rtf_get(7, &msg, sizeof(msg))) == sizeof(msg))
{
switch(msg.command)
{
case START_TASK:
pthread_make_periodic_np(read_thread, gethrtime(),
1000000000); /*= 1 s*/
break;
case STOP_TASK:
pthread_delete_np(read_thread);
break;
.
.
Code, snipped from "init_module"
---------------------------
rtl_printf("About thread2: ");
pthread_attr_init (&attr);
sched_param.sched_priority = 2;
pthread_attr_setschedparam (&attr, &sched_param);
pthread_create (&read_thread, &attr, init_converting_code, (void *)1);
pthread_setfp_np (read_thread, flag);
rtl_printf("Sucessfully created\n");
rtf_create_rt_handler(0, &counter2_handler);
rtf_create_handler(7, &my_handler); /*Handler for the control
fifo*/
> i designed my app very similar to your one and i think (hope) it is
> running straight ...
>
> SB> Sincerly
>
> SB> S.Boehringer
>
> mailto:[EMAIL PROTECTED]
S.Boehringer
--
---------------------------------------------------------------------------
Sven Boehringer, Student at the University of Applied Siences FHT-Esslingen
Flanderstrasse 101 73732 Esslingen Germany
E-Mail: [EMAIL PROTECTED]
-- [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/