Problem in measuring time!!

Tarik KHOUTAIF khoutaif at
Sat Oct 9 17:36:12 CEST 2004

I’m using the kernel RTAI 2.4.20 _ RTHAL5 to develop a protocol of control/command. I work under  PERIODIC mode (and not ONESHOT mode). I have two real time tasks the first "Slave" who await a message on the serial port COM2, and the second "Master" which sends the message on the COM1.

Once the Slave task receives the message, returns a ACK to the Master. To measure time in the loop of asservissement of my system, and the time of execution of certain functions, I initialised start_rt_timer(1E1) in the nitialisation of the serials port. 

The time of the transmission 
RTIME Time_transmission 
Time_send_command = rt_get_time_ns(); //in Master task 
Time_receive_command = rt_get_time_ns(); //in Slave task 
Time_send_response  = rt_get_time_ns(); 
Time_receive_response = rt_get_time_ns(); 
Time_transmission = time_receive_command – Time_send_command; 

The problem is that :
Time_send_command = Time_send_response and 
Time_receive_command = Time_receive_response!! 
Is what you can inform me or to show me how to program differently to solve this problem??? 

Best regards,

More information about the Rtai mailing list