Searching \ for ' [PIC]delay in programin' 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/time.htm?key=delay
Search entire site for: 'delay in programin'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] [PIC]delay in programin'
2001\02\27@020315 by Paul Chicofsky

picon face
Hello everybody,
I am having deficalty in getting the right dely to the clock i am using for my pic16f877.  which i am using 20MHz clock.  I have calculated a 1msec as follows:
 
I have a clock of 20MHz that meens 50nsec
then I have three instructions for each function so what i did is
50nsec X 3inst X (how many time to be multiplied (n))= 1msec
so,
n = (1m X 20MHz) / 3inst = 6666.66666 
then,
I devided that number by 100 to split it into two equations,  so I got 67 and 100.
 
the following is my iomplemented function,  however,  i am not getting the right delay.  I am geting larger delay
 
 
 
Wait1ms
        movlw   .67
        movwf   temp11
Wait1msB1
        movlw   .100
        movwf   temp12
Wait1msB2
        decfsz  temp12,1         ; this is one instruction
        goto    Wait1msB2       ; this is two instructions which make 3 total
        decfsz  temp11,1         ; the same here
        goto    Wait1msB1
        return
 
can any body help
Thank you
 
regards,
Paul


Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

-- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics

2001\02\27@021402 by David Duffy

flavicon
face
Paul wrote:
>Hello everybody,
>I am having deficalty in getting the right dely to the clock i am using
>for my pic16f877.  which i am using 20MHz clock.  I have calculated a
>1msec as follows:
>
>I have a clock of 20MHz that meens 50nsec

No, this means 200ns. Each instruction takes 4, sometimes 8 (eg. goto)
clock cycles.
Cut down your multiplier by a factor of 4.

{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\02\27@035030 by Bob Ammerman

picon face
> Hello everybody,
> I am having deficalty in getting the right dely to the clock i am using
for my pic16f877.  which i am using 20MHz clock.  I have calculated a 1msec
as follows:

The problem is: it takes 4 cycles of the 20MHz clock for each instruction
(and 8 for branches and skips 'taken').  So your results are off by a factor
of 3. (note: I didn't actually verify your code, just your comments).

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

> I have a clock of 20MHz that meens 50nsec
> then I have three instructions for each function so what i did is
> 50nsec X 3inst X (how many time to be multiplied (n))= 1msec
> so,
> n = (1m X 20MHz) / 3inst = 6666.66666
> then,
> I devided that number by 100 to split it into two equations,  so I got 67
and 100.
>
> the following is my iomplemented function,  however,  i am not getting the
right delay.  I am geting larger delay
{Quote hidden}

total
{Quote hidden}

------
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
> -- http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics
>

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\02\27@055137 by Roman Black

flavicon
face
Paul Chicofsky wrote:
>
> Hello everybody,
> I am having deficalty in getting the right dely to the clock i am
> using for my pic16f877.  which i am using 20MHz clock.  I have
> calculated a 1msec as follows:


Hi Paul, nobody seemed to notice my last post re this
but here is a good way to get any timer period you
need with very little code:



{Quote hidden}

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\02\28@023810 by Vasile Surducan
flavicon
face
Roman, is not true, I saw it and is already copy in my timer folder,
but what do you say about showing us the whole code who done this ...
or maybe just initialising tmr0 with xtal value in 24 bits.
Vasile


On Tue, 27 Feb 2001, Roman Black wrote:

{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\28@032532 by Vasile Surducan

flavicon
face
ChuHAHUuuA...
this looks like *unsbscribe*  command send to piclist...
Sorry,
Vasile


On Wed, 28 Feb 2001, L-Soft list server at MITVMA.MIT.EDU (1.8d) wrote:

{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\02\28@081844 by Roman Black

flavicon
face
Vasile Surducan wrote:
>
> Roman, is not true, I saw it and is already copy in my timer folder,
> but what do you say about showing us the whole code who done this ...
> or maybe just initialising tmr0 with xtal value in 24 bits.
> Vasile
>

Hi Vasile, sorry I don't really understand what
you are asking!

I initialsed TMR0 with no prescaler, so it clocks
at 1:1 with the clock speed (fosc/4).
With 16MHz crystal gives 4MHz clock speed.
Then TMR0 generates an int every 256 instructions.

This simply subtracts 256 "ticks" from the main
24bit variable. When the variable gets below 0
we just add another 4,000,000 ticks (1 second) to
it and it keeps going. My system of testing <256
is better than <0 because it speeds the math.
:o)
-Roman



{Quote hidden}

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


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