Searching \ for '[PIC]: Extending TMR2' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Extending TMR2'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Extending TMR2'
2001\10\17@085517 by Mike Blakey

flavicon
face
I'm currently using a 16f876 20Mhz. in an application.  I need to delay an output
between 0.06s and 0.003s.

I have pre and post scaled to 16 on TMR2 but can only get a max. delay of 0.029s  I
can not afford the overhead of waiting and counting interrupts. does anyone have
any *smart* ideas to extend the time period?



********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2001\10\17@103825 by Roman Black

flavicon
face
Mike Blakey wrote:
>
> I'm currently using a 16f876 20Mhz. in an application.  I need to delay an output
> between 0.06s and 0.003s.
>
> I have pre and post scaled to 16 on TMR2 but can only get a max. delay of 0.029s  I
> can not afford the overhead of waiting and counting interrupts. does anyone have
> any *smart* ideas to extend the time period?


Hi Mike, what's the main problem? Do you need
seamless and adjustable period delays? What
resolution do you need, how may total delay
periods do you need etc. More info is needed
before the best solution can be suggested. :o)
-Roman

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam@spam@mitvma.mit.edu with SET PICList DIGEST in the body


2001\10\17@111143 by Drew Vassallo

picon face
>I'm currently using a 16f876 20Mhz. in an application.  I need to delay an
>output
>between 0.06s and 0.003s.
>
>I have pre and post scaled to 16 on TMR2 but can only get a max. delay of
>0.029s  I
>can not afford the overhead of waiting and counting interrupts. does anyone
>have
>any *smart* ideas to extend the time period?

Maybe this isn't what you're looking for, since you haven't included any
details about the function of your program, but, how about this:

1) Clear a flag bit when you set your output low (for example)
2) When you get your .029s interrupt, check the flag bit.  If clear, set it.
 If set, then change your output high (2*.029s ~ .06s).

Of course, you'd have to set your delay for 1/2 of what you need, then use
the flag to double it.

I'm not sure if you need better precision, but since you mentioned a range
of .003s and .06s, this might be good enough.  And you'd only have a .002s
max error (assuming your max. delay possible is REALLY .0290 seconds) with
the flag's doubling effect.

--Andrew

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2001\10\17@232933 by Gennette, Bruce

flavicon
face
A cheap, external hardware solution uses a counter chip fed from OSCout.
You select a counter output to feed back to the counter's reset AND to a
timer input.

Bye.

{Original Message removed}

2001\10\18@044719 by Mike Blakey

flavicon
face
Thanks for the help. I need to vary a pulse width between 0.06s and 0.003s (using a
20Mhz, TMR2 16prescale & 16 post scale,  that is a count of between 563 and 4)
obviously, I run out at a count of 255 (0.029s) whilst TMR2 is timing this period
the PIC is busy doing other stuff. What am after is to put a value into TMR2, set
the output, have it time out the required period, interrupt once to reset the
output, therefore giving me the simple variable pulse width. This is a repetitive
pulse, but is initiated from an other input. All the other timers are 'in-use'.
8bit resolution is fine, and a minimum resolution of approx. 0.00012 will be fine.

Thanks for any advice.





.....fastvidKILLspamspam.....EZY.NET.AU on 18/10/2001 01:25:43
Please respond to EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDUspam_OUTspamTakeThisOuTINTERNETspam_OUTspamTakeThisOuTwtgw

To:     PICLISTspamspam_OUTMITVMA.MIT.EDUspamspam_OUTINTERNETspamspam_OUTwtgw
cc:
Paper Mail:
Subject:        Re: [PIC]: Extending TMR2

                  *** WARNING ***

This mail has originated outside your organization,
either from an external partner or the Global Internet.
    Keep this in mind if you answer this message.


Mike Blakey wrote:
>
> I'm currently using a 16f876 20Mhz. in an application.  I need to delay an output
> between 0.06s and 0.003s.
>
> I have pre and post scaled to 16 on TMR2 but can only get a max. delay of 0.029s
I
> can not afford the overhead of waiting and counting interrupts. does anyone have
> any *smart* ideas to extend the time period?


Hi Mike, what's the main problem? Do you need
seamless and adjustable period delays? What
resolution do you need, how may total delay
periods do you need etc. More info is needed
before the best solution can be suggested. :o)
-Roman

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email @spam@listservKILLspamspammitvma.mit.edu with SET PICList DIGEST in the body








********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

--
http://www.piclist.com hint: To leave the PICList
KILLspampiclist-unsubscribe-requestKILLspamspammitvma.mit.edu


2001\10\18@062552 by Mike Blakey

flavicon
face
Thanks for the reply, This is exactly what I was looking for, the only problem I
have is that during the pulse period the PIC is 'busy' doing some other stuff!  I
think I'm going to have to do as you have suggested, even counting several
interrupts will give higher resolution, but may cause me stack problems, which is
what I am trying to avoid.

