Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7493065
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T16:44:09+00:00 2026-05-29T16:44:09+00:00

I am programming an AVR microcontroller, and in the programmers notepad in the WINAVR

  • 0

I am programming an AVR microcontroller, and in the programmers notepad in the WINAVR Suite.

I am trying to seperate my code, however the sepeaet .c file I am unable to use AVR pre-defined variables. (the variables AVR supplies to point to certain BITs)

for example,
this code will work in my main.c file. but not in another random.c file:

 UBRR0H = (unsigned char)(ubrr>>8);

it gives the error :

random.c:6: error: 'UBRR0H' undeclared (first use in this function)

in my main.c file it only has the following includes:

#include <stdio.h>
#include <stdlib.h>
#include <util/delay.h>
#include <string.h>
#include <avr/interrupt.h>
#include "lcd.h"
#include "random.h"
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T16:44:11+00:00Added an answer on May 29, 2026 at 4:44 pm

    You have to create file like yours.h, where you put or your function definitions and macros definitions:

    #define UBRR0H (unsigned char)(ubrr>>8);
    
    int mine_function( char, char, int);
    
    ...
    
    extern int global_variable;
    

    not sure whether UBRR0H is macro or extranal variable

    In addition use something about extern variables and some articles about how to use them.

    And than in every your .c file you should:

    #include "yours.h"
    

    If you get in troubles because you’ll end up with many .h files and you’ll be including the same thing multiple times (will cause error, previously defined there), there easy hack, in yours.h:

    #ifndef _H_YOURS_INCLUDED_
    #define _H_YOURS_INCLUDED_ 1
    
    // Your real content
    
    #endif /* _H_YOURS_INCLUDED_ */
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use AVR Studio 5 to program an Atxmega64a1 with basic
Programming Student here...trying to work on a project but I'm stuck. The project is
Programming PHP in Eclipse PDT is predominately a joy: code completion, templates, method jumping,
Programming is learned by writing programs. But code reading is said to be another
Programming novice here. I'm trying to allow a user to enter their name, firstName
I'm trying to modify this code in an attempt to make it work on
Jquery/programming newb here. I'm trying to dynamically assign a height to a ul to
When programming for Android sometimes you have to use static methods. But when you
Programming an iPhone App, I need to use Google Maps api to get directions
Which programming language(s) were used to code Windows Vista?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.