This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Warnings I cannot understand after compilation-Part1

This is going to be a strange request. I must warn that I am new to embedded programming and therefore what is obvious to you may not be to me.
I am trying to implement a real time clock program with the data then being transmitted on CAN. I am getting some warning when I compile my code and cannot understand what I need to do. Any help would be appreciated. I will be posting my code in parts as I cannot exceed a certain character limit.

Parents
  • So, if you ask a question here directly whenever you get stuck - exactly how will you learn how to find errors in your code? Exactly what do _you_ do right now, to figure out where you go wrong? Are you single-stepping in the debugger? Are you looking at the intermediaries?

    "[...] account for a day rollover."

    But you are not.

    What use do you have of the time.daysb variable, when you always start with the value zero?

    time.daysb = 0;
    if (time.daysa > time.daysb) {
        current_day = current_day + 1;
    }
    time.daysb = time.daysa;
    

    After your counter reaches past 86400 - what do you think will happen on every call to the function?

Reply
  • So, if you ask a question here directly whenever you get stuck - exactly how will you learn how to find errors in your code? Exactly what do _you_ do right now, to figure out where you go wrong? Are you single-stepping in the debugger? Are you looking at the intermediaries?

    "[...] account for a day rollover."

    But you are not.

    What use do you have of the time.daysb variable, when you always start with the value zero?

    time.daysb = 0;
    if (time.daysa > time.daysb) {
        current_day = current_day + 1;
    }
    time.daysb = time.daysa;
    

    After your counter reaches past 86400 - what do you think will happen on every call to the function?

Children
No data