problem with ADC Library, why we can't use internal AREF ?

General discussion on mikroBasic PRO for AVR.
Post Reply
Author
Message
ahsharififar
Posts: 1
Joined: 18 Sep 2010 21:32

problem with ADC Library, why we can't use internal AREF ?

#1 Post by ahsharififar » 07 Oct 2010 12:38

Hi
why i can't use internal AREF on avr chip ?
how can i bypass the ADC library and write my sub procedure to read ADC channel with internal AREF


Thanks in advanced
Amir hussein

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: problem with ADC Library, why we can't use internal AREF

#2 Post by tihomir.losic » 11 Oct 2010 12:06

Hello Amir,

mikroBasic PRO for AVR allows you to create your own libraries.
In order to create a library in mikroBasic PRO for AVR follow the steps bellow:

1) Create a new Basic source file, see Managing Source Files
2) Save the file in one of the subfolders of the compiler's Uses folder (LTE64kW or GT64kW, see note on the end of the page):
DriveName:\Program Files\Mikroelektronika\mikroBasic PRO for AVR\Uses\LTE64kW\__Lib_Example.mbas
3) Write a code for your library and save it.
4) Add __Lib_Example file in some project, see Project Manager. Recompile the project.
If you wish to use this library for all MCUs, then you should go to Tools › Options › Output settings, and check Build all files as library box.
This will build libraries in a common form which will work with all MCUs. If this box is not checked, then library will be build for selected MCU.
Bear in mind that compiler will report an error if a library built for specific MCU is used for another one.
5) Compiled file __Lib_Example.mcl should appear in ...\mikroBasic PRO for AVR\Uses\LTE64kW\ folder.
6) Open the definition file for the MCU that you want to use. This file is placed in the compiler's Defs folder:
DriveName:\Program Files\Mikroelektronika\mikroBasic PRO for AVR\Defs\
and it is named MCU_NAME.mlk, for example ATMEGA16.mlk
7) Add the the following segment of code to <LIBRARIES> node of the definition file (definition file is in XML format):

Code: Select all

<LIB> 
  <ALIAS>Example_Library</ALIAS> 
  <FILE>__Lib_Example</FILE> 
  <TYPE>REGULAR</TYPE> 
</LIB>
8) Add Library to mlk file for each MCU that you want to use with your library.
9) Click Refresh button in Library Manager
10) Example_Library should appear in the Library manager window.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

Post Reply

Return to “mikroBasic PRO for AVR General”