Show Posts
Pages: 1 ... 3 4 [5] 6 7 ... 462
61  Using Arduino / Microcontrollers / Re: Im seeking a bootloader for ATmega8 16 Mhz on: August 19, 2014, 02:33:00 am
Optiboot also includes support for ATmega8 at 16MHz.  The optiboot_atmega8.hex distributed with the Arduino IDE should do it, but you'll have to edit a boards.txt manually.  the latest optiboot no longer includes an ATmega8 .hex file, but you can build it yourself.
62  Using Arduino / Programming Questions / Re: FSM diagrams: states and transistions on: August 19, 2014, 12:01:17 am
In a "pure" state machine, the "fade" part would consist of multiple states, with boring transitions.
(LED10% -> LED20% -> LED30% -> LED40% ... unconditional, timed.  The process where a single state sits there and changes outputs is NOT "pure")  (of course, this level of purity can be annoying to implement...)
63  Using Arduino / Programming Questions / Re: programming confusion on: August 18, 2014, 11:55:26 pm
"int a,b;" is not an instance of the comma operator... :
"The use of the comma token as an operator is distinct from its use in function calls and definitions, variable declarations, enum declarations, and similar constructs, where it acts as a separator."

global variables are initialized to zero.  Local variables are not initialized unless you provide the initialization.
64  Using Arduino / Programming Questions / Re: programming confusion on: August 18, 2014, 07:17:03 pm
"int left, right=0;" defines two integer variables (left and right), but only initializes "right" to zero.
It has nothing to do with the comma operator.  (isn't C syntax wonderful?)
To initalize them both you could do
int left=0, right=0;
int left, right;

the following is also a legal set of C statements (an example of the comma operator), but is probably not a useful for anything.
(The comma operator should be avoided, almost always.)
int left, right;
left = right, 0;
65  Using Arduino / General Electronics / Re: Best PCB degign for beginner. on: August 18, 2014, 07:05:58 pm
the BEST PCB degign for beginner is the one that you can use !
I disagree.  The Best PCB design SW for a beginner is the one that they can LEARN to use in a reasonable time.  The whole "I need to be able to use it without reading manuals or tutorials" attitude is one of the most insidious errors a beginner can make.
66  Using Arduino / Microcontrollers / Re: ATmega328. Minimum size reserved for boot loader on: August 18, 2014, 10:21:23 am
There are also the protection bits.  There is a separate set for the code running "in the bootloader section" vs "in the application section."  Since one of the settings (used by Arduino, even) is that the application section cannot use LPM on the bootloader section, it is possible (but not very likely?) to have a program that would not work, depending on the BOOTSZ bits, even if it doesn't use BOOTRST.
67  Using Arduino / General Electronics / Re: How to distinguish between ‘reset’ and ‘real power loss’ ? on: August 18, 2014, 09:28:15 am
That sounds like "as designed."  Your sketch won't see EXTRF, because that's the one reason that invokes the bootloader code.
You should see PORF on power-on, though, and you know that WDRF means EXTRF, unless you've also turned on the WDT...

68  Using Arduino / Programming Questions / Re: loop exit. help on: August 18, 2014, 12:21:24 am
// what will i place here to exit the dothis function with a button press?
if (buttonPressed())
69  Using Arduino / Microcontrollers / Re: ATmega328. Minimum size reserved for boot loader on: August 18, 2014, 12:18:59 am
"upload using programmer" doesn't reset the fuses, afaik (there is no boards.txt entry for what the fuses should be in this case!), so it's actually sort-of broken.  If you do "upload using programmer" on a chip that has previously had its fuses programmed for use with a bootloader, it will leave the "BOOT_RST" fuse set, and the sketch will start in the wrong place.  Usually there won't be anything there, and the execution will just wrap around to the actual start vector at 0x0.
70  Using Arduino / Programming Questions / Re: progmem confusion on: August 17, 2014, 04:44:09 pm
sprintf_P(s, PSTR("%d%S%n"), a, disp);
Note capital S in the format string...
71  Using Arduino / Microcontrollers / Re: ATmega328. Minimum size reserved for boot loader on: August 17, 2014, 04:32:46 pm
To disable the boot section entirely, un-set the BOOT_RST fuse.  Without that being set, the size of the boot section is pretty unimportant.  (It does still control what code can write flash memory; that can be controlled with the lock bits.)
(The bootloader section is special because it has separate protections (BLB bits), and because you can get execution to start there after reset (BOOT_RST)  If you set the protections so that it can't do anything special, and have execution start at 0, it's the same has not having a boot section...)
72  Community / Bar Sport / Re: Environmentally Friendly Water Tanks... on: August 17, 2014, 02:56:59 am
Driving a lawn sprinkler will probably require a pump of around 100 to 200 watts.
Really?  The "booster pump" for my automatic pool cleaner seems to generate similar pressure/flow to the municipal water supply, and it's 3/4HP (~1500W) (and it needs the main pool pump feeding its input too, although that may just be a "getting the supply through the pipes" problem.)
73  Using Arduino / Programming Questions / Re: progmem confusion on: August 17, 2014, 02:38:10 am
Well, to start with, you'd have to find a version of sprintf() that supported progmem strings. :-(  (I don't think that one exists.)
The addition of the F() macro to Arduino's print() functions gave it a big advantage over traditional printf().  Since printf is a C function, it can't tell the difference between flash and ram pointers.
74  Using Arduino / Programming Questions / Re: A better way to do my bit reordering? on: August 17, 2014, 02:22:41 am
Check out this recent conversation on AVR Freaks:
(And in particular "__builtin_avr_insert_bits()")

I sort-of like your current code; it's very general and obvious.  Does it actually need to be faster?
You can probably speed it up by making the actualBits[] array be 16bits wide and contain a mask instead of a bit number, which turns the inside of your loop into:
if (bitValue == 1)
      actual = actual |  x;     //Or in the actual bit value.
(multibit shifts by a variable amount being particularly slow on an AVR...  Another speedup might be to shift y in the loop instead of using bitread.  That would ensure shifting by a constant 1 position.)
75  Using Arduino / Programming Questions / Re: Errors compiling any IRRemote examples on 1.5.6-r2 on: August 16, 2014, 08:32:29 pm
Hmm.  Looks like a naming conflict between the IRRemote library and some of the Arduino Robot Libraries?
When I copy the IRRemote dir from 1.0.5 to my Documents/Arduino/Libraries  folder, and try to compile with 1.5.7, I get nice messages like:

Build options changed, rebuilding all
Using library Robot IR Remote in folder: /Applications/arduino/
At the top of the verbose compiler output, Just before it all goes belly-up...

Pages: 1 ... 3 4 [5] 6 7 ... 462