Show Posts
Pages: [1] 2
1  Using Arduino / Sensors / Analogue input impedance, crosstalk, sample-and-hold time on: May 19, 2013, 08:45:38 pm
Hi,

I need to sample several high-impedance circuits using the analogue pins (using the Arduino Nano).

Primary requirement is low component count and cost. Bandwidth requirements are very low. This means that I'm ruling out using op-amp buffers, etc.

According to this post, input impedance is about 100MOhm, but the charging of the sample-and-hold capacitor and multiplexing bring this down considerably, initially.

This begs the question, how can I programmatically work around this? In other words, is it possible to tell the microcontroller to switch the multiplex switch, sample and hold, wait a while, and then take a sample? How would I do that?

Thanks!


2  Using Arduino / Microcontrollers / Re: Speeding up the compiler on: May 18, 2013, 08:33:12 am
Quote
Sounds like it's time to open the process tab in task manager and find out what each of them actually is

I did that, the sum of the memory listed for each of the processes did not match the total memory used - by a long shot. However, the largest consumers were Google Chrome tabs that were displaying a page with Flash. And I strongly suspect that Flash has a memory leak or similar, as closing the tabs does not return the memory I had before opening the tabs. [I can't wait until Flash is dead. Flash designers should be shot]
3  Using Arduino / Programming Questions / Re: Determining RAM used at a given time on: May 15, 2013, 11:06:49 am
Fantastic link, thanks!
4  Using Arduino / Programming Questions / Re: Determining RAM used at a given time on: May 15, 2013, 10:29:57 am
Thanks Rob, DC. Lol @ your comment Rob. I'm not sure if it's better or worse!!

Oddly I managed to get something running which frequently calls malloc() and free(). The code did something like this:

Code:
void loop(){
  byte* stuff = malloc(numStuff);
  // do stuff
  free(stuff);

  byte* things = malloc(numThings);
  // do things
  free(things);
}

How is it that bad things didn't happen? I'm using quite a bit of RAM in general. However, "stuff" never used more than about 10 bytes and "things" never used more than about 16 bytes.

Is there any document or explanation somewhere of what exactly malloc() and free() would do on the Arduino?
5  Using Arduino / Programming Questions / Determining RAM used at a given time on: May 14, 2013, 11:22:20 am
Hi again,

I'd like to periodically assign to a variable the number of bytes of RAM used at that point. In case it matters, I'm using malloc() in a few places. How would I do that?

And as a side question, I'm curious how fragmentation of RAM is dealt with. It's probably more info than my brain will handle though. I suppose problematic fragmentation can be dealt with by avoiding malloc() where possible, and re-using blocks specified at the start?

Thanks

6  Using Arduino / Programming Questions / Re: Error: undefined reference to `fn()' on: May 12, 2013, 03:12:42 pm
Tom that worked like a charm, thank you ever so much!! I really appreciate the time you spent on this

For reference, with Tom's testCorrect.zip I added the following lines to the following files and it worked!

test.h:
Code:
extern char myChar;
test.c:
Code:
char myChar = '!';

7  Using Arduino / Programming Questions / Re: Error: undefined reference to `fn()' on: May 12, 2013, 12:50:05 pm
Ok problem fixed but a new problem! I changed the above code to:

test.ino:
Code:
#include "test.c"
void setup(){ fn(); }
void loop(){}
test.c:
Code:
#include "test.h"
void fn(){}
test.h:
Code:
void fn();

but the problem is, I actually want a variable and a function in test.c like so:
test.ino:
Code:
void setup(){ fn(); }
void loop(){}
test.c:
Code:
char myChar = '?';
void fn(){ myChar++; }

So what do I need in test.ino, test.c and if necessary, test.h?

Thanks!!
8  Using Arduino / Programming Questions / Error: undefined reference to `fn()' on: May 12, 2013, 12:36:05 pm
Hello, just me again  smiley-red I have three files in my sketch's directory:

test.ino:
Code:
#include "test.h"
void setup(){
  fn();
}
void loop(){}
test.c:
Code:
void fn(){}
test.h:
Code:
void fn();

But when I compile I get the error:
Code:
test.cpp.o: In function `setup':
C:\Program Files\arduino-1.0.4/test.ino:3: undefined reference to `fn()'

What have I done this time  smiley-roll

Thanks again!
9  Using Arduino / Programming Questions / Re: Error: multiple definition of `MY_VARIABLE' on: May 12, 2013, 12:20:27 pm
I found the answer:

http://tread.wordpress.com/2007/06/18/declaring-global-variables-in-header-files/

I created a test.h file, and put this in it:

extern unsigned char MY_VARIABLE;

And the only include directive I had was in test.ino:
Code:
#include "test.h"
10  Using Arduino / Programming Questions / Re: Error: multiple definition of `MY_VARIABLE' on: May 12, 2013, 11:47:32 am
Thanks - Yes it was in the same directory. But when I remove the #include line, it now says:

Code:
test.ino: In function 'void setup()':
test:2: error: 'MY_VARIABLE' was not declared in this scope

I hope to write functions in test.c which manipulate MY_VARIABLE, and have code in test.ino call those functions
11  Using Arduino / Programming Questions / Error: multiple definition of `MY_VARIABLE' on: May 12, 2013, 11:32:57 am
Hi,

I have two files:
test.ino
Code:
#include "test.c"
void setup(){
  delay(MY_VARIABLE);
}
void loop(){}
and test.c:
Code:
unsigned char MY_VARIABLE = 100;

Compiling in the Arduino IDE gives this error:
Code:
test.cpp.o:(.data.MY_VARIABLE+0x0): multiple definition of `MY_VARIABLE'
test.c.o:(.data.MY_VARIABLE+0x0): first defined here

How do I fix this?
Thanks!
12  Using Arduino / Programming Questions / Re: error: 'delayMicroseconds' was not declared in this scope on: May 12, 2013, 11:25:23 am
Worked like a charm, thank you!
13  Using Arduino / Programming Questions / error: 'delayMicroseconds' was not declared in this scope on: May 12, 2013, 11:06:21 am
Hi,

I have two files in my sketch folder: sketch.ino and sub.c

My .ino file looks like this:
Code:
#include "sub.c"
void setup(){
  doSetup();
}
void loop() { }
My sub.c file looks like this:
Code:
#include "util/delay.h"
void doSetup();
void doSetup() {
  delayMicroseconds(1000);
}
But when I compile I get the following error:
Code:
lcd.c:48: error: 'delayMicroseconds' was not declared in this scope

What am I doing wrong?
14  Using Arduino / Programming Questions / Re: Multiple files on: May 12, 2013, 10:31:14 am
Ah I found the answer - I didn't see the little down arrow to the right of the tabs on the very right of the window, there's a "New Tab" option, I made a .C file
15  Using Arduino / Programming Questions / Multiple files on: May 12, 2013, 09:46:40 am
I want to split up the main .ino file. Nothing I've tried has worked.

I've tried creating a foo.ino or foo.c file in the sketch folder. If I then drag it into the IDE, it asks me if I want to replace the existing foo.X file, which when I click 'Yes' then deletes that file from the sketch folder and I'm still left with just the one tab with my primary .ino file.

If I try creating the foo.ino in the sketch folder then selecting "file > open", it says that foo.ino needs to be in its own sketch folder. If I create foo.c in the sketch folder then select "file > open", it says "Processing can only open its own sketches and other files ending in .ino or .pde.

I've tried searching the net, but I'm getting a lot of 404 errors and unhelpful blog posts.

Assistance is appreciated!
Thanks
Pages: [1] 2