Show Posts
Pages: [1] 2 3 ... 6
1  Using Arduino / Microcontrollers / Re: Programming an 8Mhz Arduino RBBB with a 16Mhz Duemilanove on: June 17, 2014, 10:06:11 pm
Thanks, I flashed the bootloader using the 8Mhz resonator and it's now working!
2  Using Arduino / Microcontrollers / Programming an 8Mhz Arduino RBBB with a 16Mhz Duemilanove on: June 16, 2014, 10:28:32 pm
Hey Peeps,
       For my current project, I want to run the Arduino at 3.3V so that I can build only one power supply and natively communicate with other 3.3V devices, so I also need to drop the clock speed to 8MHz.  I've got a Duemilanove with 16MHz clock.  The board that I'm programming is a RBBB clone.

My question is, when using an Arduino as an ISP, do I use an 16Mhz resonator on the target board (so that they'll be at the same clock speed while programming), or an 8MHz resonator (since that's what I intend to use it with).

Thanks for the help!
3  Forum 2005-2010 (read only) / Troubleshooting / Re: 017 visual elements duplicated(tabs,menus,status) on: November 13, 2009, 01:46:28 pm

Okay, I figured it out and it's working, here are step-by-step instructions for others with the same problem:

Download and install Java Runtime 6 update 17 (JRE)
it's about halfway down the page.

Go to
.../Program Files/Java/jre6/
and copy all the files within that directory

Go to
and delete all the files within, then paste the files you just copied.

Fixed it for me...
4  Forum 2005-2010 (read only) / Troubleshooting / Re: 017 visual elements duplicated(tabs,menus,status) on: November 12, 2009, 09:46:16 pm
I have this problem with:

Windows Home Premium 32-bit
Java 6 update 11
Arduino 0017

I have installed Runtime 6 update 17, and rebooted, but it did not fix the issue.

You mentioned replacing files in the Arduino installation directory-- what files do I replace, and where do I get them?

5  Forum 2005-2010 (read only) / Bugs & Suggestions / Re: copy/save serial monitor output on: February 28, 2009, 06:16:01 pm

I'm using PuTTy, and I'm able to automatically save the output of the COM port to a log file.  Also, I can set the serial baud rate to a custom rate, which solves another problem I was happening.

Thanks so much for your help!

Though I still think it would be nice to be able to copy/paste from serial monitor, fwiw.
6  Forum 2005-2010 (read only) / Bugs & Suggestions / copy/save serial monitor output on: February 28, 2009, 01:01:09 am
It would be great if you could copy the output of the serial monitor to the clipboard, or save it to a log file.

If this is possible, I apologize but I've been looking for an hour and I haven't found a way to do it.

7  Forum 2005-2010 (read only) / Syntax & Programs / Re: pulseIn timeout not working on: June 03, 2009, 07:39:48 pm
Here's the code from wiring_pulse.c
/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH
 * or LOW, the type of pulse to measure.  Works on pulses from 2-3 microseconds
 * to 3 minutes in length, but must be called at least a few dozen microseconds
 * before the start of the pulse. */
unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout)
      // cache the port and bit of the pin in order to speed up the
      // pulse width measuring loop and achieve finer resolution.  calling
      // digitalRead() instead yields much coarser resolution.
      uint8_t bit = digitalPinToBitMask(pin);
      uint8_t port = digitalPinToPort(pin);
      uint8_t stateMask = (state ? bit : 0);
      unsigned long width = 0; // keep initialization out of time critical area
      // convert the timeout from microseconds to a number of times through
      // the initial loop; it takes 16 clock cycles per iteration.
      unsigned long numloops = 0;
      unsigned long maxloops = microsecondsToClockCycles(timeout) / 16;
      // wait for any previous pulse to end
      while ((*portInputRegister(port) & bit) == stateMask)
            if (numloops++ == maxloops)
                  return 0;
      // wait for the pulse to start
      while ((*portInputRegister(port) & bit) != stateMask)
            if (numloops++ == maxloops)
                  return 0;
      // wait for the pulse to stop
      while ((*portInputRegister(port) & bit) == stateMask)

      // convert the reading to microseconds. The loop has been determined
      // to be 10 clock cycles long and have about 16 clocks between the edge
      // and the start of the loop. There will be some error introduced by
      // the interrupt handlers.
      return clockCyclesToMicroseconds(width * 10 + 16);

I took a look at this, and then realized that I probably hadn't read the doc carefully enough, because it will return 0 if a pulse does not start before the timeout, but will not return 0 if the pulse does not end before the timeout.  Sure enough, from:
"Gives up and returns 0 if no pulse starts within a specified time out."

So that's all cleared up.

Now, adding the ability to return 0 if the pulse does not end before the timeout is easy enough:
     // wait for the pulse to stop
      while ((*portInputRegister(port) & bit) == stateMask)
            if (numloops++ == maxloops)
                  return 0;

but how do I adjust the width-to-microseconds conversion so that it will be accurate with the new while loop time?  I understand you can look at the assembly code and then look up how many clock cycles each command takes, but I've never done it and I need some hand holding, if you don't mind.

