Show Posts
Pages: 1 ... 3 4 [5] 6 7
61  Forum 2005-2010 (read only) / Development / Re: DAC components on: September 24, 2009, 07:21:01 pm
Quote
If so, can the SPI communication get messed up?

It shouldn't, I think the SPI is buffered, and tolerant of clock stretch.

As for dual latching, just send your output commands for both DACs (ie 32 bits of data and afterwards drive LDAC low. The data will load the DAC input buffers and the LDAC will latch both into the output buffers.
62  Forum 2005-2010 (read only) / Development / Re: DAC components on: September 23, 2009, 09:13:59 pm
That is a Futurlec board, http://www.futurlec.com/Mini_DAC.shtml, order directly from them and they will ship it to you. There's a link on the page to the data sheet, check section 5 for details in the serial interface.
63  Forum 2005-2010 (read only) / Development / Re: How to digitally control analog circuits. on: December 28, 2008, 07:50:52 pm
> An additional criteria has been given me, and it is that all of the audio
> signal path has to be analog. (this rules out encoder+digitalpot)

Not really true, digital pots generally have a fully analogue signal path with switched precision resistors, it's the control logic which is digital. The signal path would be no different to a stepped-attenuator style volume control (such as the ALPS 27 - very popular with audiophiles), the difference is electronic control rather than a manual switch.
64  Forum 2005-2010 (read only) / Development / Re: Vehicle Air bag Controller Open source on: February 15, 2010, 07:20:24 pm
Quote
designing and building it is entirely irrelevant to the subject matter at hand.

Nonsense. You're proposing designing and building the deployment control system, which is equally safety critical.

As a matter of principle, design and implementation of safety critical systems is best left to well-resourced experts.

If you don't think that the control system of a device that fires pyrotechnics in close proximity to the operator of a 1500kg machine travelling at potentially 100km/h on public roads requires some very serious safety engineering, then you should think again.
65  Forum 2005-2010 (read only) / Development / Re: Vehicle Air bag Controller Open source on: February 14, 2010, 05:47:08 pm
Frankly I don't believe that the design & implementation of a device that controls the detonation of an explosive device in front of your face is really an appropriate place for DIY activities.

It's dangerous, and probably illegal in most jurisdictions.
66  Forum 2005-2010 (read only) / Development / Re: Mini Megadunio on: June 17, 2009, 09:15:34 pm
I suggest a power connector like the seeeduino. Your DC power connector is ruining the profile of the entire unit.
67  Forum 2005-2010 (read only) / Interfacing / Re: GPS EM-406 example on: April 14, 2008, 11:31:17 pm
Quote
if( val > 128 )
  return val-128;
else
  return val;
 

which hopefully your compiler will be clever enough to convert to:

Code:
return val & 0x7f;
68  Forum 2005-2010 (read only) / Interfacing / Re: vibration (like in cell phones or game controller) on: November 28, 2010, 06:59:54 pm
Vibration Motor: http://shop.ebay.com/?_nkw=vibration+motor&_sacat=See-All-Categories
69  Forum 2005-2010 (read only) / Interfacing / Re: Long Range Narrow Beam Ultrasonic Sensor on: September 22, 2010, 07:36:50 pm
You might consider an array of transducers, if you drive them all in phase you will end up with a narrow beam (effectively a phased-array sonar). The wavelength of a 40kHz sound wave is 8.6mm, so placing those MaxSonar transducers as close together as you can (about 16.4mm) gives an array spacing of approximately 2*lambda.

The first zero in the transducer array pattern is at (sin theta = lambda / ((2*N +1) * d))) where d is the distance between the array elements and N is the number of elements (linearly). So for d = 2*lambda (ie. the closest you can space these transducers):

For N=2, theta = 5.75 degrees, or beamwidth ~11 degrees.
for N=4, theta = 3.2 degrees, beamwidth = ~6 degrees.
for N=8, theta = 1.7, beamwidth = ~3 degrees.

Note that these are array factor improvements, the MaxSonar transducer looks like it has a beamwidth of around 30 degrees, this value is modulated onto the above improvement factor. The take-home result is that doubling the number of array elements results in an approximate halving of the effective beamwidth.

If you were trying to steer the beam electronically, you would get severe grating lobes due to the wide array spacing. If you're only going to drive the whole thing in phase (ie beam on the boresight, you don't need to worry.
70  Forum 2005-2010 (read only) / Interfacing / Re: Bounce lib question on: August 30, 2010, 07:11:11 am
Quote
If the constructor does not return a value, how can there be anything assigned to bouncer?

Because no assignment is done. As I mentioned before, this is an example of "direct-initialization". What is actually happening is that:

Code:
Bounce bouncer = Bounce(BUTTON, 5);

