Searching \ for '[PIC]: Looping routine problem.' 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: 'Looping routine problem.'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Looping routine problem.'
2000\11\10@025642 by William

flavicon
face
Dear All,

I have a looping problem, it might be simple for your, and I don't know
why I tried the whole morning till now, still can make it works.

I plan to output bit7 of portB, on and off, and make use of and
variable,
counter to do the looping counting. But don't why, when it runs, I use
logic probe and can't get signal (high low high low .... ) My program
calls
the output sub-routine.

Please help me, and look at my partial code below, what's wrong?

------------

output
   movlw 0x10            ; loop 16 times
   movf counter
loop1
   bsf PORTB,7            ;set bit7 ON
   call wait_high
   bcf PORTB,7            ; set bit7 OFF
   call wait_low
   decfsz counter,1
   goto loop1
return

-------------

Please point out my mistake, and your help is very much appreciate.

Thanks.


--
Regards,

William Tan

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




2000\11\10@032256 by Peter Grey

picon face
At 03:49 PM 11/10/00 +0800, you wrote:
Have you set the direct register for output? What PIC are you using?

Peter
{Quote hidden}

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




2000\11\10@033128 by William

flavicon
face
Hi, Peter. I'm using 16F84. I initialise the portB like follow

  movlw 0x00
  tris PORTB              ; set PORT B, [B0 - B7] are outputs



Peter Grey wrote:

{Quote hidden}

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




2000\11\10@035252 by Peter Grey

picon face
At 04:24 PM 11/10/00 +0800, you wrote:

I missed one fault in your code. I believe you should have
movwf   counter NOT movf counter.
If it is still faulty then I suggest you look at your delay subroutines.

Peter
{Quote hidden}

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




2000\11\10@041951 by Ian Rozowsky

flavicon
face
In the first instance, the third line of your code should read MOVWF
counter. All you are doing now is moving the counter  value back to itself.
However, this should still give (in the worst case where counter=1) at least
1 pulse. Post the wait_hi and wait_lo subroutines - possibly the problem
lies there. Are you perhaps exceeding the stack limit of the part?

Ian Rozowsky
Engineering Manager
Centurion Systems
P.O. Box 506
Cramerview 2060
South Africa
Tel   : +27-11-462-4499
Fax   : +27-11-704-3412
e-mail: spam_OUTrozTakeThisOuTspamcentsys.co.za
web: http://www.centsys.co.za

{Original Message removed}

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