Thanks for the help.





RemoveMEsnurpleTakeThisOuTspamHOTMAIL.COM on 17/10/2001 15:10:56
Please respond to spamBeGonePICLISTspamBeGonespamMITVMA.MIT.EDUspamBeGonespamINTERNETspamBeGonespamwtgw

To:     TakeThisOuTPICLISTEraseMEspamspam_OUTMITVMA.MIT.EDUEraseMEspamspam_OUTINTERNETEraseMEspamspam_OUTwtgw
cc:
Paper Mail:
Subject:        Re: [PIC]: Extending TMR2

                  *** WARNING ***

This mail has originated outside your organization,
either from an external partner or the Global Internet.
    Keep this in mind if you answer this message.


>I'm currently using a 16f876 20Mhz. in an application.  I need to delay an
>output
>between 0.06s and 0.003s.
>
>I have pre and post scaled to 16 on TMR2 but can only get a max. delay of
>0.029s  I
>can not afford the overhead of waiting and counting interrupts. does anyone
>have
>any *smart* ideas to extend the time period?

Maybe this isn't what you're looking for, since you haven't included any
details about the function of your program, but, how about this:

1) Clear a flag bit when you set your output low (for example)
2) When you get your .029s interrupt, check the flag bit.  If clear, set it.
 If set, then change your output high (2*.029s ~ .06s).

Of course, you'd have to set your delay for 1/2 of what you need, then use
the flag to double it.

I'm not sure if you need better precision, but since you mentioned a range
of .003s and .06s, this might be good enough.  And you'd only have a .002s
max error (assuming your max. delay possible is REALLY .0290 seconds) with
the flag's doubling effect.

--Andrew

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email RemoveMElistservspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body








********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestEraseMEspam.....mitvma.mit.edu


2001\10\18@135556 by Drew Vassallo

picon face
>8bit resolution is fine, and a minimum resolution of approx. 0.00012 will
>be fine.

How can you expect to get a pulse resolution of .00012 if your instruction
cycle time is .0002 at 20 MHz?



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com hint: To leave the PICList
EraseMEpiclist-unsubscribe-requestspammitvma.mit.edu


2001\10\18@135953 by Drew Vassallo
picon face
>interrupts will give higher resolution, but may cause me stack problems,
>which is
>what I am trying to avoid.

If you're expecting to safely enter the ISR anyways because of the "normal"
TMR2 interrupt, there's no reason to expect stack problems just because
you're entering the ISR effectively twice as often.  And you will LOSE
resolution each time you go through the ISR (count more interrupts with a
smaller TMR2 scale), you won't get higher resolution.

--Andrew

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestEraseMEspamEraseMEmitvma.mit.edu


2001\10\19@033158 by Mike Blakey

flavicon
face
The instruction cycle time is 0.00000005s for a 20Mhz clock! and with both the post
scale and pre-scale set to 16 you get a TMR2 resolution of 0.0000128s!

Do you live near a black hole, where time is different from here?





RemoveMEsnurplespam_OUTspamKILLspamHOTMAIL.COM on 18/10/2001 17:54:59
Please respond to RemoveMEPICLISTTakeThisOuTspamspamMITVMA.MIT.EDUTakeThisOuTspamspamINTERNETTakeThisOuTspamspamwtgw

To:     EraseMEPICLISTspamspamspamBeGoneMITVMA.MIT.EDUspamspamspamBeGoneINTERNETspamspamspamBeGonewtgw
cc:
Paper Mail:
Subject:        Re: [PIC]: Extending TMR2

                  *** WARNING ***

This mail has originated outside your organization,
either from an external partner or the Global Internet.
    Keep this in mind if you answer this message.


>8bit resolution is fine, and a minimum resolution of approx. 0.00012 will
>be fine.

How can you expect to get a pulse resolution of .00012 if your instruction
cycle time is .0002 at 20 MHz?



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com hint: To leave the PICList
RemoveMEpiclist-unsubscribe-requestKILLspamspammitvma.mit.edu








********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\10\19@120743 by Drew Vassallo

picon face
>The instruction cycle time is 0.00000005s for a 20Mhz clock! and with both
>the post
>scale and pre-scale set to 16 you get a TMR2 resolution of 0.0000128s!
>
>Do you live near a black hole, where time is different from here?

The quadrature timing for instruction pipelining in the PIC line of products
is a 4:1 ratio.  That means a 1/20MHz * 4 = cycle time per instruction.

20MHz cycle time = 200ns = .2us

I don't live near a black hole, but maybe your datasheets got sucked into
one.

--Andrew



_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2001\10\24@053449 by Martin Hill

picon face
Without any units on here I could be completely wrong, but surely the cycle
time at 20MHz is 200ns, which is 0.0000002s.  Unless you are talking mS in
which case it is .0002ms, either way, it helps if you use some units!!

Martin

{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...