DPRG List  

[DPRG] Frequency Counter Question

Subject: [DPRG] Frequency Counter Question
From: Earl Bollinger earlwbollinger at comcast.net
Date: Sat Oct 4 12:20:02 CDT 2003

To everyone that repsonsed with ideas and suggestions, I got it to work
OK now.
When I laid out the PCB, I tried to keep the data lines from the 74HC590
counters short and simple as they went to the I/O port on the MCU.
Thus QA went to PortD.7 on down to QH going to PortD.0, so I assumed I
would have a "reversed" data value.
In the program, I would load the values into a MSB byte and a LSB byte.
But I was taking the varByte.bit0 = PortD.7 through varByte.bit7 =
It turns out that it should not be reversed, but varByte.bit0 = Portd.0
and so on without swapping any bits.
I think the compiler got me, with the way it handles conversions, and
when you would load the two bytes into a WORD variable and display that
value, you would get a complement or reversed value instead.
Then the numbers started working as expected.
I also went ahead and bumped the MCU clock frequency to 10mhz, so that
the math conversions would be real simple.
So using a 1mhz TCXO frequency source, the frequency counter and the
function generator counter all read the same value down to several
decimal places. Which is good enough for the function generator.

I think Chuck came closest with the Complementing of data or counting
down things to look for.
I think if I had ran the 590's QA to Portd.0 and QH to PortD.7 I would
have needed to transpose the result then.

Anyway, thanks to everyone for your ideas.

PS: I would have had this done sooner but my HP 5384A Frequency
Counter's Power supply suddenly went belly up on me on Tuesday, so I had
to come up with a way to fix it. Leave it to HP to put in the weirdest 5
volt regulator system I have come across (not counting secret HP part
numbers). So I ultimately wound up cutting the 5 volt line from the
shorted out powersupply, and bypassing it with a new 5 volt supply of my
own making. Now it works good again.

I think the HP engineer who came up with that weird supply should have
been shot. All they needed was a transformer, rectifier, some filter
caps and a voltage regulator, what's with the extra 5 IC's, several
transistors, big inductor, ferite beads, diodes, and zeners, choke
coils, 30 or so resistors and caps? It doesn't even have the battery
option installed either, that's a bunch more parts to add.

-----Original Message-----
>From: Chuck McManis [mailto:cmcmanis at mcmanis.com] 
Sent: Monday, September 29, 2003 10:03 PM
To: Earl Bollinger
Cc: dprglist at dprg.org
Subject: RE: [DPRG] Frequency Counter Question

At 05:56 PM 9/29/2003, Earl Bollinger wrote:
>Thanks for all the info guys. I think the timer gate may be off

Your math is correct in that 1Mhz should give you a count of 10,000 and 
that will be 10,000 binary or 0x2710, some interesting things to check
         1) You're bytes are swapped (in this case that would be
            0x1027 or 4135 decimal.)
         2) You're complementing the inputs then 0x2710 -> 0xd8ef
            55,535 decimal.
         3) You're counter is rigged to count "down" rather than
            up (also 55,535 decimal).

Note that on the latter, if you saw 49,652 and your 1Mhz source was 
calibrated and you were counting down instead of up, (a combination of 
errors) then your gate length would be 15.884 mS.

Interestingly, that is very close to 16, which is 2^4 and that is very 
possibly a pre-scaler /16 on your internal timer? This is common on the
you can pick a number of prescalers from 1:1 to 1:128.

Good luck,

More information about the DPRG mailing list