Go to Post Every game design should be a means to an end. - Mark McLeod [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Spotlight this post!  
Unread 11-08-2009, 22:59
Dave Flowerday Dave Flowerday is offline
Software Engineer
VRC #0111 (Wildstang)
Team Role: Engineer
 
Join Date: Feb 2002
Rookie Year: 1995
Location: North Barrington, IL
Posts: 1,366
Dave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond reputeDave Flowerday has a reputation beyond repute
Re: Multithreaded programs

Quote:
Originally Posted by biojae View Post
the rio wouldn't have to send anything, only receive. so if i have a very fast loop in a separate thread, could i conceivably catch the data?
Receiving is actually much harder than sending when writing a bit-banged serial port. I can say this because I wrote my own software serial implementation for the ATmega168 (so I could have 2 UARTs on it).

If your code is just a while() loop running in a task, you need to consider that other tasks will be constantly interrupting you and taking the processor from you (for many milliseconds at a time). So you can't count on a while() loop to catch the first edge. So, you might be able to use an edge-triggered interrupt, but you have to be ready to sample the I/O line at 1.5 times the bit clock after the edge interrupt. I haven't looked into the pin change interrupts too closely. I don't know if your code would actually be running in the CPU's interrupt handler or if the RTOS catches the interrupt and just sends a signal to your task. If it's the latter, then it's very unlikely that you'll get the interrupt fast enough. Even if it's the former, you need to know exactly when that first edge occurred so you can know when to sample your first bit, and then you need to loop, waiting precisely 1 bit time, sampling the input pin and looping again until you have all 8 bits. It may be possible, but my point is that it will be incredibly difficult to get all the timing right on a multitasking RTOS. Keep in mind that at 115200 bps (which is what the 6DOF uses), each bit is only 8.7 microseconds long. Usually the scheduler on an RTOS like VxWorks runs at 1, 5, or 10ms, so if your task gets interrupted it'll be way too long before you get control back.
Quote:
thats a great idea except the arduino uses analog pins 5 and 6 for I2C communication, and all 6 pins are used (3 for x y z) (3 for roll pitch yaw)

what about SPI? it was finished for labview but not for windriver
SPI might be an option. I haven't looked into how that works on the cRIO. Alternatively, I think you'd be better off trying to bit-bang I2C on the 6DOF with some of the unused pins. People have done it before; you can find code out on the Internet that might work for you (a quick Google search turned up this which might be promising).

Another option would be to add an additional AVR microcontroller - program that to act as an I2C-to-serial bridge and place it between the 6DOF and the sidecar. You can get pre-made AVR or Arduino boards for <$20 that would probably work well. Still not a trivial programming challenge, but much more straightforward than the bit-banged serial.

Like I said before, it might be possible to get bit-banged serial working on the cRIO, but I think it will be difficult and frustrating. I wouldn't want to try it myself, but if you really want to then maybe it's worth a shot. I'm just trying to point out that there might be some other options for you, some of which might offer an easier solution.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
design programs Dan Zollman College & University Education 3 12-06-2009 23:54
Scouting Programs Suspect_Deezy Technical Discussion 10 30-10-2008 18:11
Programs BillyJ Inventor 1 22-03-2005 09:34
Multiple Programs goegan31 Programming 3 17-03-2003 22:56
Other Programs? BHS First Team 3D Animation and Competition 3 15-01-2002 14:56


All times are GMT -5. The time now is 18:14.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi