Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Timing

(you are viewing a thread; or go back to list of threads)

Timing (by Tom J.)
I made a simple function generator from a PIC12F683.
My target frequency was 50hz, so I did a cyclic on/off at 20ms.
It reads 17hz on the bench, anyone know what I did wrong?

Cycle time 10
INTOSC 4MHZ.

The ladder has only 4 rungs
Sun Apr 28 2019, 12:15:57
(no subject) (by MGP)
LD file?
Sun Apr 28 2019, 15:12:10
(no subject) (by Tom J.)
Disappointingly simple but here it is
Mon Apr 29 2019, 18:22:17, download attachment Multi1.ld
(no subject) (by MGP)
Much better than a page of text;)

You must ensure that the timing is a multiple of the Cycle Time.
With 10ms CT you don't get 33mS but 40mS TCY time.
I don't know if your OSCCON (0x8F) register is correct, I will check that again if I have more time, but you can start.
Tue Apr 30 2019, 02:19:19
(no subject) (by MGP)
Ow ..and dont forget the TCY time is 33ms high output and 33mS low, the frequency is 1/(2*0.033)= 15Hz.
Tue Apr 30 2019, 02:23:10
(no subject) (by Tom J.)
Then I should be able to do a Cycle time of 1, and 10ms for 50hz, 16.5ms for 30hz?
Tue Apr 30 2019, 17:47:07
(no subject) (by Ziggy)
No... not if You want a full range of output frequencies.
The trick is to identify a lowest cycle time able to provide You with all the frequencies You need with an acceptable error.
Also optimise the ladder to only be able to produce the selected frequency when called for and any other rungs not necessary during critical timing are not in the evaluation path.
Tue Apr 30 2019, 19:52:35
(no subject) (by MGP)
Hmm yes... but use a cycletime of 0.5 then you can also use 16.5mS, go no lower then 0.5
Attached your program with ct of 0.5mS
Wed May 1 2019, 02:10:43, download attachment Multi1V2.ld
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):