Author Topic: Frequency Counter  (Read 33395 times)

Heinz

  • Newbie
  • *
  • Posts: 5
Frequency Counter
« on: June 22, 2011, 08:51:07 am »
Hello there ...

I have built the frequency counter as shown on this website from a Fox-Delta kit (Pre-Scaler MC12080) with the firmware from Jan Kolar. Instead of dividing the frequency by 10 I would like to divide by 20. Has anyone the corresponding Assembly-Code available to do this? As I am not a very experienced programmer your support would be very much appreciated. Thank you.

73 de Heinz, VK4BZT

admin

  • Administrator
  • Newbie
  • *****
  • Posts: 12
Re: Frequency Counter
« Reply #1 on: June 22, 2011, 10:07:33 am »
The MC12080 has selectable dividing ratio 10, 20, 40 or 80. Download their datasheet.

Heinz

  • Newbie
  • *
  • Posts: 5
Re: Frequency Counter
« Reply #2 on: June 23, 2011, 04:43:52 am »
This has already been done. What I am asking for is the modification of the PIC firmware. The pre-scaler is now dividing by 20 and no longer by 10. After all I need the correct value on the display!

admin

  • Administrator
  • Newbie
  • *****
  • Posts: 12
Re: Frequency Counter
« Reply #3 on: June 25, 2011, 07:49:12 am »
This circuit is about 10 years old so I'm afraid you'll not find anybody who can modify the firmware. Moreover simple modification is not possible, it needs to be rewritten completely.

Heinz

  • Newbie
  • *
  • Posts: 5
Re: Frequency Counter
« Reply #4 on: July 03, 2011, 12:35:40 am »
Thank you for your comment. I know the counter is a few years old. However, PIC and assembly code are still the same. Why would you want to rewrite the code completly? After all the counter works fine as it is. I thought the person who has written the code is still somewhere out there and would have the answer in a few minutes flat. Software is only as good as it is documented. If you can't see the logic behind the instructions it's rather difficult to modify the code.

73 de Heinz, VK4BZT

Jan

  • Hero Member
  • *****
  • Posts: 1137
Re: Frequency Counter
« Reply #5 on: July 03, 2011, 09:46:24 am »
Dear Sir, it is not clear from your posts what's your wish. The 1 GHz counter is a pretty old circuit based on a /256 divider. You cannot use it with decimal divider (/10, /20 etc.) without complete rewriting the firmware because 256/10 or 256/20 is not an integer. This is a fact that has nothing to do with documentation.

However if you need to correct the value showed by dividing by 2 or multiplying by 2, it can be done simply by changing the prescaler rate of the PIC. It seems you know programming very well so it should be a simple task for you. Change the line
Code: [Select]
MOVLW   B'01110011' ;prescaler & pull-upsto
Code: [Select]
MOVLW   B'01110010' ;prescaler & pull-upsor
Code: [Select]
MOVLW   B'01110100' ;prescaler & pull-upsand compile the asm file again (for example using MPASMWIN).

Alternatively you may change the crystal value in the ratio required (but this may be increased only due to display refresh rate).

Heinz

  • Newbie
  • *
  • Posts: 5
Re: Frequency Counter
« Reply #6 on: July 07, 2011, 01:07:50 am »
Dear Jan.

This is exactly the information I was after. I shall re-program the PIC in the next couple of days. I have to up-date the PICkit2 software as well. No, I'm not that experienced as yet. May be in due course? Many, many thanks for your assistance. Great ham spirit!

vy 73 de Heinz, VK4BZT

Heinz

  • Newbie
  • *
  • Posts: 5
Re: Frequency Counter
« Reply #7 on: July 13, 2011, 01:21:26 am »
Dear Jan

After some initial euphoria I must admit things are not as simple as changing the pre-scaler rate only. The changes are much more involved. As you indicated earlier a large junk of the code would have to be rewritten. This is a bit beyond my abilities. Anyway many thanks again for your comments.

73s de Heinz, VK4BZT

Radium98

  • Guest
Re: Frequency Counter
« Reply #8 on: September 23, 2011, 06:54:14 pm »
dear juan

i am going to make the frequency counter but i have some dificulties on components side i need some help

i cant find the prescaler and no other equivalent that scale by 256 ,can i use prescaler u664b that scale by 64 and changing the xtal value from 4 to 16 mhz do that work.another thing can i use pic16lf84 because also cant find 16f84a.thanks

Jan

  • Hero Member
  • *****
  • Posts: 1137
Re: Frequency Counter
« Reply #9 on: September 23, 2011, 09:24:59 pm »
I don't see any problem!  8)

For connection to the PIC you may use this picture http://www.datasheetarchive.com/dl/Datasheets-34/DSA-678559.pdf

Don't forget the PIC OSC must be set to HS in fuses. I think that the 16F84 has a maximum frequency of 10 MHz (the 16F84A has 20 MHz) but overclocking is possible. Let us know how it works...

radium98

  • Guest
Re: Frequency Counter
« Reply #10 on: September 24, 2011, 02:46:57 pm »
ok sir when its finished i will upload the final project to the gallery .but i need exact response is it the same that if i up the xtal frequency from 4 to 16 and down the scale from 256 to 64 will this remain the same in work .yess or no .plz exact response .Thanks JAN for help

Jan

  • Hero Member
  • *****
  • Posts: 1137
Re: Frequency Counter
« Reply #11 on: September 24, 2011, 05:10:17 pm »
It will work the same way with one exception - the display refresh rate will be 4 times higher but this makes no problem.

radium98

  • Guest
Re: Frequency Counter
« Reply #12 on: September 24, 2011, 05:38:04 pm »
Thanks u are the man when it finished i will send final to u thanks for pira .i want to buy and this for my hobbie the audio spectrum analyser and one minirds but have some problem with the shippement hi price but its not a problem when my money will be enough :) i will surely buy them.1000 THANKS.

radium98

  • Newbie
  • *
  • Posts: 48
Re: Frequency Counter
« Reply #13 on: September 29, 2011, 11:11:50 am »
 :D :DDEAR JAN from my first result on the function of the 1 GHZ counter it seems to work perfect when i have put u664b scale by 64 and keeping the xtal firstly 4MHZ i have to divide the result by 4
exemple :exciter maun frequency 98.3 i saw on the led display of the freqquency counter 393.2 mhz /4=98.3.
changing the xtal to 8.00MHZ i have on the display 196.6 (196.6/2)=98.3 mhz .
the bad news that i cant get the xtal 16MHZ oscllate ,i have increased the value of the parralel capacitors from 22pf to 33pf and decreasing them to 15pf but nothing happened .i guet on yhe display NUMBER (P)

thanks for help.

Jan

  • Hero Member
  • *****
  • Posts: 1137
Re: Frequency Counter
« Reply #14 on: September 29, 2011, 11:23:13 am »
As I mentioned above, if you use PIC16F84-04/P, it has a maximum frequency of 4 MHz so it will probably not work on 16 MHz. Make sure you've selected HS oscillator mode. If no succes, you must buy PIC16F84A-20/P.

It is also possible to use 4 MHz crystal and change the prescaller value in the asm file as showed below and compile it again:

Original value:
Code: [Select]
        MOVLW   B'01110011' ;prescaler & pull-ups
New value:
Code: [Select]
        MOVLW   B'01110101' ;prescaler & pull-ups