Show Posts
Pages: 1 2 [3] 4 5 ... 434
31  Using Arduino / Programming Questions / Re: Having Difficulty With Accurate Readings Below 20 Celsius with MS5607 Altimeter on: April 09, 2014, 10:22:34 pm
Code:
      T2=(dT*dT)/(2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2);
Oh, don't do that!
C has this rule about doing math with "int" sized things, unless some element of the expression is larger than that.
Now, "dT" is a 64bit int, so that MIGHT cause the 2^31 (?) to be calculated using 64bit numbers.  But the 2s are also inside of parenthesis, which leaves me "uncertain" as to what the compiler will do.  You should NEVER be uncertain if you can avoid it.
You can fix this by making the constant expression also use 64bit numbers, like:
  (((in64_t)2)*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2)
or perhaps
 (1LL<<31)

avr-gcc is known to be pretty slow at 64bit math; it might be a good idea to restrict the 64bit calculations to exactly those expressions where they are actually needed.
32  Using Arduino / Programming Questions / Re: Having Difficulty With Accurate Readings Below 20 Celsius with MS5607 Altimeter on: April 09, 2014, 08:07:59 pm
Also, doesn't setting the bits on the output port of an input ENABLE the  pull-ups?
Code:
// Disable internal pullups, 10Kohms are on the breakout
 PORTC |= (1 << 4);
 PORTC |= (1 << 5);
33  Using Arduino / Programming Questions / Re: Having Difficulty With Accurate Readings Below 20 Celsius with MS5607 Altimeter on: April 09, 2014, 08:04:54 pm
Code:
if(TEMP < 2000) // if temperature lower than 20 Celsius
  {
    int32_t T1    = 0;
    int64_t OFF1  = 0;
    int64_t SENS1 = 0;
   
    t_mod = (TEMP - 2000)*(TEMP - 2000);
    T1 = (dT*dT)>>31;
    OFF1=(61*t_mod)>>4;
    SENS1=2*t_mod; 
  }

By declaring the variables inside the code block, you are creating new instances of them, which are discarded when the block is done.   That is almost certainly NOT what you want (since you don't actually do anything with the values you calculate.  In fact, gcc probably optimizes away the calculations and does nothing except setting t_mod.)

Lose the declarations...
34  Using Arduino / Programming Questions / Re: Any ideas on why this code would work on a Uno, but not on a micro? on: April 09, 2014, 04:09:21 pm
Does sw serial support SerialEvent?
35  Using Arduino / Microcontrollers / Re: Parallel Programmer usage ...‏ on: April 09, 2014, 02:56:30 am
0) It's a "parallel port progammer", but it isn't a "parallel programmer" (from the AVR perspective.)  It still uses SPI/ISP for the programming, which means the AVR needs to have a clock, and it won't recover from some of the mistakes that a "real parallel programmer would."
1) try AT; that's about the most basic, I think.
2) No; most USB/Parallel adapters are actually USB/Printer adapters, and don't provide the programmatic per-pin access that  programming requires.
36  Using Arduino / Programming Questions / Re: Array Basics (sizeof) on: April 08, 2014, 02:18:25 am
Quote
I showed clearly how to pass a pointer to an array and get the correct size using sizeof.
Code:
void Foo( arr_t *arrp ){
But that's not a pointer to an array; it's a pointer to a PARTICULAR SIZE of array.
37  Community / Bar Sport / Re: Your latest purchase on: April 08, 2014, 12:15:35 am
I have lots of UV EPROMs.  We used to use them 8 per board, and they weren't expensive enough to erase stock when the software upgraded.   (Eventually, we went to OTP EPROMs.  But I have a lifetime supply of EPROMs, a programmer, and an eraser.  (and even a PC with a parallel port for the programmer to connect to.  Yeah!)
38  Using Arduino / Project Guidance / Re: Suggestions needed: Arduino Camera on: April 07, 2014, 10:47:28 pm
An Arduino isn't really very suitable for doing actual image manipulation.  It doesn't have enough RAM.
(maybe an Intel Gallileo, or one of the new Arduinos with onboard linux co-processors.)
39  Using Arduino / Programming Questions / Re: Array Basics (sizeof) on: April 07, 2014, 10:26:01 pm
Quote
If you dereference a real pointer to an array, you can get the size using sizeof.
Only if it's a compile-time constant, right?
(and, are you sure?  I though ((sizeof array)/sizeof(*array)) was one of those tricks for finding the number of elements in an array...)
40  Using Arduino / Programming Questions / Re: Array Basics (sizeof) on: April 07, 2014, 10:10:27 pm
In C, a pointer to the array is THE SAME THING as a pointer to the first element of the array.  That's because arrays are just consecutive occurrences of elements; there is no additional internal structure describing the size of the array...
41  Using Arduino / Programming Questions / Re: Not Another avrdude: stk500_getsync(): not in sync: resp=0x00 error :(( on: April 07, 2014, 10:06:48 pm
Probably, the RTS signal held the chip in RESET at the wrong times.  The capacitive coupling ensures that only transitions of the signal (such as occur when the port is opened) cause the AVR to reset.
42  Using Arduino / Programming Questions / Re: Not Another avrdude: stk500_getsync(): not in sync: resp=0x00 error :(( on: April 07, 2014, 09:03:18 pm
Quote
and a resistor to the RTS of PL2303.
that doesn't sound right.  There are some versions of schematics floating around that show components in the autoreset circuitry that are not actually populated on real boards, because alternate components provide the same functionality.
43  Using Arduino / Microcontrollers / Re: Arduino ISP not working on: April 07, 2014, 11:05:25 am
Quote
avrdude -p attiny2313 -P com2 -c stk500 -b 19200 -U flash:w:main.hex
avrdude: stk500_2_ReceiveMessage(): timeout
that _2_ in the error message is a strong indicator that you're running the stk500v2 protocol rather than the stk500v1 protocol that is implemented by most of the arduino bootloaders.  That's one of the reasons that "-c arduino" was added.  If you MUST use the avrdude that came with winavr (instead of, say, copying the avrdude that came with arduino over to your winavr bin directory), try specifying "-c stk500v1"
44  Using Arduino / Programming Questions / Re: Not Another avrdude: stk500_getsync(): not in sync: resp=0x00 error :(( on: April 07, 2014, 03:31:50 am
How are you achieving RESET of the chip being uploaded to (for uploading from IDE)?

You said that blink.ino worked when uploaded; how did you upload it?  When you upload a sketch with a programmer (usbasp), it WILL erase the bootloader in the process of programming the sketch.  Only the bootloader itself can upload a sketch AND leave the bootloader untouched.
45  Using Arduino / Microcontrollers / Re: Arduino Uno R3-Compatibles with more memory on: April 06, 2014, 07:25:10 pm
Nope, not for "strict" definitions of "100% pin compatible."
You might try Crossroad's 1284 board that he's selling.  IIRC, he went to some effort to make the board Duemilanove-like in its pinout.  http://crossroadsfencing.com/BobuinoRev17/index.html
Pages: 1 2 [3] 4 5 ... 434