Show Posts
Pages: [1] 2 3
1  Forum 2005-2010 (read only) / Syntax & Programs / Re: Arduino BT with Parallax GPS module on: May 11, 2009, 04:23:14 pm
Hi,

I cannot judge the quality of your code.
The board certainly communicates over the serial port.
Use the getting started Guide http://arduino.cc/en/Guide/ArduinoBT and you will be up and running over serial communication in no time.

Regarding the power, unless you haven't done so, pls refer to http://arduino.cc/en/Main/ArduinoBoardBluetooth.
To me 1.2V seems a bit low, add some juice as the GPS module needs some of it too. Maybe use a battery pack with 2-3 batteries providing 3V or 4.5V.

Good luck, Hans.
2  Forum 2005-2010 (read only) / Syntax & Programs / Re: SPCR values into string on: July 30, 2009, 08:13:07 am
Thanks a lot works great.

This is what I did in the meantime producing the same result:

Code:

   Serial.println("Current SPI SPCR Register Bit Values:");
   Serial.println("Check this:");  
   if (SPCR & 0x80) Serial.println ("SPIE = 1");
   if (SPCR & 0x40) Serial.println ("SPE = 1");
   if (SPCR & 0x20) Serial.println ("DORD = 1");
   if (SPCR & 0x10) Serial.println ("MSTR = 1");
   if (SPCR & 0x8) Serial.println ("CPOL = 1");  
   if (SPCR & 0x4) Serial.println ("CPHA = 1");
   if (SPCR & 0x2) Serial.println ("SPR1 = 1");  
   if (SPCR & 0x1) Serial.println ("SPR0 = 1");

3  Forum 2005-2010 (read only) / Syntax & Programs / Re: SPCR values into string on: July 30, 2009, 06:56:59 am
Got it, thanks.

That array sounds tempting.

So the array of 8 would look like this:

0:00010000
1:00100000
2:01000000
3:10000000
4:00001000
5:00000100
6:00000010
7:00000001

4  Forum 2005-2010 (read only) / Syntax & Programs / Re: SPCR values into string on: July 30, 2009, 06:33:09 am
Your code is for SPE and SPIE.
I am also seeking the values for all other bits.
I mean the values 0x80 or 0x40 are conditional, aren't they?
But then that's true too, because they're either 1 or 0 for each bit.
So I guess I have to query for the two possible states for each bit, right?
5  Forum 2005-2010 (read only) / Syntax & Programs / Re: SPCR values into string on: July 30, 2009, 05:19:13 am
Thanks AWOL,
but that 's conditional (if), I don't know the values, I need to read whatever is there (1) and then transform to a string (2).
6  Forum 2005-2010 (read only) / Syntax & Programs / Re: SPCR values into string on: July 30, 2009, 05:02:35 am
May be it's better to formulate my question in a different way.

We know that all SPI settings are determined by the Arduino SPI Control Register (SPCR).

The question is:

How can I read out values for each of the specifc bits and store each of them into a different variable?

In SPI these bits are:
SPIE, SPE, DORD, MSTR, CPOL, CPHA,  SPR1, SPR0
I'd like the values to displayed on screen and then be put into string-variables named like:
v_SPIE, v_SPE, v_DORD, v_MSTR, v_CPOL, v_CPHA,  v-SPR1, v_SPR0.

Displaying the values of SPCR on screen is not a problem, except the leading zero's are omitted. The command is Serial.print(SPCR,BIN);
How can I avoid leading zero's?
How can I read each bit separately?

Help and advice is appreciated.
Thanks.
7  Forum 2005-2010 (read only) / Syntax & Programs / SPCR values into string on: July 28, 2009, 08:27:14 pm
I get the SPCR values to be displayed on the screen just fine with the command below, but I couldn't copy them into a string variable (that should possibly also contain leading zero(s)).

   Serial.print(SPCR, BIN);

Kind of feel dumb to ask - your advice is certainly appreciated.
8  Forum 2005-2010 (read only) / Syntax & Programs / Re: Help to move 2 arrays into FLASH-Mem with PROGMEM on: May 12, 2009, 11:10:11 am
Issue resolved.

Below the code for those interested:

