Time delay
Navigates to RoboticsConnection.com Home RoboticsConnection.com HomePage
RoboticsConnection User Forum
Home       Members    Calendar    Who's On
Welcome Guest ( Login | Register )
        



Time delay Expand / Collapse
Author
Message
Posted Saturday, May 10, 2008 1:42 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: Saturday, May 10, 2008 2:44 AM
Posts: 13, Visits: 22
Hi I have a Problem and I don´t know if it a Hard - or Software Problem.

I write a Programm in C#. There is a Button on the interface, when I press this Button a Motor starts.  A switch which is connected on I/O Pin 1 works as a counter.

The start and stop from the motor over the C# Interface works great and very fast. But the count from the switch which is connected to the borad has a time delay of 0,5 - 1 second.

Is this normal? Can I make this faster? is there the possibility the press of the switch to write in a register, so that I see the counter works when i press the switch faster?

I have tried some different "Timer" periods from 25 - 200 msec. But the counter is always to slow.

Post #492
Posted Saturday, May 10, 2008 10:15 AM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 6:22 AM
Posts: 277, Visits: 407
How fast are you invoking Serializer.PumpEvents()?  If you set the polling period for say 10msec on the GPIO line, but you only call PumpEvents() every 0.5 sec in your timer loop, then you will not get updates faster than 0.5 sec.   I would invoke PumpEvents() as fast as you can in your timer loop, so set the period to something around 5-10msec.

Also, you can register for a GPIO Change event, and a corresponding handler, and print out that the pin has changed, and the state in the handler to ensure it's working properly.

using RoboticsConnection.Serializer;
using RoboticsConnection.Serializer.Ids;
using RoboticsConnection.Serializer.Sensors;
using RoboticsConnection.Serializer.Components;
using RoboticsConnection.Serializer.Controllers;
using System;

namespace test
{
    class Program
    {
         static Serializer serializer;           
         static GpioPin pin0;
         static GpioPin pin1;
             
         static void Main(string[] args)
         {
              serializer = new Serializer();

              pin0 = new GpioPin(serializer);
              pin0.Pin = GpioPinId.Pin0;
              pin0.Set += new SerializerComponentEventHandler(pin0_Set);
              pin0.Cleared += new SerializerComponentEventHandler(pin0_Cleared);
              //pin0.Enabled = false;   // Set to false if you want to use as output

              serializer.Run();  // Or Serializer.PumpEvents() in a tight loop
                
              // Now, if you  apply +5V or GND to I/O lines 0 and/or 1,
              // you should see the events fire...
          }

          static void pin0_Set(SerializerComponent sender)
          {
              Console.WriteLine("Pin 0 Set");
          }

          static void pin0_Cleared(SerializerComponent sender)
          {
              Console.WriteLine("Pin 0 Cleared");
          }
     }
}

Best Regards!

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #493
Posted Thursday, July 24, 2008 3:04 PM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Wednesday, September 24, 2008 4:05 PM
Posts: 35, Visits: 142
Hello,

I am having the exactly same issue when using a pair of bumper switches on two of the Serializer's digital IO ports. I have followed Jason's advice, using the GPIO set and cleared events to detect when a switch is depressed, and I've set the update frequency to 10 msec. From my experiments, seems clear is that the switch has to be depressed for roughly 0.25 to 0.5 seconds before the event will fire, even with the update frequency of 10 msec. In other words, if I just tap the switch so that it clicks, but release it immediately, the event does not fire. The problem for me is that this means my robot can actually push into an object for about 1/2 second before it takes evasive action. I can certainly live with this if it is simply a limitation of the Serializer's refresh rate, but I just wanted to make sure.

BTW, I'm running this over Bluetooth--could that be a cause of the delay?

--patrick
Post #597
Posted Tuesday, July 29, 2008 7:57 PM


Supreme Being

Supreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme BeingSupreme Being

Group: Administrators
Last Login: Today @ 6:22 AM
Posts: 277, Visits: 407
Patrick,

Let me test this, but something doesn't sound right.  It should have a VERY fast repsonse, even over BT.  Did you have any other non-serializer code that happens to be blocking on something for short times, or hogging cpu so that Serializer.PumpEvents() doesn't get called frequently enough?

Best Regards,

Jason Summerour
President,
Summerour Robotics Corporation
Microsoft MVP
www.roboticsconnection.com

Post #601
Posted Saturday, August 02, 2008 7:46 AM
Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: Wednesday, September 24, 2008 4:05 PM
Posts: 35, Visits: 142
Hi Jason,

Thanks for the response. It may be a few weeks before I get to test the robot again with a simpler interface. I'll post the results once I have 'em.

--patrick

Post #605
« Prev Topic | Next Topic »


Reading This Topic Expand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: jsummerour

Permissions Expand / Collapse

All times are GMT -8:00, Time now is 11:11am

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.218. 9 queries. Compression Disabled.