Reusing library from arduino to another mcu

Status
Not open for further replies.

MacIntoshCZ

Active Member
Hi,
i would like to reuse library for 1602 display in non-arduino project.
My first question is what are those hex values written after defining function in library file .h?

So far i need only to change lines which are using command from Arduino.h library am i right?

Its better to use already writed library but this is just for learning purpose.
 
#define Places an identifier instead of the binary command... ie.. Send 0x1 to the display and it clears the display and sets the cursor to home.

Then instead of remembering the code in binary.
LCD_COMMAND(0x01);
you can use English ( or whatever you like )
LCD_COMMAND(LCD_CLEARDISPLAY); make it more readable..
 
You also need to know .cpp files are C++ and may be in class form..
 
Thanks i forgot that. Now i remember.
 
Can i redefine something in main.c? There are defined ports in HD44780_settings.h . If i use #define again in main.c will it overwrite it? I
 
No... When you define a variable its not possible to redefine.. You can, however, define two lables to one constant..

BUT!! I think it has to be global...
 
No... When you define a variable its not possible to redefine.. You can, however, define two lables to one constant..

BUT!! I think it has to be global...
What compiler routine looks like? Does compiler check for #define in main.c first? If so i could change define to ifndef?
 
What is it you are trying to achieve... define and ifndef are pragmas for compile time...

Are you trying to make the LCD connect to A or B??
 
I just want to assign mcu pins to lcd pins. Is better to setup port in main.c or in added library?
I though that this library has as default assigned pins on port D and i can redefin them.
 
I normally have an LCD.C file that I include.. Then I chuck the necessary defines and such in a LCD.H file...
 
What undefined reference means?
I included "HD44780.h" which cointains these functions.


Its MIT licence so i gues i can upload it here. I have these files in my project folder. Even Atmel studio itself shows help when writing these functions.
 

Attachments

  • HD44780.c
    11.9 KB · Views: 217
  • HD44780.h
    2.6 KB · Views: 209
  • HD44780_Settings.h
    1.3 KB · Views: 243
  • IO_Macros.h
    1.9 KB · Views: 223
Last edited:
You didn't define those function calls Have you placed HD44780.h in your main C file??
 
Okay!...

#include "HD44780.H" implies that the header and C file are in the same directory as your "main" C file..

Also make sure HD44780.C is in the build.. I'm not familiar with your IDE so I need to understand what the linker is doing... BUT!! this error is weird, because if the header cant be found, a different error would occur.

What compile are you using?
 
In the HD44780.C there are a number of incorrect lines... Arduino specific functions... Including digitalWrite(); and bitCheck();

This makes me believe that the C file isn't being compiled..
 
This is weird. On new project i added util/delay.h library and it says F_CPU is not defined. With added #define in main.c it says its redefined
I dont think its supposed to edit cpu frequency in delay.h.

location of previous definition:

Is this just for calculations?
 
Ok i think i know why its not working. The reason is becouse its not working.
Atmel STUDIO is dead. It disapears from internet. You cant download it anymore (i mean officialy, but there are old version still avaible in microchip archives). On one forum i found it stops working with one W10 update and they just close it.
nice...
What i should use for AVR then? Visual studio code and link compiler?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…