Show Posts
Pages: 1 [2] 3 4 ... 452
16  Development / Suggestions for the Arduino Project / Re: Bug in serial uploading on: July 22, 2014, 02:56:38 am
I don't see how this is an Arduino problem.  Complain to the author of the ch340 USB driver.
 "tty.wch ch341 usb=> RS232 1d120" is an amazingly bad choice of name for a unix-like file!
17  General Category / General Discussion / Re: Good career options for arduino enthusiasts, and similar tech minded people? on: July 21, 2014, 04:07:52 pm
Yeah: artist, electronics technician, entrepreneur, "consultant."
Most of these are pretty "iffy" (check out the average yearly income for an "artist"!); for a good career, you should go after a degree.  The ability to build working Arduino projects will put you quite a bit beyond the CS or EE majors that did nothing beyond their classes and assignments.  But the degree will put you far beyond the hobbyist in areas like physics, math, "theory", and other areas that employers think might be important someday.  And they can be: you may never need to solve a symbolic differential equation, but I can't imagine doing much with PID control algorithms without having done calculus.  Or that blank look some people get when you explain that graphics transformations can be done with matrix multiplies.  For those entrepreneur and consultant careers, you ought to have some business classes (perhaps a LOT of business classes.  Depressing, but true.)

http://medriscoll.com/post/9117396231/the-guild-of-silicon-valley

There's also a "job security" issue: you may find a perfect job hacking arduinos and such, but if you lose that job, finding new opportunities without a degree may be difficult.  I know people with 30+ years of experience who were laid off and now having troubles getting their resume past the 'first tier' of screeners at potential employers. :-(

18  Development / Other Hardware Development / Re: Help programming atmega328 chip on: July 21, 2014, 02:08:28 am
There are two bootloaders commonly found on m328 chips, and you need to match your "board" setting to the bootloader, rather than to the hardware of your board.  Try "Uno" for the optiboot bootloader, and "Duemilanove w 328" for the older atmegaboot bootloader...
19  Using Arduino / Programming Questions / Re: Free Flash memory remaining? on: July 21, 2014, 01:31:10 am
The linker produces a symbol "_etext" just beyond the last flash address used.  So this should be the first free flash location when your sketch starts.  As you write flash, you'd have to keep track of how much you've written on your own.  (though I still suspect that things are not going to work the way you expect.  The AVR is NOT one of those architectures where it is "easy" to use the flash program memory as non-volatile storage.  You might look at "amforth" as an example of a program that does rewrite flash on the fly...)

Code:
extern const short PROGMEM _etext;

