Skip navigation.
Home
The QNX Community Portal

View topic - Periodic Timer

Periodic Timer

For discussion of realtime and/or embedded programming.

Periodic Timer

Postby diogo_angnalo » Fri Nov 20, 2009 4:45 pm

Hi!

I'm trying to use a periodic timer, and it's working.
However, when I try to use the function system(for any command) it doesn't work, like this:

for(;;)
{
rcvid = MsgReceive (myTemp.canal, &msg, sizeof (msg), NULL);

if (rcvid == 0)
{
time (&now);
printf ("Got a Pulse at %s", ctime (&now));
system("df");
}
}

So, I would like to know if there's a way to make it work, or another way to do it.

Thanks!
diogo_angnalo
Active Member
 
Posts: 38
Joined: Tue Feb 17, 2009 4:57 pm

RE: Periodic Timer

Postby mario » Fri Nov 20, 2009 4:49 pm

What is not working?
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: Periodic Timer

Postby maschoen » Fri Nov 20, 2009 5:03 pm

Does

system("df")

work if you just embed it in a program without waiting for the time?

How do you run your program, from a console or in the background? Does this happen with other programs, eg. system("ls")? My guess is that your stdout is going to the wrong place, and df inherits this. You might want to try as a test:

df("df >/dev/con1");

and see if it shows up there.

Alternatively try

$ stty
Name: /dev/tty-xyz

and then put in system("df >/dev/tty-xyz");
maschoen
QNX Master
 
Posts: 2640
Joined: Wed Jun 25, 2003 5:18 pm

RE: Periodic Timer

Postby natalia_cristina » Sat Nov 21, 2009 5:56 pm

Hi!
Sorry, but I was using my coworker login!

Actually I think the problem is configuration of the timer.

-------------------------------------------------------
if ((channel= ChannelCreate (0)) == -1)
{
printf ("Não criou o canal\n");
return false;
}

system("ls"); //IT WORKS!!

coid = ConnectAttach (0, 0, canal, 0, 0);
if (coid == -1) {
printf ("Não fez a conexao\n");
return false;
}

system("ls"); //IT DOESN'T WORK

-------------------------------------------------------

So, the function system() stops working after I try to establish a connection between a process and a channel (ConnectAttach).
natalia_cristina
New Member
 
Posts: 1
Joined: Sat Nov 21, 2009 5:50 pm
Location: SP, Brazil


Return to Realtime and Embedded

Who is online

Users browsing this forum: No registered users and 2 guests

cron