Previous in Forum: The Best Ultrasound Project   Next in Forum: about project
Close
Close
Close
3 comments
Rate Comments: Nested
Participant

Join Date: Feb 2009
Posts: 1

Timer Control - 16F877 Microcontroller

02/04/2009 12:22 AM

i want to controll the timer in the 16F877 microcontroller.........when a pulse input is given......how do i do that..........help desperately needed

Register to Reply
Interested in this topic? By joining CR4 you can "subscribe" to
this discussion and receive notification when new comments are added.
Guru

Join Date: Dec 2005
Location: Etats Unis
Posts: 1871
Good Answers: 45
#1

Re: Timer Control - 16F877 Microcontroller

02/05/2009 12:10 AM

"to control the timer" could mean a lot of different things. You need to provide more detail.

__________________
The hardest thing to overcome, is not knowing that you don't know.
Register to Reply
Associate
South Africa - Member - Member Shonver

Join Date: Apr 2008
Location: Cape Town, South Africa
Posts: 51
Good Answers: 2
#2

Re: Timer Control - 16F877 Microcontroller

02/05/2009 2:46 AM

From what I can remember, you need to set up an interrupt timer first. The input you use must also be an interrupt input, so if it sees a valid signal it will trigger an interrupt (it can be level-triggered or transition-triggered). This will call up your interrupt routine(s), which should be coded so that if this interrupt is true (see interrupt register) then your particular routine will be executed.

I'm very rusty, and some terminology may be off, but this is what I can remember of the little PIC programming I did during studies.

There are some internet forums dedicated to microcontroller applications that can help, and that provide standard code for various applications. This you can modifiy to suit your needs.

Also, do get hold of the Microchip manual/s for this chip. Last I looked (loooong ago) they had 2 versions, typically: one for the chip hardware and one for coding. These are essential if you want to learn how to use these chips. Programming can be done in assembler or C, the latter being the easier route, though understanding the assembler code can potentially allow you to be more versatile when coding.

HTH

__________________
DON'T PANIC
Register to Reply
Guru
Engineering Fields - Electrical Engineering - Been there, done that. Engineering Fields - Control Engineering - New Member

Join Date: Dec 2008
Location: Long Island NY
Posts: 15600
Good Answers: 981
#3

Re: Timer Control - 16F877 Microcontroller

02/05/2009 10:37 AM

As mentioned above you need to define your problem a little bi more clearly, but I am certain that you will want to have the input pulse signal activate an interrupt since polling may not look at the right time. Some possible ideas on what you want the pulse and timer to do are the following:

  1. Timer acts as a watch dog timer and the pulse resets the watch dog to detect missing pulses.
  2. Pulse generates a latch that turns on the timer to turn something else on for a preset time interval. Re-pulses may or may not reset timer but timer completion turns off latch.
  3. The timer acts as a time counter that at pulse instances the timer count down value gets loaded into some other register.
  4. The number of times a pulse occurs during the timer cycle.

Those are just a few suggestions. Once you define what you specifically want done, then you can proceed with you programing and testing.

Good Luck

__________________
"Don't disturb my circles." translation of Archimedes last words
Register to Reply
Register to Reply 3 comments
Copy to Clipboard

Users who posted comments:

rcapper (1); redfred (1); Shonver (1)

Previous in Forum: The Best Ultrasound Project   Next in Forum: about project
You might be interested in: Counter and Timer Boards

Advertisement