is being silently rewritten as

Code:
Bounce bouncer(BUTTON, 5);

operator=() (the assignment operator) is *not* called at all. This is important when you have overloaded operator=() for a class, you need to be aware that it won't be called even though you might expect that it would.

The first form of the expression is valid because the language designers thought it should look the same as the initialization for built-in types. Similarly:
Code:
int x = 3;
is semantically identical to
Code:
int x(3);
which is the same form you use for member initialization in member functions. eg as I posted before:
Code:
class test
{
    public:
        test(int x): x(x) { std::cout << "ctor test(x)" << std::endl; };

    private:
        int x;
};

71  Forum 2005-2010 (read only) / Interfacing / Re: Bounce lib question on: August 29, 2010, 08:03:11 pm
@davekw7x:
Quote
That is not true.  The constructor is used to create an object of the class.  It does not (can not) return a value.  

Correct.

Quote
Code:
Bounce bouncer = Bounce(BUTTON, 5);
The right-hand side of this expression creates a temporary object using the defined constructor.  The (default) overloaded '=' operator copies that temporary object into the newly defined object named "bouncer"

Not correct. operator=() is not called, the object instance is created from the Bounce(byte pin, unsigned long debounce_interval) constructor directly, the same as your second example. See the C++ standard section 8.5, paras 13 & 14, and section 12.3.1 para 2, it's called "direct-initialization".

@PaulS:
Quote
This fails to compile, because there is no constructor in the Bounce class that takes no arguments.

Correct. Also if you don't define an explicit constructor for a class the compiler will always create a default constructor for you, with no parameters.

Try this (not in Arduino), you will see operator=() is only called once, at the point of assignment, 3rd line in main(), the other two declarations are equivalent (to the second):

Code:
#include <iostream>

class test
{
    public:
        test(int x): x(x) { std::cout << "ctor test(x)" << std::endl; };
        test& operator=(const test& rhs);

    private:
        int x;
};

test& test::operator=(const test& rhs)
{
    std::cout << "operator=() called" << std::endl;
    x = rhs.x;
    return *this;
}

int main(int argc, char **argv)
{
    test t = test(10);
    test t2(2);
    t2 = t;
    exit(0);
}

72  Forum 2005-2010 (read only) / Interfacing / Re:  Arduino Anemometer on the cheap? on: October 26, 2009, 05:52:10 pm
Quote
I'm definately[sic] thinking a quadrature encoder (aka rotary encoder).

Strictly speaking you don't need a quadrature encoder, as an anemometer only spins in one direction (and wind speed is a scalar quantity), you just need an interrupter of some description.
73  Forum 2005-2010 (read only) / Interfacing / Re: interfacing a 12 Bit SPI ADC on: May 20, 2008, 06:51:50 pm
Quote
If I understand right, you want to measure between a lower and upper voltage. On the MCP3208 you can set analogue and digital ground separately, so you should be able to set AGND to your lower ref voltage and VREF to your upper ref voltage. Read the datasheet for more info.

Also if you are trying to measure +/- values, try to get the zero-point in the centre of the ADC range (by suitable selection of VREF & AGND). Then you can convert the ADC value from offset binary to two's complement signed fairly quickly with the following:

Code:
// Convert offset binary (zero value in centre of range) to two's complement signed
// val = read ADC val
// bits = resolution of ADC
//
int offsetBinary2TwosComp( int val, char bits ) {
      val ^= 1 << (bits - 1); // Toggle the high bit
      if (val & (1 << (bits - 1))) val |= (0xFFFF << bits); // Sign extend
      return val;
}

Conversion involves inverting the MSB then sign-extending if the result is negative.
74  Forum 2005-2010 (read only) / Interfacing / Re: Serial Communications Basics Using QextSerialPort on: June 30, 2010, 08:29:51 pm
Quote
What platform and what version of QextSerialPort are you using?

Windows. Not sure of the version, but it's public-domain derived (prior to the Google Code BSD-licensing) with all the original headers removed, so the providence can't be traced.

If open() is not working then my guess is either the way you are constructing the name or a permissions problem.
75  Forum 2005-2010 (read only) / Interfacing / Re: Serial Communications Basics Using QextSerialPort on: June 29, 2010, 08:06:45 pm
You might try printing out the QList returned by  QextSerialPortEnumerator::getPorts() to verify that the name you are using is valid.

Also I use setQueryMode(QextSerialBase::Polling) before the open(), my port->open() uses QextSerialBase::ReadWrite rather than QIODevice::ReadWrite, and I use FLOW_HARDWARE rather than FLOW_OFF (not that this last one will help if open() is not returning).
Pages: 1 ... 3 4 [5] 6 7