Searching \ for 'external rtcc....?' 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/ints.htm?key=rtcc
Search entire site for: 'external rtcc....?'.

Truncated match.
PICList Thread
'external rtcc....?'
1995\06\26@164059 by Kenny Baby

flavicon
picon face
On the pic71 I want to use an external clock to increment the RTCC.
Logic says that you set the RTCC pin as an input, tell the pic that
the RTCC signal source is on RA4 and hey presto it's supposed to work.
Well this had me baffeled for around two weeks because it did'nt work.
I could see because at every count of 50 a led was to be turned on
and off. The external clock was from an opto isolator, being pulled
up with a 4.7k resistor. When the pic was run the RA4 pin was pulling
the opto output to ground.
OK thought I, lets do the opposite.
Looking at the block diagram of the RA4 pin as shown in the PIC16C71
data sheet ( page 25).I set the pin as an output and then sent a '1'
to that pin, guess what, that led started flashing. The only way I
could get an external clock to the RTCC was to set the pin as an
output (not an input ) and then write a '1' to disable the open
collector output transistor. O.K so I thought I had it sussed.
But no, it would'nt work on mpsim. I was originaly using ver 3.*
and applying a simulas file, but it would'nt simulate an external
clock on the simulator.
Then I got mpsim ver 5.0, It lets you apply a clock to any pin with a
predefined mark space ratio. Did it simulate my external clock. No it
just sat there and didnt change. Ok said I lets reset that RA4 pin as
an input for the simulator, and yes it worked.
Have I got something wrong, I can get it to work on the pic but not
on the simulator, or I can get it to work on the simulator but not on
the pic. I could remember and change the option register for
simulation and then (if I don't forget) change it back before I
program the pic BUT.....!

IS THERE ANOTHER WAY OF DOING IT.......?I've seen things you people would'nt
believe,
Attack ships on fire of the shores of Orion,
I watched sea beams,glitter in the darkness at ten houser gate,
All these moments will be lost,
In time,
like tears in the rain

Remember now, watch out for the Fairies......!

1995\06\26@204938 by Andrew Warren

face
flavicon
face
Kenny Baby <spam_OUTMCTKEAWTakeThisOuTspamMH1.MCC.AC.UK> wrote:

>On the pic71 I want to use an external clock to increment the RTCC.
>Logic says that you set the RTCC pin as an input, tell the pic that
>the RTCC signal source is on RA4 and hey presto it's supposed to work.
>Well this had me baffeled for around two weeks because it did'nt work.
>....
>I set the pin as an output and then sent a '1' to that pin, guess
>what, that led started flashing.
>....
>IS THERE ANOTHER WAY OF DOING IT.......?

Kenny:

The problem you're seeing is the result of a bug in the "rev A"
16C71's.  The simulator models the parts as they should have been
produced; that's why it behaves differently than your PIC.  The
problem's been fixed in the "rev B" parts.

You can tell what rev you have by looking at the face of the 16C71;
it'll say something like:

   PIC16C71
   /JW-S1
   9352 CAT

   or

   PIC16C71-04/P
   9404 CAA TAIWAN

The middle letter of that three-letter "CAT" or "CAA" designation is
the chip's revision letter.

-Andy

--
Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
Fast Forward Engineering, Vista, California

1995\06\27@085759 by Doug Sellner

flavicon
face
I had the same problem, but with the port b change interrupts.

I solved it by properly saving the status and W registers during interrupts.

I found that during a few interrupts the tris regs were changed.

{Quote hidden}

Doug Sellner
Beach Tech
4131 Vincent Avenue South
Minneapolis MN 55410

Voice (612) 924-9193 x 521
Fax   (612) 926-1145

Internet: dsellnerspamKILLspamembay.com

1995\06\27@103333 by Siegfried Grob

flavicon
face
From:   Doug Sellner (".....dsellnerKILLspamspam.....EMBAY.COM"KILLspamspam.....umcKILLspamspam.....MFSERV)
Date:   27-JUN-1995 15:31:33.42
To:     Multiple recipients of list PICLIST
Cc:
Subj:   Re: external rtcc....?
Reply requested: not set            Reply by date:



Doug Sellner said:
I had the same problem, but with the port b change interrupts.
I solved it by properly saving the status and W registers during interrupts.
I found that during a few interrupts the tris regs were changed.
------------------



So I want to sum up some general notes about interrupt programming:

Always begin an interrupt routine with saving the W and then the STATUS
register.
If you are using Port-B interrupts or have to read from/write to ports, clear
the RP0-flag in the STATUS to access the Port latches, not the corresponding
tris-registers! It took me several hours to find that bug in my PIC-based modem
switch box.
And if you use indirect addressing both in your main program and in the
interrupt routine, do not forget to save and restore the FSR and IND registers.
In general, save and restore is necessary for all registers that are used in
an independent way in the main and the interrupt routine! Although this seems
quite obvious, it is forgotten more often than many would expect.
Of course, at the end of the interrupt routine the interrupt flags have to be
cleared and the saved registers to be restored, at last the STATUS and then
the W register, using adequate SWAP-commands not to change the Z-flag in
STATUS.



Siegfried Grob,                                   |
student of electrical engineering,                |
university of ulm, germany                        |
e-mail:  EraseMEsiegfried.grobspam_OUTspamTakeThisOuTstudent.uni-ulm.de        |
tel&fax: +49 731 25148                            |
--------------------------------------------------'

1995\06\27@174905 by o Soares
flavicon
face
>> Of course, at the end of the interrupt routine the interrupt flags have to be
>> cleared and the saved registers to be restored, at last the STATUS and then
>> the W register, using adequate SWAP-commands not to change the Z-flag in
>> STATUS.

>Could someone post a code fragment for this?  I *think* mine is
>working, but I'm wondering if there's a better way.
>Chris

Hi there.

To save W, STATUS and FSR you can use:

       movwf   SavedW
       swapf   STATUS,W
       movwf   SavedSTATUS
       movf    FSR,W
       movwf   SavedFSR
       .....

To restore W, STATUS and FSR you can use:

       .....
       movf    SavedFSR,W
       movwf   FSR
       swapf   SavedSTATUS,W
       movwf   STATUS
       swapf   SavedW,F
       swapf   SavedW,W
       retfie

Be carefull with the page bits at entry of the interrupt. If you use them
in your code, you must set the right value inside the interrupt. At exit,
the old values are restored.

Hope this helps.

Fernando Soares

1995\06\27@193309 by Eric Smith

flavicon
face
Sigfried Grob said:
> And if you use indirect addressing both in your main program and in the
> interrupt routine, do not forget to save and restore the FSR and IND
> registers.

In general you should *NOT* save the IND register on entry to an interrupt,
since it is really just the register pointed to by the FSR.  The whole point
of saving and restoring the FSR in an interrupt routine is so that you can
use indirect addressing to access something other than what the non-interrupt
code was accessing.

In a pathological case, the non-interrupt code might point the FSR at an I/O
port that causes side effects if you read and write it as would happen with
a save/restore.

Cheers,
Eric

1995\06\29@203718 by khladky

flavicon
picon face
In article: <9506270151.aa14818spamspam_OUTpunt3.demon.co.uk> @spam@fastfwdKILLspamspamix.netcom.com writes:
:
: Kenny Baby <KILLspamMCTKEAWKILLspamspamMH1.MCC.AC.UK> wrote:
:
: >On the pic71 I want to use an external clock to increment the RTCC.
: >Logic says that you set the RTCC pin as an input, tell the pic that
: >the RTCC signal source is on RA4 and hey presto it's supposed to work.
: >Well this had me baffeled for around two weeks because it did'nt work.
:
: Kenny:
:
: The problem you're seeing is the result of a bug in the "rev A"
: 16C71's.  The simulator models the parts as they should have been
: produced; that's why it behaves differently than your PIC.  The
: problem's been fixed in the "rev B" parts.

Thank you !

I'd just spent most of today trying to figure out a very similar problem. The
program would work fine on the simulator but the damn thing was just pulling
the RA4 line low when on the board.

Will Microchip replace this expensive windowed EPROM 16C71 'rev A' chip
(shipped with my PICSTART-16B kit) for one that does as it is supposed to ?

Anyone from Microchip listening ?

Karel
--
++++++++RemoveMEkhladkyTakeThisOuTspamkhdesign.demon.co.uk++Manchester M14 6BF England++++++++

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