Go Down

Topic: Using Arduino vs. AVR vs . AVRstudio/CrossPack (Read 2 times) previous topic - next topic

Osgeld

The most obvious is digital write vs PORT, digital write might take 40us  PORTB |= (1<<PB2); might take 4us. Or lets say you want to talk to a serial device that uses odd parity, you might have to go out and tickle some registers manually.

Quote
Another quick question, is there anyway to work around these issues by say creating your own libraries for these instances?


yea theres nothing stopping you from dropping AVRGCC (which is not the same as whats used in studio, but its AVR and C++) or ASM code in the middle of an avr sketch or library other than its harder for average users to read / change, and narrowing portability (like registers dont always stay the same in different AVR's)

retrolefty

Quote
My assumption is that since it is so much easier to use, that you must lose something.

So, my question is what do you give up by using Arduino vs. straight up AVR through one of the above mentioned methods?

Do you lose speed, do you lose some flexibility?

Any comments would be appreciated.


You don't have to lose anything in that you are free not to use any of the arduino defined functions and libraries if you don't want to. About the only thing that the arduino includes into every sketch is the timer0 interrupt function stuff to support millis() and micros() commands, which you could disable in your setup function if you wished to.

Arduino is using the gcc C/C++ compiler so you can pretty much fly solo if you wish and still work inside the arduino IDE. Having to use the predefined setup() and loop() functions is not that big a deal to work with or around.

Lefty


NJavrGuy


The most obvious is digital write vs PORT, digital write might take 40us  PORTB |= (1<<PB2); might take 4us. Or lets say you want to talk to a serial device that uses odd parity, you might have to go out and tickle some registers manually.

Quote
Another quick question, is there anyway to work around these issues by say creating your own libraries for these instances?


yea theres nothing stopping you from dropping AVRGCC (which is not the same as whats used in studio, but its AVR and C++) or ASM code in the middle of an avr sketch or library other than its harder for average users to read / change, and narrowing portability (like registers dont always stay the same in different AVR's)


Makes sense, thanks!

My biggest concern for speed is twofold:

1) serial communication speed
2) I2C speed

Do you lose any speed with either of these using Arduino?

Osgeld

not that I am aware of i2c supports normal and fast mode, serial supports 2400-115200 baud out of the box, with people pushing that up to 1Mbps,  since they use the internal hardware

NJavrGuy


not that I am aware of i2c supports normal and fast mode, serial supports 2400-115200 baud out of the box, with people pushing that up to 1Mbps,  since they use the internal hardware


Thanks much for your help!

Go Up