This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with software, need help

Hi,

i have some troubles with my software which i doesn't understand maybe some one with more microcontroller Experience cann tell me how to solve this Problem.

I have a method which waits for a Time, its like the nrf_delay but instead of this i use my own method wait_ms (TimeToWait). If i use this method in the main loop it works fine, it waits for the "TimeToWait" and then the programm is going on. But if i use this method int an timertimeout-method like my systemOff( )- method it doesn't work and i don#t understand why.

The same is if i use a method to run pwm on one pin. If i use this method in the main loop, the pwm method works but if i use it in an timeouthandler or in the SystemOff () method it does not work.

And i don't know what a reason for this could be, it would bee great if some one have an idea beacouse its a realy silly problem but it hang up the hole microcontroller.

Thanks and best regards Nils :)

Parents
  • Hi Martijn, Thanks for your feedback.

    Yes you are right, my system off mode is just a reset of the device. After a reset it is waiting for an interruptb__WFI ( ). But i think thats not the problem.

    The Problem is that i can use some methods in the main loop but not in an Timeout methods, and i can't understand why.

    One method is wait_ms (TimeToWait). The Timervariable_to_wait variable will be increment every millisecond.

    
    
    void wait_ms (uint16_t TimetoWait)
    {	
    	uartStr("\nStarte Warte-Timer");
    	Timervariable_to_wait=0;
    	while (Timervariable_to_wait != TimetoWait)
    	{
    			
    			//uartDig(Timervariable_to_wait);
    			
    			//Warte hier für die Zeit TimetoWait
    	}		
    }
    
    

    if i call this method in the main and it works but if i call this in in timeout_handle it doesn't work.

    And its also if i call a method which i use for PWM (i use Timer 2)

    Is it possible that a method which need a Timer can not be called in a TimerTimeouthandler? But this would be very bad for me.

    Best regards Nils

Reply
  • Hi Martijn, Thanks for your feedback.

    Yes you are right, my system off mode is just a reset of the device. After a reset it is waiting for an interruptb__WFI ( ). But i think thats not the problem.

    The Problem is that i can use some methods in the main loop but not in an Timeout methods, and i can't understand why.

    One method is wait_ms (TimeToWait). The Timervariable_to_wait variable will be increment every millisecond.

    
    
    void wait_ms (uint16_t TimetoWait)
    {	
    	uartStr("\nStarte Warte-Timer");
    	Timervariable_to_wait=0;
    	while (Timervariable_to_wait != TimetoWait)
    	{
    			
    			//uartDig(Timervariable_to_wait);
    			
    			//Warte hier für die Zeit TimetoWait
    	}		
    }
    
    

    if i call this method in the main and it works but if i call this in in timeout_handle it doesn't work.

    And its also if i call a method which i use for PWM (i use Timer 2)

    Is it possible that a method which need a Timer can not be called in a TimerTimeouthandler? But this would be very bad for me.

    Best regards Nils

Children
Related