Can i use libraries of arduino?/Are Avr libraries different from one chip to other chip

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i dont have development board like arduino.

setup is just a breadboard ,some jumper wires connecting to avr(here im using atmega16),and 7805 voltage regulator thats it.

and i use codevision avr .i visited arduino website ,i checked libraries ..and they felt important to me .

Can i use those libraries?

if....

1)How can i use those libraries in this case.

2)In arduino there is a terminal to check output of code .how to check in my case

thanks

 

This topic has a solution.

Salman

Last Edited: Mon. Apr 3, 2017 - 06:15 PM
This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AFAIK there is no mega16 variant of Arduino so most of the code won't apply to your CPU anyway. (perhaps someone/somewhere has written a "core" for mega16?)

 

Arduino is written in C++. Codevision is a C not a C++ compiler.

 

Arudino uses GCC. Codevision is a different compiler.

 

You could try and port some of the C++ code to C and switch from GCC to Codevision but frankly if you want to use Arduino code in a non-Arduino environment the best approach is probably to get Studio 7 from Atmel (which includes the C and C++ compilers from GCC) and use its "import Arduino sketch" function to pull in Arudino programs and library code used.

 

Perhaps the easiest of all is to get onto eBay. Spend $5 and get an Arudino Uno clone and just use the Arduino system all together.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

salmanma6 wrote:
i dont have development board like arduino.

So get one, then.

 

Simples!

 

In arduino there is a terminal to check output of code

There are many standalone PC terminal apps; eg,

 

  • Termite
  • RealTerm
  • Bray
  • TeraTerm
  • PuTTY

 

As a Computer Scientist, it shouldn't be hard for you to write your own, surely ... ?

 

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Arduino's terminal is not the worst terminal I know (hyperterminal, under XP, is worse); even if it the second worst (cannt send/display non ASCI chars in hexa... many other features are missing), it exists and is very simple to use.

Each and every terminal awneil quoted is better, however...

 

Writing (with python + pyserial under GNUlinux if you like python and GNUlinux) one's own application to process avr's outputs (or any MCU...) is rather easy.

 

Huge advantages of Arduino are you can write very good code and be clumsy in hardware soldering -broad beards are unreliable-  (then, you use the hardware and on can program arduino in pure C/C++) or be clumsy in coding, though one can design and wire good hardware(then, Arduino comes with a lot of tested examples you can adapt easily)...

Last Edited: Wed. Mar 15, 2017 - 06:49 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are avr libraries different from chip to chip?

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the Arduino system, there are only about four or so CPUs that are used.  There are the ATmega328P for the UNO and Nano, the ATmega2650 for the Mega, the ATtiny85 for 8-pin applications, and the occasional ARM-based design that sells for about ten times the AVR Arduinos.

 

Library code will have usually have pre-processor IFDEF and ENDIF statements to handle any code lines that are specific to an individual device type.  Nearly all the code is the same between the devices in the library.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks!

Salman

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you have to process (say) a graphical display:

 

parts of it are hardware dependent

* MCU dependant of cpurse

 * display specific (one can choose between SPI and TWI interface)

These parts are difficult to read/adapt ( a lot of #IFDEF can be terrible)

 

parts of it are generic (ex : drawing a line/ displaying a char once one can draw a pixel)

 

Arduini can be other than 328/Mega2560/mini85  Edited : tiny85 (mini typo..)  I had a Dagu card http://www.gotronic.fr/art-carte... , based on a 168, which is supported by Arduino IDE -seen as a small 328 variant, IIRC- .

 

You have also the Leonardo or micro (both are atmega32u4 based, can be used as USB keyboardd/mice, say)

 

On the ARM side, the Arduino DUE is popular, and is about the same price as the Arduino Mega -but it needs 3.3 peripherals)

 

Another advantage of Arduino libraries is, if you want to buy Texas Instruments chips/kits  (and if the very cheap, very fast kit -they look interesting -  you will find keeps on being sold : Atmel is more serious and I hope they will keep on ...) , you can use Energia http://energia.nu/

Last Edited: Wed. Apr 5, 2017 - 09:23 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks!

Salman