Page 1 of 1

Adjustable periodic waveform generator on PIC12F1612

Posted: Thu Jan 14, 2021 7:22 pm
by JustinS
I want to build a simple generator using PIC12F1612 chip
The generator works, but I can't change its frequency.
The signal is generated by means of TMR2 64000Hz interrupt
The variable "multiplier" allows you to change the frequency
multiplier = 0 generator turned off
multiplier = 1 frequency 250Hz
multiplier = 2 frequency 500Hz
.................................................. ....
multiplier = 10 frequency 2500Hz
The generator will be controlled from another controller (16F1829)
I care about the synchronous work of both chips. I am using one 8MHz clock generator for both chips.
I want the generator on PIC12F1612 to start working only after receiving permission from the master system (16F1829). I tested using the IOC PORT A1 to detect Triger on Faling Edge but it doesn't work. I don't know if you can use two interrupts at the same time?
I want the "0" pulse length at input A1 to control the frequency. I am asking for advice.

Re: Adjustable periodic waveform generator on PIC12F1612

Posted: Fri Jan 15, 2021 12:02 pm
by Benj
Hello,

You can alter the timer rollover value using a C icon.

Here is the current setting.

Code: Select all

PR2=125-1;

Re: Adjustable periodic waveform generator on PIC12F1612

Posted: Fri Jan 15, 2021 3:13 pm
by JustinS
Could you please prepare an example for me.
I've never used C code.

Re: Adjustable periodic waveform generator on PIC12F1612

Posted: Wed Jan 20, 2021 5:19 pm
by JustinS
Dear Benj
I can't put C Icon into Flowcode.
I suppose it would increase the speed of the software.
This is not yet a key issue.
I need to be able to change the frequency while running.
I have pins A1, A2, A4 at my disposal.
I tested giving a "0" (10uS) pulse to pin A1 to change the generator frequency.
Each pulse changes the frequency (250, 500, ... 2500, 0, Hz).
Unfortunately it doesn't work.
I am attaching my file.
Please help