void loop()
{
  delay(2000);
  fp("\nCompiled for " __CPUNAME "\n");
  fp("Etext = 0x");
  Serial.println((unsigned long)&_etext, HEX);
Produces:
Compiled for ATmega328P
Etext = 0x1DC2
20  Using Arduino / Programming Questions / Re: Arduino uno R3 timer 1 in CTC mode pulses once after reset, will not re-trigger on: July 21, 2014, 01:10:30 am
I don't actually see anything wrong.  But I'm not an expert manipulating the AVR timers...

I'd be a lot happier if you separated the timer initialization (modes/etc) from the code that you expect to repeat.  "Restoring to initial state" seems like a poor idea.  (Hmm.  Are you restoring to the AVR "reset" state, or to the state that the arduino init() code sets the timers to?)

How about some symbolic constants for those timer register bits?

It doesn't seem like a good idea to me, to reset the port pins to inputs immediately after the OCC matches both occur.  don't you want the pulses to be "active" ?

You want something like this, right?
 
Code:
  initialize_timer();
   while (1) {
     start_timer(); // start both pulses.
     while (!(doneA && doneB))
        ;  // spin, waiting for both pulses to complete.
     stop_timer();
     delay(2000);
   }  // repeat the pulses 

Why don't you start by writing it just like that?  if it's too slow AFTER it is working, you can work on optimizing it by glopping all the code together.  (but the compiler will probably do that for you anyway...)

In general, I think we don't emphasize breaking code into modular pieces enough in these forums...  :-(

21  Using Arduino / Microcontrollers / Re: The Armalite, SAM3 32-bit "Arduino-Due-compatible" design on: July 21, 2014, 12:16:40 am
Teensy 3.1?
22  Using Arduino / Microcontrollers / Re: I want to be sure before going to the next step..... on: July 20, 2014, 09:00:00 pm
Quote
I want to be sure this board will "work"
That's a problem with the cheap eBay variations: being "sure" is pretty tough.  Frequently you have some design that has "propagated" through several layers of designer/manufacturer, and a vendor that is clueless about arduino (or ANY electronics) (and is also selling toys, clothing, etc.)  You have to buy them and try them out, and hope that your source doesn't change the board they provide sometime mid-way through the number of boards you were planning to buy from them.

I've heard that the ch340 USB chip used in this version does not have a MacOS driver, for example.  (but spycatcher's file include one, so perhaps that it obsolete info.)  (http://forum.arduino.cc/index.php?topic=226370 )
23  Using Arduino / Microcontrollers / Re: Reburn STAMP BASIC on: July 18, 2014, 01:15:14 am
Quote
Note that while this board would work pretty well as a general purpose prototype board, it's designed for using the Propeller chip, which isn't even a Basic Stamp...
24  Using Arduino / Programming Questions / Re: Free Flash memory remaining? on: July 18, 2014, 12:50:06 am
Quote
I'm adding and holding data as needed in FLASH thanks to PROGMEM.
You can't "add" to PROGMEM data in flash at runtime; PROGMEM is read-only data.  you use pgm_read_byte() or similar to read the data from PROGMEM variables, and there is no equivalent for writing data.  (The "bootloader section" of the AVR can write to flash, but that doesn't use PROGMEM and requires manual operations considerably more complex than dereferencing pointers.  And Arduino sketches are not in the bootloader section, so they can't do it anyway.)

Now, the flash memory space goes from 0 to 32k, and part of that overlaps the RAM address space (which goes from 0x100 to 2k+0x100), so if you carelessly dereference PROGMEM pointers, you'll end up reading/writing to RAM instead, which MIGHT look like it's working as long as the addresses you write doesn't overwrite data important for something else...)
25  Using Arduino / Programming Questions / Re: Fast DigitalWrite, made from Wire lib source on: July 18, 2014, 12:39:46 am
Quote
Quote
no one has implemented a variation that handles all the different cases of constant/variable pinnumber/value at the maximum theoretical speed
Given the AVR internal design limitations, it is impossible to get the best/fastest i/o performance when things are not known at compile time.
What I meant was:  It's possible to get "the best" performance given a particular set of criteria.  For digitalWrite(pin, val), there are four interesting cases that might be optimized:
variablePin, variableVal : this is the case implemented by the current digitalWrite() function.  It's pretty slow, but it needs to be.
constantPin, constantVal: this case is optimized by most of the "digitalWriteFast" implementations.  for many cases, it becomes a single AVR instruction.
constantPin, variableVal : codeNewton's implementation does this, sort of.  Implementation speed in a complicated version could be dependent on WHICH pin is used.
variablePin, constantVal : this could be slightly faster than the "both variable" case.
My initial statement was meant to mean that I haven't seen a "digitalWrite()" equivalent that does separate optimization paths for all 4 cases...
26  Using Arduino / Microcontrollers / Re: Reburn STAMP BASIC on: July 18, 2014, 12:25:27 am
Quote
I was gifted a stamp professional development board
There's not enough information there to tell exactly which stamp variation you actually have (there are a bunch.)  Many of the Basic Stamps are based on one-time-programmable chips that you won't be able to re-program even given a current PIC development device.  Even if you have a board with a flash-based chip, none of the Stamp boards are designed for using as a general purpose development board - there is no connector for uploading microcontroller code, nor any debugging port access.  (just the loader for the tokenized basic-like language used by the stamps, which is stored in EEPROM external to the microcontroller.)

And that's not how you should use it anyway.  Keep in mind that the Basic Stamps are essentially the "prior generation" of "easy-to-use" microcontrollers (compared to Arduino.)  They're interesting and relatively powerful devices in their own right, and significantly and interestingly different from an Arduino.  Since interpreting bytecodes loaded from serial eeprom is inherently rather slow (a BS2 executes about 4000 statements/second, compared to ~1M for an arduino), the stamp moves a lot of the "heavy lifting" into well thought-out "statement" definitions (some of which have been copied into arduino (shiftout comes to mind, and BS has a bunch of useful statements that are not present in arduino.)  You should give it a try even if you dislike basic; since code tends to be statement-selection (library call) intensive, the language doesn't really bare much more resemblance to traditional basics than, say, a bash shell script.

If you really would rather program bare PICs (in assembler or C), you'd be better off trading your stamp for one of the Microchip starter kits.  Or get a Chipkit (PIC32, arduino sorta-compatible) and use that.  (a lot of people would urge you to skip the 8bit PICs entirely; the 16 and 32bit PICs are a lot more modern-programmer-friendly.)
27  Using Arduino / Programming Questions / Re: why do we use int instead of long on: July 15, 2014, 01:40:48 am
Quote
The arduino is an 8 bit processor  so every time you add two long numbers together it has to load and unload bytes 16 times.
That seems like a misleading statement.  To handle a (32-bit) long, it takes approximately 4 times as many instructions as it does to do the same operation on an 8-bit operation.  For an add, that does end up being about 16 instructions, but the similar 8-bit add would have used 4.  ("loadA, loadB, add, storeC"  vs "loadA0, loadA1, loadA2, loadA3, loadB0, loadB1, loadB2, loadB3, add0, adc1, adc2, adc3, storeC0, storeC1, storeC2, storeC3")
28  Using Arduino / Programming Questions / Re: Fast DigitalWrite, made from Wire lib source on: July 15, 2014, 01:32:05 am
There was relatively extensive discussion of the arduino max pin toggle speed (digitialWrite, and alternatives) in this old thread: http://forum.arduino.cc/index.php?topic=4324.0
The exact details may have changed somewhat, but the basics should still be the same.

Note that most of the faster alternatives rely on on both the pin number and the value being 'written' being constant.  If they're not, you won't get nearly as much improvement (if any.)  AFAIK, no one has implemented a variation that handles all the different cases of constant/variable pinnumber/value at the maximum theoretical speed: you either get "fast" if everything is constant, or "slow"  (or "doesn't work") if anything is non-constant.  The original arduino implementation actually isn't "awful", considering what it does.

I agree that fat16lib's variation is one of the nicest C++ style versions.  I learned a lot just by trying to figure out what he had done...
29  Using Arduino / Microcontrollers / Re: Atmega328P-PU identifies itself as 328-PU on: July 08, 2014, 02:23:55 am
There were some messages on avr freaks  to the effect that the whole signature row COULD be written using undocumented programming commands...
30  Using Arduino / Programming Questions / Re: How to clear serial buffer? on: July 03, 2014, 12:42:02 am
Using a standard "queue" template to implement a serial port buffer is the sort of thing that gets C++ programmers sneered at by embedded systems people...

Although I'm not sure that it would necessarily do a bad job, if you were really careful about which one you used.  (probably you would get an implementation that kept extra pointers around in case you wanted to unread/reread, whether you wanted them or not.
Pages: 1 [2] 3 4 ... 452