AFC

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
User avatar
Jan Lichtenbelt
Posts: 797
Joined: Tue Feb 17, 2009 8:35 pm
Location: Haren GN, the Netherlands
Has thanked: 128 times
Been thanked: 264 times
Contact:

AFC

Post by Jan Lichtenbelt »

AFC Automatic Frequency Control

Frequency tuning of 2 microchips with internal oscillators, in case of e.g. using RS232.

The internal oscillator of RS232-Rx microchip will be tuned to the same baudrate of the internal oscillator of the RS232-Tx microchip.

This is realised by a continously square wave of the RS232-Tx by means of sending continously characters 'U'. (Kind of function generator by means of RS232-Tx)
The frequency of this signal will be baudrate/2.

This frequency will be compared to the frequency measured in the RS232-Rx chip. By means of OSCTUNE both frequencies will be made equal.

The input RS232-Rx signal must be on pin T1CKI
(pin B6 for PIC16F11847)

Other input Rx paramters:
1) Baudrate
2) Accuracy, see details in the flowcode
Ouput on LCD screen:
1) Baudrate found (if correct this must be the given value)
2) OSCTUNE, the paramters for the tuning of the internal oscillator
(0..31 positive frequency shift, 63...32 negative frequency shift.
One bit change is about 0.09% frequency change)

Remark:
- Frequency counter macro used, can be replaced by any other on.
- I found an OSCTUNE value of 6, which means a deviation of 0.5% of both internal oscillators for 2 members of the PIC16F1847 serie.
- I prepared this flowcode in V5. Translated it into V6 did not give the correct results. Up to now I do not know why.

Jan Lichtenbelt, NL
Attachments
AFC_Tx_V1.fcf
(26.49 KiB) Downloaded 227 times
AFC_Rx_V1.fcf
(29.05 KiB) Downloaded 220 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: AFC

Post by Benj »

Hello Jan,

Sounds like a good project, thanks for sharing.

I think v6 will need an additional component macro to initialise the RS232 component. Hopefully this is the only difference.

Post Reply