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 974447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:26:18+00:00 2026-05-16T03:26:18+00:00

On my 8-bit Freescale HCS08 micro, whenever I call a library function that returns

  • 0

On my 8-bit Freescale HCS08 micro, whenever I call a library function that returns values to pointers I pass it, and I don’t really want them, I threw in a NULL, e.g.

UART_SendBlock((char *)txstr, strlen(txstr), NULL);

The type of the last argument is uint16_t * and returns the number of characters actually sent, a value I don’t care about.

However, I was having problems with port A on my micro being hosed every time that function was called, and debugging pointed me to that argument screwing things up. Port A’s configuration registers live at addresses 0x0000 and 0x0001, which is where NULL (aka (void *)0) points. I thought NULL was somehow magic where it wouldn’t actually do anything, but it doesn’t seem so.

My workaround feels really hack:

#define MNUL (void *)(&mynull)
uint32_t mynull;

Is there a better solution? I tried defining MNUL to an unused segment of memory on my processor, but that causes an immediate reset.

  • 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-16T03:26:19+00:00Added an answer on May 16, 2026 at 3:26 am

    Unless the documentation for UART_SendBlock states that passing it a NULL pointer is ok , you probably get undefined behavior if you do – and in this case it seems the function just writes to the address you pass it, address 0 – which would go under “undefined behavior”.

    Just call it with a parameter, there’s no reason to be “clever” about it.

    uint16_t unused_16;
    UART_SendBlock((char *)txstr, strlen(txstr), &unused_16);
    

    If you are resource constrained, make unused_16 a global and reuse it in other places

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Bit of a niche question really. When I say securely, I don't mean SSL.
bit of noob question regarding .Net and C#. I have a function that registers
Bit support question. Apologies for that. I have an application linked with GNU readline.
While reading one Freescale processor manual I stuck somewhere, which specifies that it is
Bit of a strange problem here... I've got an update query that isn't working,
Bit of a problem here, basically I have a web address that I use
Bit long title, comes down to this: <?php class error { public function error($errormsg
Bit of a newbie here. I'm currently working on a MySQL table that lists
bit of an issue with a function I'm writing for adding and subtracting a
Bit of a puzzle for you.... I have a 730px wide, auto height div.

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.