Searching \ for ' a 16c54 clock desigin.' 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=clock
Search entire site for: 'a 16c54 clock desigin.'.

No exact or substring matches. trying for part
PICList Thread
'[PICLIST] a 16c54 clock desigin.'
2002\05\07@012036 by Michael Johnston

flavicon
face
Gentlemen
   i am couting a 60hz at ra3 in a 16c54. I am simulating this for right now. My problem is that i count this pulse and then it is suppose to increment a counter. Which it is doing fine but when i get to 60 this timer is supposed to reset to zero and increnment another counter.this next counter is supposed to count up to 60 also. then it is supposed to increment a third counter which is supposed to count up to 12 then reset to one but instead of doing that it just increments the all three counters and keeps going up to 255.then it resets. here is the  a partial listing of my code  incf   t1,f
movlw 60     subwf t1,f
btfsc status,2     goto t_hi
I never see it go back to the top of the program until the three counters all increment by one. I had a heck of time try to get simulate a 60hz pulse inputed to ra3  in the sim which i am not sure if i have that set up right. i contacted microchip and they told me to inputed it using clock stimulus under sim stimulus. It is set up as 3 hi and 3 lo pulses.
does anybody have any suggestions one thing is that the pre scaler cant be used. The pc board is wired up for ra3.
thanks
mike johnston    
--
http://www.piclist.com hint: PICList Posts must start with ONE topic:
[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads


2002\05\07@023449 by Jim

flavicon
face
Try this

incf     t1,f
movlw    .60
xorwf    t1,w
btfsc    status_z
goto    t_hi


-----Original Message-----
From: Michael Johnston <spam_OUTstoneyTakeThisOuTspamKINGWOODCABLE.NET>
To: .....PICLISTKILLspamspam@spam@MITVMA.MIT.EDU <PICLISTspamKILLspamMITVMA.MIT.EDU>
Date: Monday, May 06, 2002 10:21 PM
Subject: a 16c54 clock desigin.


Gentlemen
   i am couting a 60hz at ra3 in a 16c54. I am simulating this for right
now. My problem is that i count this pulse and then it is suppose to
increment a counter. Which it is doing fine but when i get to 60 this timer
is supposed to reset to zero and increnment another counter.this next
counter is supposed to count up to 60 also. then it is supposed to increment
a third counter which is supposed to count up to 12 then reset to one but
instead of doing that it just increments the all three counters and keeps
going up to 255.then it resets.
here is the  a partial listing of my code
incf   t1,f
movlw 60
subwf t1,f
btfsc status,2
goto t_hi
I never see it go back to the top of the program until the three counters
all increment by one. I had a heck of time try to get simulate a 60hz pulse
inputed to ra3  in the sim which i am not sure if i have that set up right.
i contacted microchip and they told me to inputed it using clock stimulus
under sim stimulus. It is set up as 3 hi and 3 lo pulses.
does anybody have any suggestions
one thing is that the pre scaler cant be used. The pc board is wired up for
ra3.
thanks
mike johnston



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

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


2002\05\07@204643 by Peter L. Peres

picon face
Try (untried code!):

again:
 ; do something intelligent with the time here, like display it f. ex.

 btfsc PORTA,3         ; if it's still 1 from last time wait till it's 0
 goto  ($-1)

 btfss PORTA,3         ; wait for rising edge of clock
 goto  ($-1)

 incf  Fseconds,f
 addlw (.256-.60)      ; set C if >= 60
 btfss STATUS,C
 goto  again

 clrf  Fseconds

 incf  Fminutes,f
 addlw (.256-.60)      ; as above
 btfss STATUS,C
 goto  again

 clrf  Fminutes

 incf  Fhours,f
 addlw (.256-.24)      ; as above, but 24 hrs
 btfss STATUS,C
 goto  again

 ; it's another day if we got here ...

hope this helps,

Peter

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


2002\05\08@005335 by Michael Johnston

flavicon
face
Jim
I inserted the Xorwf  ti,w into my code
it is still going past sixty and i am not sure why  it is doing this except
i dont really under stand how to set up a s60 hz pulse in the sim.
one of the engineers at microchip said in order to simulate the 60 hz pulse
using ra3 I/O pin was to insert it using the clock stimulus and in order
accurately simulate this pulse i needed to set this up as ra3 input with 3
pulses hi and 16666 pulse low it doesnt work this way and i couldnt get this
guy to understand what i am doing with this clock. he even sent me a sim
file and using his instructions i could never get it to work on further
conversations with the tec support they said to try three pulse hi three
low. it works on this but i dont think its right
any suggestions would be greatly appreciated
mike johnston
----- Original Message -----
From: "Jim" <.....james3162KILLspamspam.....WORLDNET.ATT.NET>
To: <EraseMEPICLISTspam_OUTspamTakeThisOuTMITVMA.MIT.EDU>
Sent: Tuesday, May 07, 2002 1:34 AM
Subject: Re: a 16c54 clock desigin.


> Try this
>
> incf     t1,f
> movlw    .60
> xorwf    t1,w
> btfsc    status_z
> goto    t_hi
>
>
> {Original Message removed}

2002\05\08@125315 by Peter L. Peres

picon face
Ok, I forgot to read the registers before comparing. The corrected code
is:

On Wed, 8 May 2002, Peter L. Peres wrote:

{Quote hidden}

  movf Fseconds,w
>  addlw (.256-.60)      ; set C if >= 60
>  btfss STATUS,C
>  goto  again
>
>  clrf  Fseconds
>
>  incf  Fminutes,f
  movf  Fminutes,w
>  addlw (.256-.60)      ; as above
>  btfss STATUS,C
>  goto  again
>
>  clrf  Fminutes
>
>  incf  Fhours,f
  movf  Fhours,w
>  addlw (.256-.24)      ; as above, but 24 hrs
>  btfss STATUS,C
>  goto  again
>
>  ; it's another day if we got here ...

Yes, it is another day.

Peter

--
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


2002\05\08@181542 by Barry Gershenfeld

picon face
>
>one of the engineers at microchip said in order to simulate the 60 hz pulse
>using ra3 I/O pin was to insert it using the clock stimulus and in order
>accurately simulate this pulse i needed to set this up as ra3 input with 3
>pulses hi and 16666 pulse low it doesnt work this way and i couldnt get this
>guy to understand what i am doing with this clock.

It may be important to realize that a "clock" is

1. A pulsing signal that causes your counters to advance by 1
2. An instrument that tells the time of day.

You could easily confuse the engineer by talking about one while
he is thinking about the other.   He was describing how to
create #1.

#1 is important so that your instrument "keeps time", that is
counts one second every second, and so on.

As for #2, in your original message it sounded like you
had a problem where the program did not properly recognize the
counting to 60.  It sounded like the test was wrong, and
every number was recognized as 60, thus incrementing all
the counters on each step.  Usually this is the result
of having the test results come out backwards.

Barry

--
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


2002\05\08@192933 by Andrew Warren

flavicon
face
Michael Johnston <PICLISTspamspam_OUTmitvma.mit.edu> wrote:

> i am couting a 60hz at ra3 in a 16c54. I am simulating this for
> right now. My problem is that i count this pulse and then it is
> suppose to increment a counter. Which it is doing fine but when i
> get to 60 this timer is supposed to reset to zero and increnment
> another counter.this next counter is supposed to count up to 60
> also. then it is supposed to increment a third counter which is
> supposed to count up to 12 then reset to one but instead of doing
> that it just increments the all three counters and keeps going up
> to 255.then it resets.

Mike:

   WAITFORLO:
       BTFSC   PORTA,3
       GOTO    WAITFORLO

   WAITFORHI:
       BTFSS   PORTA,3
       GOTO    WAITFORHI

   ; At this point, we've just seen a rising edge on the 60Hz input.

       INCF    SIXTIETHS    ;Increment the 1/60-second counter.
       MOVLW   60           ;Compare it to 60.
       XORWF   SIXTIETHS,W  ;
       BNZ     DONE         ;If it hasn't reached 60 yet, exit.

       MOVWF   SIXTIETHS    ;Otherwise, reset the counter to 0.

       INCF    SECONDS      ;Increment the seconds counter.
       MOVLW   60           ;Compare it to 60.
       XORWF   SECONDS,W    ;
       BNZ     DONE         ; etc....

       MOVWF   SECONDS

       INCF    MINUTES
       MOVLW   60
       XORWF   MINUTES,W
       BNZ     DONE

       MOVWF   MINUTES

       INCF    HOURS
       MOVLW   12
       XORWF   HOURS,W
       BNZ     DONE

       MOVLW   1
       MOVWF   HOURS

   DONE:

-Andrew

=== Andrew Warren -- @spam@aiwKILLspamspamcypress.com
=== Principal Design Engineer
=== Cypress Semiconductor Corporation
===
=== Opinions expressed above do not
=== necessarily represent those of
=== Cypress Semiconductor Corporation

--
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


2002\05\09@001343 by Michael Johnston

flavicon
face
Andrew
thanks for the code i tried this but ive ran into some problems for one
thing is the bnz mnemonic usable with the c54 parts
Michael Johnston
{Original Message removed}

2002\05\09@072642 by Bob Ammerman

picon face
BNZ is probably a macro used by Andrew.

Just translate:

   BNZ xxxx

To:

   SKPZ
   GOTO    xxxx

Where SKPZ is a pseudomnemonic for:

   BTFSS    STATUS,Z

Bob Ammerman
RAm Systems

{Original Message removed}

2002\05\09@080924 by Michael Johnston

flavicon
face
Bob
thank you
i will try this
----- Original Message -----
From: "Bob Ammerman" <KILLspamrammermanKILLspamspamADELPHIA.NET>
To: <RemoveMEPICLISTTakeThisOuTspamMITVMA.MIT.EDU>
Sent: Thursday, May 09, 2002 6:21 AM
Subject: Re: a 16c54 clock desigin.


{Quote hidden}

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


2002\05\09@122401 by Dwayne Reid

flavicon
face
At 10:57 PM 5/8/02 -0500, Michael Johnston wrote:
>Andrew
>thanks for the code i tried this but ive ran into some problems for one
>thing is the bnz mnemonic usable with the c54 parts

BNZ is one of several pre-defined macros built into MPASM.  You can read
all about them in the MPASM data sheet - available from Microchip's web
site (document # 33014g).

The built in macros help make code a bit easier to understand when coming
back to it after a long period of time.

dwayne


Dwayne Reid   <RemoveMEdwaynerspam_OUTspamKILLspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

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


2002\05\09@185901 by Michael Johnston

flavicon
face
dewayne
thanks for the info. i havent had a chance to finish the code but well get
to it soon
mike johnston
{Original Message removed}

2002\05\10@182539 by Michael Johnston

flavicon
face
part 1 1711 bytes content-type:text/plain; (decoded 7bit)

dewayne i converted andrews code so i could use it
this is what i got so for
the first coutner is working perfectly but the seconds counter keeps going
pass 60  any suggestions thanks
mike johnston
{Original Message removed}
part 2 2046 bytes content-type:application/octet-stream; (decode)

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


2002\05\10@192040 by Barry Gershenfeld

face picon face
>dewayne i converted andrews code so i could use it
>this is what i got so for
>the first coutner is working perfectly but the seconds counter keeps going
>pass 60  any suggestions thanks
>mike johnston

I seldom look at the actual code but in this case it seemed like
you had a problem with the test, and it would be easy to find.

You were doing good right up to finding each second:

       btfss   status,2        ;if it has reach 60 yet exit.


Well, I would write "if it hasn't reached 60 yet, exit."
That works, as you can see.

Now, below that you want to test for 60 seconds -> minute, and
for 60 minutes -> hour, and you have got the 60 and you
have compared it, but you didn't do anything with the answer!

You need to use btfss just as you did in the first part.

You're almost there!

Barry

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


2002\05\10@193131 by Dwayne Reid

flavicon
face
At 05:22 PM 5/10/02 -0500, Michael Johnston wrote:
>dewayne i converted andrews code so i could use it
>this is what i got so for
>the first coutner is working perfectly but the seconds counter keeps going
>pass 60  any suggestions thanks
>mike johnston

Yeah - you need to add "btfss status,2" in front of all the "goto wtforlo"
statements.  The first counter has the test, the others don't.

By the way: you could have left the BNZ statements alone - as I mentioned,
they are pre-defined in MPASM and thus compile correctly if you are using
MPASM as your assembler.

dwayne






Dwayne Reid   <RemoveMEdwaynerKILLspamspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

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


2002\05\10@194423 by Michael Johnston

flavicon
face
thanks barry
this is really cool clock that  a friend of mine develop some years back. he
made 30 of them and then test marketed them. I guess that did go over so
well but. I bought a pcb board from him and thats all i got. After some
proding  he gave me a parts placement diagram. I had to draw a schematic and
then start from there. I am new to the pic controllers and have two of dave
benson's book and also mike predikos book. What i tried to do was to modify
code they had in their books and talking to my friend on the phone when i
could catch him. I really appreiciate they
help
Mike Johsnton
{Original Message removed}

2002\05\10@195459 by Michael Johnston

flavicon
face
Dewayne
I am using mapsam but i dont under stand the macros too well
thanks again
Mike Johnston
----- Original Message -----
From: "Dwayne Reid" <spamBeGonedwaynerSTOPspamspamEraseMEPLANET.EON.NET>
To: <KILLspamPICLISTspamBeGonespamMITVMA.MIT.EDU>
Sent: Friday, May 10, 2002 6:29 PM
Subject: Re: a 16c54 clock desigin.


> At 05:22 PM 5/10/02 -0500, Michael Johnston wrote:
> >dewayne i converted andrews code so i could use it
> >this is what i got so for
> >the first coutner is working perfectly but the seconds counter keeps
going
{Quote hidden}

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


2002\05\10@201403 by Dwayne Reid

flavicon
face
At 06:50 PM 5/10/02 -0500, Michael Johnston wrote:
>Dewayne
>I am using mapsam but i dont under stand the macros too well

I understand!  Ignore the macros for now if you find it easier.  And keep
plugging at your project - it will all make sense soon.

dwayne



Dwayne Reid   <.....dwaynerspam_OUTspamplanet.eon.net>
Trinity Electronics Systems Ltd    Edmonton, AB, CANADA
(780) 489-3199 voice          (780) 487-6397 fax

Celebrating 18 years of Engineering Innovation (1984 - 2002)
 .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-.   .-
    `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'
Do NOT send unsolicited commercial email to this email address.
This message neither grants consent to receive unsolicited
commercial email nor is intended to solicit commercial email.

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


2002\05\10@223659 by Michael Johnston

flavicon
face
part 1 1682 bytes content-type:text/plain; (decoded 7bit)

Barry
I went back add those statements but it seconds counter is still not
resetting so i looked a alittle closer and added this to secs
movf 0
movlw
i think this should load the register with the o
is there a way to speed up the sim to like jump 60 minutes later to see if
the code is couting properly
thanks again
mike johnston
{Original Message removed}
part 2 2281 bytes content-type:application/octet-stream; (decode)

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


2002\05\12@203717 by Michael Johnston

flavicon
face
peter
thanks for the code  example I havent tried it yet but will give it try
Ive been tryin to get this going for quite a while.
thanks again
mike johnston
{Original Message removed}

2002\05\12@232747 by Michael Johnston

flavicon
face
Dewayne
   After a conversation with  a friend i  finally have the seconds counter
reset to zero after 60 minutes. At which time mplab goes nutz and gives a
kerenel.386 and says it will shut down. Is there somthing i am doing in
mplab to cause this or is this a flaw in mplab. I am running mplab under
Windows XP.
thanks
Mike Johnston
{Original Message removed}

2002\05\13@155358 by Barry Gershenfeld

face picon face
There are a lot of ways to deal with this problem, but probably
the simplest is that you change the '60' in 'movlw 60' to
a low number like 1 or 2.  Then you don't have to step
so many times before you see it get to its "end count" to
roll over the next counter.

Of course, this doesn't make a proper clock, but once you've
found and fixed your errors, you can change it back to 60 and run
it for real.

Barry


At 09:32 PM 5/10/02 -0500, you wrote:
{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


2002\05\13@160407 by Barry Gershenfeld

face picon face
In this case both suggestions are probably right.  Your program
does something wrong and the simulator should give you an
error.  But if this in turn causes MPLAB itself to crash, well,
that isn't right.    Actually there is a third step:  MPLAB
might crash but it shouldn't take Windows down with it.  But
it seems life is like that...

Barry

At 10:23 PM 5/12/02 -0500, you wrote:
>Dewayne
>    After a conversation with  a friend i  finally have the seconds counter
>reset to zero after 60 minutes. At which time mplab goes nutz and gives a
>kerenel.386 and says it will shut down. Is there somthing i am doing in
>mplab to cause this or is this a flaw in mplab. I am running mplab under
>Windows XP.
>thanks
>Mike Johnston

--
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


2002\05\13@172700 by Eoin Ross

flavicon
face
I have had a similar problem (but it didn't crash windows)
- seems to occur on LONG simulations -
I am guessing there is a memory leak somewhere in the simulation routines of MPLAB - I think that was with MPLAB 5.40.00
This is with Win 98 SE

At 10:23 PM 5/12/02 -0500, you wrote:
>Dewayne
>    After a conversation with  a friend i  finally have the seconds counter
>reset to zero after 60 minutes. At which time mplab goes nutz and gives a
>kerenel.386 and says it will shut down. Is there somthing i am doing in
>mplab to cause this or is this a flaw in mplab. I am running mplab under
>Windows XP.
>thanks
>Mike Johnston

--
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


2002\05\13@182607 by Michael Johnston

flavicon
face
Eoin
Your are correct I was letting the sim count up to 60 minutes and it would
do that and then advance two minutes beyond  that point and crash and it was
just the sim not windows. I am running xp. Has anyone else experience this
problem
thanks
Mike Johnston
{Original Message removed}

2002\05\13@182808 by Michael Johnston

flavicon
face
Barry
thank you i will implement that and see what goes on
mike johnston
----- Original Message -----
From: "Barry Gershenfeld" <.....barry_gspamRemoveMEZMICRO.COM>
To: <RemoveMEPICLISTspamspamBeGoneMITVMA.MIT.EDU>
Sent: Monday, May 13, 2002 2:41 PM
Subject: Re: a 16c54 clock desigin.


{Quote hidden}

if
> >the code is couting properly
> >thanks again
> >mike johnston
>
> --
> 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


2002\05\14@144728 by Peter L. Peres

picon face
On Sun, 12 May 2002, Michael Johnston wrote:

>peter
>thanks for the code  example I havent tried it yet but will give it try
>Ive been tryin to get this going for quite a while.
>thanks again
>mike johnston
>{Original Message removed}

2002\05\14@182233 by Michael Johnston

flavicon
face
Peter
thank you again i tried his code and its working except the hrs timer. Its
not incrementing right i just have to keep looking at it. Mike  Johnston
{Original Message removed}

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