View Full Version : Binary Clock
Scottacus
- 29th August 2006, 14:12
Hi, I'm new to this forum and was wondering if anybody could help me with timing on a binary clock that I am programming. I'm sure that my code is not the most efficient but I need to waste some time in the routine and is there anyplace that will tell me how long it takes to execute PortB and PortA commands as well as: for, next and assignments like MinuteOnes = Minute//10. I've been tweaking here and there on a bread board and I can get close but have not hit the timing right as of yet. I am using a 20MHz clocking crystal with a PIC F84A processor. I assume that a pause will take 1/5 of a milisecond. Thanks!
Melanie
- 29th August 2006, 14:43
You are heading in the wrong direction.
Unlike raw Assembler instructions, you cannot easily calculate which PICBasic Commands execute at what speed.
To produce a clock with any accuracy, you need to refence to an accurate source of ticks... like any one of the PICs on-board timers or an external RTC chip.
Acetronics2
- 29th August 2006, 15:03
Hi,
One working ... but in assembler !!! :
Elektor project 020390 ... ASM files downloadable.
Alain
Melanie
- 29th August 2006, 17:36
I did say "unlike Assembler", wherein you can easily calculate the execution time of each instruction. But even then you are relying on the PICs clock for your accuracy. Let's face it, 20MHz (the speed mentioned by Scottacus - didn't he meet a sticky end at the end of the film?) from a crystal just isn't going to produce 20.000000MHz.
Unfortunately you just can't with PBP. Even execution of a simple a=b+c will depend if the variables reside in Bank0 or elsewhere or if they're Bytes or Words or a mix of both. You can probably have twenty speed permutations of that simple statement alone depending on the conditions I've stated above.
Acetronics2
- 29th August 2006, 18:38
Hi, Mel
These days, I made a turnaround aboard a 16F628 ... reading TMR1 to measure the real calculating time ...
was an Electronic ignition for cars ...
Alain
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.