Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

make a new function/lib for avr with c++ in winavr

Status
Not open for further replies.

mohseni

New Member
Dear users

Is it possible to make new function or a lib.( I dont know which one is correct) for avr including a header to introduce this function to winavr and use this function in main body of program? if so, how can build the body of header? if I write the codes of function in a text and save it by .h suffix, it will be allright? should I compile it before use it? I'll be pleased if someone help me.....
 
You can make a function right in your c++ program. But if you use it frequently you can make it into a file of its own.

Usually you declare the function (write its prototype) in a header (.h) file and define it (write the function body) in a .c file.

You would .include both the .h and .c files in your main c program. In WinAVR this means putting their names in the program as well as making sure there is a copy in the project under "Source Files" and "Header Files".
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top