8  Forum 2005-2010 (read only) / Syntax & Programs / Re: pulseIn timeout not working on: June 03, 2009, 06:46:06 pm
I tried replacing the ping with a resistor, and sure enough it started returning 0s.  I'm not sure why-- you mentioned 'noise' but I don't see how this would affect the operation of the timer.  If the pin was bouncing down to LOW, I would be seeing erroneously short pulses, but how could it affect the timeout variable?

I guess that I can just hack something together with a pair of while() loops and the micros() function, but it would be nice if the timeout worked, other than that pulseIn is very accurate and useful.
9  Forum 2005-2010 (read only) / Syntax & Programs / pulseIn timeout not working on: June 02, 2009, 11:51:22 pm

I'm trying to use the pulseIn() function to read from a parallax ping() sensor.  It reads the pulse length from the sensor great, but the optional timeout part of it is not working.

My ping outputs a pulse length of about 9000 when I point it at empty space.  I'd like to set pulseIn to give up at around 2600, which would give me a speed boost because I wouldn't have to wait the extra 6.4mS for the ping to time out.

Here is the test code:

long pulselength = 0;
//float inches = 0;
int pulsepin = 2;

void setup() {

} //end setup()

void loop() {
pinMode(pulsepin, OUTPUT);
digitalWrite(pulsepin, LOW);
digitalWrite(pulsepin, HIGH);  
digitalWrite(pulsepin, LOW);
pinMode(pulsepin, INPUT);
pulselength = pulseIn(pulsepin, HIGH, 2600);


} //end loop

Note: even if you don't have a ping, you can load this up and verify that it is returning higher numbers than 9000, instead of the expected 0.

10  Forum 2005-2010 (read only) / Syntax & Programs / Re: DMX send and receive with some signal modification on: May 28, 2009, 02:19:31 am
Hey Gene,
      This might work, or not, depending on your lighting console and device.  Since the output code bitbangs out the serial protocol manually on pin 11, it's not going to fight with the input coming in to the serial pin 0.  I didn't realize the DMX send code example was written this way.  I don't know why they didn't just use the onboard hardware USART for the 512 data bytes and then manually bang the pin for the break and MAB, it would be a lot simpler and allow more flexibility in timing.  Maybe I'll write up some code that does that.  But anyway, luckily for you it's written the way it is.

Mainly, I think you want to make sure the send and receive code go sequentially, rather than trying to run them at the same time.  i.e.:

1.  receive the desired address from the lighting console (output disabled)
2.  send those addresses to the device as address 1-4
3.  finish out your dmx frame (you should only have to send 50 addresses if the device is standards compliant)
4.  park the output pin at LOW for the break
5.  now, while the pin is low and you don't need the processor for output, jump over to your receiver code, and grab the new incoming values
6. jump back to output, bang out your MAB, and go to step 2.

Since the break time is variable from 88uS to 1S, you should be able to go grab your new input values quickly enough that your device doesn't decide that it's lost data connection and shut down.  But, many devices fail to be E1.11 standard compliant in this regard.  Also, if you have a lighting console that puts a lot of padding between addresses, it may take too long to receive the the values that you're interested in.

I don't know, personally it seems awfully prone to error to me, are you sure that you can't just open the device up and replace their DMX reception hardware with your own?

11  Forum 2005-2010 (read only) / Syntax & Programs / Re: button array status poll via PORTD on: May 27, 2009, 04:01:34 am
You can use the internal pull-up resistors for this, just connect the other side of your switches to ground and do:

pinMode(pin, input);
digitalWrite(pin, HIGH);

I looove the internal pull-up resistors.  smiley
12  Forum 2005-2010 (read only) / Syntax & Programs / Re: arduino, leds and a pattern on: May 25, 2009, 02:49:43 pm
If I'm understanding your goal right, this array is static, you don't need to update it once the program starts running.  In which case, the array can live in the program space rather than hogging all your ram.  Instructions here:

*I haven't done this yet, so if that's not really what PROGMEM is for correct me plz.
13  Forum 2005-2010 (read only) / Syntax & Programs / Re: Question about variable scope and processor load on: June 09, 2009, 03:00:10 am
Oh, I was reading the reference and I found the static keyword.  static will set the variable the first time the function calls it, but leave it alone after that, while still setting it as a local variable so that other functions can't change it.

I need to look at what happens at compile time to see what the effect on processor load is though...
14  Forum 2005-2010 (read only) / Syntax & Programs / Re: Question about variable scope and processor load on: May 30, 2009, 03:50:45 pm
Uf.  I was afraid the answer had something to do with assembly code.  But banging a pin and looking at the pulse length on an o-scope is a great work-around, thanks for the tip.
15  Forum 2005-2010 (read only) / Syntax & Programs / Re: Question about variable scope and processor load on: May 29, 2009, 04:57:03 pm
Thanks for the info.  Do you know a method or reference for evaluating processor load on the Arduino?  

I keep finding myself in situations (like receiving serial at 250Kbps, or real-time audio generation)  where I would like to squeeze just a little more performance out of the processor, and so it would be nice to know exactly how many clock cycles I'm saving by going to direct port manipulation vs. digitalWrite(), for example.
Pages: [1] 2 3 ... 6