This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
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

Timer nrf24le1

Hello,

i am currently trying to integrate a timer properly to my project.

I want to set a pin to high for a duration of 1msec. I configured the timer like shown below:

//********TIMER STUFF**********
TMOD = (TMOD & 0xF0) | 0x20;  /* Set Mode (8-bit timer with reload) */
	
TH1 = 256 - 123;              /* Reload TL1 to count 133 clocks; overflow each ~0.0001 sec! */
TL1 = TH1;
	
ET1 = 1;                      /* Enable Timer 1 Interrupts */
TR1 = 1;                      /* Start Timer 1 Running */

The problem is, that if i choose a duration smaller than 2msec, the pin is always high. If i choose a duration greater than 2msec. Everything works fine.

Is there a maximum time value for swapping a pin from high to low?

Thanks for your help.

Parents
  • Hello, in this case it doesn't make any differnce right? 20 -> 100000 and 02 -> 10, but yeah i want to use it in reload mode. Basically i am setting the pin to high and then i count 10 timer interrupts. After 10 interrupts i set the pin to low again. The problem is, the pin is only toggeling between high and low for an interrupt count higher than 18. If i set the toggle time lower, the pin is set to high all the time. Unfortunately i need i toggle time smaller then 10 interrupts (1 millisec), but i am not sure why it reacts like that.

Reply
  • Hello, in this case it doesn't make any differnce right? 20 -> 100000 and 02 -> 10, but yeah i want to use it in reload mode. Basically i am setting the pin to high and then i count 10 timer interrupts. After 10 interrupts i set the pin to low again. The problem is, the pin is only toggeling between high and low for an interrupt count higher than 18. If i set the toggle time lower, the pin is set to high all the time. Unfortunately i need i toggle time smaller then 10 interrupts (1 millisec), but i am not sure why it reacts like that.

Children
No Data
Related