old code before using PROGMEM:
Code:
void fire(unsigned long t){                // open shutter for 't' milliseconds

new code using PROGMEM:
Code:
void fire(prog_uint32_t t){                // open shutter for 't' milliseconds

Well, basically quite simple, for those who learned this stuff properly.

Thread is closed.
9  Forum 2005-2010 (read only) / Syntax & Programs / Re: move 2 arrays into FLASH-Mem with PROGMEM on: May 11, 2009, 03:51:52 pm
Maybe I should add a bit more information.

This is the part of the code I need to adapt.
Only the lines marked with an asteriks * are of importance here.
What is the first line so that it reads the value for 't' from array 'exptime[]'?

Code:
void fire(unsigned long t){            // * this is the sequence to release the shutter

pinMode(FOCUS, OUTPUT);                  // outpin 6 gives output
pinMode(SHUTTERPIN, OUTPUT);            // outpin 4 gives output
digitalWrite(FOCUS, HIGH);            // initiate focus and camera ready ('r6' for the Nikon D300)
delay(INITfocus);                  // give time till camera 'beeps' the ready signal
digitalWrite(SHUTTERPIN, HIGH);            // initiate exposure, activate mirror-up / on Nikon D300 set d9=on, results in a 600ms delay till the actual exposure starts
delay(INITfire);                  // there must be a short delay so the circuit has just enough time to trigger the shutter release
digitalWrite(SHUTTERPIN, LOW);            // mirror is up and shutter has been released, the Shutterpin has no more effect can be set to LOW
delay(pgm_read_dword( &exptime[t]));      // * this is the actual exposure. Should be something like the following line
// delay(t);                         // * 't' should be known form the first line
digitalWrite(FOCUS, LOW);            // end the exposure delayed by 't'

}
10  Forum 2005-2010 (read only) / Syntax & Programs / Re: Help to move 2 arrays into FLASH-Mem with PROGMEM on: May 11, 2009, 01:03:11 pm
Great, thanks a lot BRIAN.
(your coding doesn't seem to be so 'badly' - in contrary).

The adjusted code is updated (at the url provided in previous post).

There is one last issue I'd like to get solved:
The array 'exptime[]' is now in FLASH-mem. So the command on line 569 must be changed as well as 't' referred to the current exposure time when this array was in the default memory space.

Code:
void fire(unsigned long t){
What is the proper syntax for this function when it's values are stored in PROGMEM?

I am almost certain there is an easy answer, but for me it's not so easy. Also I must confess this is my first big project I've done in C++, so please forgive my mostly 'basic' questions.

Thanks a ton, Hans.
11  Forum 2005-2010 (read only) / Syntax & Programs / Re: Help to move 2 arrays into FLASH-Mem with PROGMEM on: May 11, 2009, 12:30:02 am
Recap:

The problem with 'expstr' (described in the previous post) has been resolved. Some lines were missing in the table for this array.
Code:
PROGMEM const char *expstr_table[] = {expstr_00, expstr_01, ..., ..., expstr_46};

Meanwhile I have moved the other array for 'exptime' into FLASH-mem with the following command:
Code:
PROGMEM prog_uint32_t exptime[] = {601, 602, 603, 604, 606, 608, ..., ..., 14400600};
This seems to work allright.

But for some reason I cannot access the values this array contains.
I was playing with some cocmmands like below, but did not succeed.
Using this command for example:

Code:
lcd.cLCD_String(strcpy_P(exptime, pgm_read_word_near(exptime[b])), MN_X+75, MN_Y+80, RED, WHITE);

produces the following error:
Code:
error: cannot convert 'prog_uint32_t*' to 'char*' for argument '1' to 'char*' strcpy_P(char*, const prog_char*)'
Hhm, I'd think I am having a syntax problem.

Unfortunately the sample code for reading and writing unsigned chars (bytes) and ints (2 bytes) to PROGMEM provided at the PROGMEM reference page does not work.
http://www.arduino.cc/en/Reference/PROGMEM

It would be a great help for me to be able to retrieve the unsigned long values from the array 'exptime'.

... or to find some sample code to see how unsigned long values can be properly retrieved and used for further processing.

Thanks for some feedback on this topic.


12  Forum 2005-2010 (read only) / Syntax & Programs / Re: Help to move 2 arrays into FLASH-Mem with PROGMEM on: May 10, 2009, 04:39:29 pm
Thanks for reply.
Here is what I did so far.

There are 2 arrays to be put into Flash-mem. For now I have only been working on the one for 'char* expstr[]'.
The effect is that since the array is in Flash-mem the code no longer crashes. (so the initial problem solved).

But I am having trouble to display the content of the variable 'expstr' for value '' (b = base exposure).
The code is here: http://www.halo-photographs.com/remote-shutter-release-timer/the-arduino-code-Flashmem1.html

The array 'char* expstr[]' starts at line 78 till 162.
The variable is defined on line 187.
The content of this variable is used for display at line 287 for the first time like this:

Code:
strcpy_P(expstr, (char*)pgm_read_word(&(expstr_table[b])))
The problem is when value > 10 then it displays instead of the corresponding string in the array, the array srting that has a value +10.

This can be easily confirmed by entering the value for manually, see line 288. eg. for value '11' the array spits out the string for value '21'.

So the array is placed into Flash-mem, it returns strings as anticipated, but if the arrays register value is > 10 it adds another 10.

I have no idea what might cause this behaviour.
Seems to be an issue of proper syntax - don't konw.

Suggestions are most welcome.
13  Forum 2005-2010 (read only) / Syntax & Programs / Help to move 2 arrays into FLASH-Mem with PROGMEM on: May 10, 2009, 03:35:03 am
Hi all,

I modified a sketch for triggering a camera.
This sketch contains 2 arrays that I need to move into FLASH mwmory in order for the menu on the LCD to operate correctly.
The problem is that when flipping thorugh the pages more than 10 times, ARDUINO resets itself
The code and the project description is here:
http://www.halo-photographs.com/remote-shutter-release-timer/the-arduino-code-test.html

I hope someone can help me on the syntax to move the 2 arrays into FLASH memory. I've gone through the PROGMEM Reference but was not able to achieve a useable result.
Thanks for your cooperation, suggestions and feedback.

14  Forum 2005-2010 (read only) / Interfacing / gphoto2 on ARDUINO or anther AVR? on: May 15, 2009, 10:01:29 pm
I am curious about a possibility of porting gphoto2 to an ARDUINO or another light-weight device.
Does anyone have some ideas, hints or suggestions?
15  Forum 2005-2010 (read only) / Français / Re: bus SPI 1 maître et 2 esclaves, comment fait on ? on: June 07, 2009, 07:31:59 pm
Merci pour vos reponses.

J'ai compris en theorie, mais comment fair en pratique?

J'ai commençé un 'thread' du même topic en anglais:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1244417398.

A bientôt, Hans.
Pages: [1] 2 3