1
\$\begingroup\$

I want to reset the timer before the timer interrupt.

In my case, I will use the Mod bus protocol for serial port. I had to reset the timer for each byte sent and send data if the timer reach 3.5 ts(Time for sending byte). It mean if we didn't receive any byte until (3.5ts s ) we send data, if not, we add new data in the buffer.

So in this case, I want to use two interrupts:

  • One interrupt for the serial port Rx. In this interrupt I will reset the timer.
  • One interrupt for the Timer where I will send the Buffer.
Blup1980
6,9603 gold badges30 silver badges49 bronze badges
asked May 5, 2014 at 7:13
\$\endgroup\$
2
  • 2
    \$\begingroup\$ Capitalization and punctuation will help make your question readable. \$\endgroup\$ Commented May 5, 2014 at 7:15
  • 1
    \$\begingroup\$ It's not clear what is asked here. You wan't to know how to implement what you described? Because right now it's not a question, but just a description of what you are doing. \$\endgroup\$ Commented May 5, 2014 at 11:19

1 Answer 1

0
\$\begingroup\$

Whenever you receive a byte, UART will generate an interrupt.In that ISR you can reset your timer to indicate that you have to wait for 3.5 bit time from now.

I never used this perticular controller, but to reset the timer, You can write 0 in it's timer/counter register OR there might a bit through which you can reset the timer. On checking datasheet, If you could set command to RESTART i.e. 10 in CTRLFSET register, it will restart the timer.

Everytime you recieve a byte, you will reset the timer and if no byte is recieved in 3.5 Bit time, Your timer interrupt will be generated and through that you can initiate the transmission!

answered May 5, 2014 at 11:39
\$\endgroup\$
1
  • \$\begingroup\$ thanks i had jut to use TCD0.CNT=0x0000; to rest the timer before the ISR \$\endgroup\$ Commented May 6, 2014 at 11:59

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.