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

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

cicle time (by Mauro Luis Rudnicki)
Hello.
I would like to know if there is a possibility to work with a cicle time minor than 10ms. I had a project that I need generate a frecuency of more or less 40 kHz. is it possible? I'm using build 4.4.2.0.

Thanks
Mon Aug 27 2018, 20:15:48
(no subject) (by Ziggy)
At 40 kHz period is 25micro seconds.
To be able to generate the two halves of one period You are looking at a time sub period of 12.5 micro seconds.

This is Your longest loop time that might be sufficient to generate 40 kHz periodic signal.

Anything shorter than 12.5 microseconds loop time will do the job although the real requirement is that the loop time needs to be such that 12.5 divided by loop time gives integer number .

You can also try runing the ladder with loop time set to zero and actually measuring the signal frequency and may be padding it with delays for a better value.

And yes if zYou run a ATmega micro at 16 MHz you will have all of 200 processor clock cycles to do it in. It may be time for assembler to squeeze every clock cycle.
Tue Aug 28 2018, 00:13:58
(no subject) (by MGP)
The fastest cycle time on an Atmega (16Mhz) is 0.1mS
On a PIC (20mHz) it's 0.2mS

So use the PWM instruction, you can go above 60kHz.
Tue Aug 28 2018, 02:51:15
cicle time (and high frequency output) (by DanielH)
I agree with MGP approach.

Using PWM in a PIC16F887 with 20 MHz crystal, I habitually set 1.25 MHz as the base frecuency for my analog output circuitry, 0-10 V or 0(4)-20 mA.
It works fine, with a PWM 10 bit resolution (thanks you, Igor!). I only see slight errors due 1% tolerances in TH resistors.

1.25 MHz is the max. frequency achievable using 20 MHz Xtal (20,000,000/16).

I'm using this developing an Open Hardware + Free Software PLC for educative purposes, based on that PIC.
I'm using LDmicro as IDE, and TinyBootLoader as asociated transferring option (PIC burner not needed to daily use).
Tue Aug 28 2018, 10:49:03
(no subject) (by Ihor Nehrutsa)
to DanielH

Do you use TinyBootloader.exe with command-line arguments?
Do you use TinyBootloader.exe in ldmicro\flashMCU.bat to write the HEX into MCU from the LDmicro menu or by pressing F6 key?

If yes, please publish your flashMCU.bat and I add it to LDmicro release.
Thu Aug 30 2018, 09:08:39
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):