Adjustable periodic waveform generator on PIC12F1612

Moderator: Benj

Post Reply
JustinS
Flowcode v5 User
Posts: 40
Joined: Wed Sep 12, 2012 1:59 pm
Has thanked: 1 time
Been thanked: 7 times
Contact:

Adjustable periodic waveform generator on PIC12F1612

Post 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.
Attachments
SINUS_GENERATOR_TEST001.fcfx
(12.82 KiB) Downloaded 162 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Adjustable periodic waveform generator on PIC12F1612

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

JustinS
Flowcode v5 User
Posts: 40
Joined: Wed Sep 12, 2012 1:59 pm
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Adjustable periodic waveform generator on PIC12F1612

Post by JustinS »

Could you please prepare an example for me.
I've never used C code.

JustinS
Flowcode v5 User
Posts: 40
Joined: Wed Sep 12, 2012 1:59 pm
Has thanked: 1 time
Been thanked: 7 times
Contact:

Re: Adjustable periodic waveform generator on PIC12F1612

Post 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
Attachments
SINUS_GENERATOR_TEST002.fcfx
(14.07 KiB) Downloaded 146 times

Post Reply