Author Topic: Oscilloscope tester like Hameg HZ60  (Read 19388 times)

0 Members and 1 Guest are viewing this topic.

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Oscilloscope tester like Hameg HZ60
« Reply #25 on: August 02, 2017, 05:24:57 pm »
I just noticed that the second part of that dual slope is on both edges so it cannot be heating of the MOSFET channel because one of those pulses is at ground where no current is flowing unless it is leakage which seems really unlikely into 50 ohms.  The leading edge problem is still there though.  Maybe there *is* something wrong with his oscilloscope.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #26 on: August 02, 2017, 06:02:31 pm »
Here's PIC code (in XC8 C) for HZ60 style calibrator signals:
Code: [Select]
/***************************************************************************
*              Oscilloscope Calibrator Timing Generator                    *
****************************************************************************
* Description:    Produces true squarewaves on GP2 at frequencies 10^N Hz  *
*                 between 1KHz & 1MHz + DC level from 16MHz crystal input. *
*                 The frequency is set by a binary number on pins          *
*                 <GP3><GP1><GP0>, 0 is 1MHz, 1 is 100KHz etc. decreasing  *
*                 to DC (Vcc).  Out of range gives 0V out.             *
* FileName:       calibrator.c                                             *
* Version:        0.2 - incomplete HZ60 emulation                          *
* Dependencies:   See INCLUDES section                                     *
* Processor:    PIC12F683 (can port to other midrange devices with CCP)  *
* Hardware:       16MHz crystal on OSC1 & OSC2, or ext. 16MHz clock reqd.  *
* Complier:       Microchip XC8                                            *
* Author:       Ian.M                                                    *
* Licence:        "THE BEER-WARE LICENSE" (Revision 42)                    *
***************************************************************************/

/*
 * -------------------------------------------------------------------------
 * "THE BEER-WARE LICENSE" (Revision 42):
 * "Ian.M" <https://www.eevblog.com/forum/profile/?u=104739> wrote this file.
 * As long as you retain this notice you can do whatever you want with this
 * stuff.  If we meet some day, and you think this stuff is worth it, you
 * can buy me a beer in return.     Ian.M
 * --------------------------------------------------------------------------
 */

/********** CONFIG **********/
// PIC12F683 Configuration Bit Settings

#pragma config FOSC = HS        // Oscillator Selection bits
   // (HS oscillator: High-speed crystal/resonator on RA4/OSC2/CLKOUT and RA5/OSC1/CLKIN)
#pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = ON       // Power-up Timer Enable bit (PWRT enabled)
//#pragma config MCLRE = ON       // MCLR Pin Function Select bit (MCLR pin function is MCLR)
#pragma config MCLRE = OFF      // MCLR Pin Function Select bit
   // (MCLR pin function is digital input, MCLR internally tied to VDD)
#pragma config CP = OFF         // Code Protection bit
   // (Program memory code protection is disabled)
#pragma config CPD = OFF        // Data Code Protection bit
  // (Data memory code protection is disabled)
#pragma config BOREN = ON       // Brown Out Detect (BOR enabled)
#pragma config IESO = OFF       // Internal External Switchover bit
   // (Internal External Switchover mode is disabled)
#pragma config FCMEN = OFF      // Fail-Safe Clock Monitor Enabled bit
   //(Fail-Safe Clock Monitor is disabled)

/********** INCLUDES **********/
#include <xc.h>
#include <stdint.h>

/********** DEFINES **********/
typedef struct { uint8_t Pre; uint8_t Period; uint8_t Duty;} freq_t;
typedef enum{  F_1MHz, F_100KHz, F_10KHz, F_1KHz, F_DC, N_Modes} mode_t;

/********** GLOBALS **********/
const freq_t freqs[]={  // Frequency table
                                       // Freq     Fosc divisor
                                       // ----     ------------
                        {0, 3, 2},     // 1MHz     /16
                        {0, 39, 20},   // 100KHz   /160
                        {1, 99, 50},   // 10KHz    /1600
                        {2, 249, 125}, // 1KHz     /16K
                        {0, 127, 255}  // DC by duty cycle >100%
                     };

/********** CODE **********/
void main(void){
   // variables
mode_t mode=F_DC, oldmode=N_Modes;

   // setup
   GPIO=0;
   TRISIO=0b111011; // All inputs except GP2/CCP1
   ANSEL=0; // All digital inputs
   CMCON0bits.CM=0b111; //Comparator disabled
   CCP1CONbits.DC1B=0b00; // No fractional duty cycle bits
   
      do{ // main loop
      //Read mode from port, skipping bit 2
      mode=(GPIObits.GP3<<2)|(GPIO&0b11);
      // Set new mode
      if(mode!=oldmode){
         if(mode<N_Modes){
            // Disable PWM, set output low, stop timer.
            CCP1CONbits.CCP1M=0b0000; // Off
            GPIObits.GP2=0;
            T2CONbits.TMR2ON=0;
            // Load frequency data
            T2CONbits.T2CKPS=freqs[mode].Pre;
            PR2=freqs[mode].Period;
            CCPR1L=freqs[mode].Duty;
            // Restart timer and PWM
            TMR2=0xFF; // so it rolls to 0 ASAP for PWM restart
            CCP1CONbits.CCP1M=0b1100; // PWM, active high
            T2CONbits.TMR2ON=1;
            // Done.         
            oldmode=mode;
         }else{
            // Disable PWM, set output low.
            CCP1CONbits.CCP1M=0b0000; // Off
            GPIObits.GP2=0;
         }
      }
   }while(1); // End main loop
}
Tested under MPLAB 8 SIM - I don't have a PIC12F683 and a good enough scope handy to test it in real life.   

It currently only covers the range 1KHz - 1MHz

Enjoy!  :popcorn:

See calibrator2.c attached to reply #34 below for improved version that adds frequencies down to 1Hz.
« Last Edit: August 17, 2017, 07:34:31 am by Ian.M »
 
The following users thanked this post: 2N3055

Offline 2N3055

  • Super Contributor
  • ***
  • Posts: 6595
  • Country: hr
Re: Oscilloscope tester like Hameg HZ60
« Reply #27 on: August 02, 2017, 06:24:31 pm »
Here's PIC code (in XC8 C) for HZ60 style calibrator signals:

Tested under MPLAB 8 SIM - I don't have a PIC12F683 and a good enough scope handy to test it in real life.   Enjoy!

Wow! that is good work Ian ! Nice!!

This is starting to be productive... We might even settle on a design that works nicely..

Regards,

Sinisa


 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #28 on: August 02, 2017, 06:57:32 pm »
Its still got three possible mode numbers left, (assuming you don't actually need 0V DC out with it powered up).   I could write some output compare code to extend it for 100Hz, 10Hz and 1Hz, for better HZ60 compatibility, or if there's demand for it implement other signals - I need at least 20us between edges, but they will be cycle accurate with a resolution of up to 250ns.

Making it work with other crystal frequencies is a little tricky - it MUST be N*4MHz to support 1MHz out so you are S.O.L. if you want to run it off a 10MHz GPSDO, unless you use a XOR + delay to frequency double to 20MHz.
« Last Edit: August 02, 2017, 07:15:50 pm by Ian.M »
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Oscilloscope tester like Hameg HZ60
« Reply #29 on: August 02, 2017, 07:13:26 pm »
Here are a couple of photographs from my PG506 and 100 MHz 2232 showing what I would expect.

The first one duplicates the conditions of the photograph from the antiqueradios forum.  There is something at the corner of the fast edge but nothing like that dual slope.

The second one shows the detail of the edge.  The oscilloscope's transient response is a little better than +2%, -2%, and 4% peak-to-peak which is within the 2232 specification of +6%, -6%, and 6% peak-to-peak.  Rise time appears to be exactly 3.5 nanoseconds which is no surprise for a 100 MHz bandwidth.

Neither photograph shows any linear discontinuities which indicate problems like slew rate limiting, saturation, cutoff, or thermal effects.  The important thing to note is that the slope discontinuity in the photograph from the antiqueradios forum would completely mask what the transient response of even a 100 MHz oscilloscope should look like.
« Last Edit: August 02, 2017, 07:16:34 pm by David Hess »
 

Offline 2N3055

  • Super Contributor
  • ***
  • Posts: 6595
  • Country: hr
Re: Oscilloscope tester like Hameg HZ60
« Reply #30 on: August 02, 2017, 07:18:00 pm »
Ian,
running it off good 16MHz quartz or TCXO is more than enough for the purpose..

I was also thinking about ATmega328P with similar code..
It would be easier to implement UI.. Few LEDS, few buttons..

Regards,
Sinisa
 

Offline 2N3055

  • Super Contributor
  • ***
  • Posts: 6595
  • Country: hr
Re: Oscilloscope tester like Hameg HZ60
« Reply #31 on: August 02, 2017, 07:29:18 pm »
David,

that looks real good.. I will investigate further in next few days......
Thanks for the effort and knowledge...

Regards,

Sinisa
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #32 on: August 02, 2017, 07:40:25 pm »
As I said *way* up thread, more pins makes the UI easier no matter whether its PIC or AVR based, though for real cheap-skates I could easily implement a resistor ladder (or weighted resistors and a BCD switch) to an ADC input for mode selection to save pins.  OTOH, as all the frequency generation is handled by hardware in the background, on a more powerful MCU, there's no reason why it couldn't handle a rich UI - anything up to a graphic LCD + touchscreen in the foreground superloop.

I'd have to do some actual hardware experimentation to verify the  timings if I ported it to an ATmega328P.  The algorithm would be pretty much the same - the only differences would be the const freqs[] array contents and the code to stuff the registers to set up each PWM frequency.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Oscilloscope tester like Hameg HZ60
« Reply #33 on: August 02, 2017, 08:29:25 pm »
That dual-slope on the edge is what is bothering you.. I would think it has to do with saturation characteristics of mosfets in output stage as they approach power rails voltage, or something like that.

Thinking about it, I like your idea better.  Maybe it explains both problems.

It is not something I have looked at in detail because I have never bothered using saturated output transistors in designs like these.  I either used a diode to disconnect the output which is then pulled to ground by the termination resistor or a current output into a shunt resistance.  The practical limit for the diode disconnect design is better than 250 picoseconds and good for calibration up to 1 GHz.

Analog switches can work well for generating a clean and calibrated adjustable peak-to-peak output signal from a precision DC reference but are too slow and have too much capacitance for a precision fast edge.  Older designs use a precision resistor and calibrated currents which are easy to switch using diodes and bipolar transistors even at high voltages.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #34 on: August 03, 2017, 02:08:51 am »
Now the PIC12F683 can do all the frequencies the Hameg HZ60 can (1MHz to 1Hz + DC).  All it will need is a 16MHz crystal+ load caps, decoupled supply, an 8 position switch for frequency selection, and whatever the consensus is for the best output stage and precision attenuator. 

Code tested under MPLAB 8 SIM for all the frequencies.


Suggested octal encoded switch: Grayhill 94HBB08T + Knob from Mouser.   Tie common to Vss and add 10K pullups to Vdd on all the PIC's frequency control pins.   N.B: make sure the switch is in position 0 (all open) for PIC ICSP.
 

Offline cosenmarcoTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: de
Re: Oscilloscope tester like Hameg HZ60
« Reply #35 on: August 03, 2017, 07:10:11 am »
Wow the PIC design is really starting to take shape.

Ian.M  thanks for pointing out the limitations of the PICDIV and the complexity associated with PIC programming. I did a PIC project many years ago and it was quite hard.

I think I will settle to PIC12F683. I don't really need to have exact UI of the Hameg and I think I have 3 GPIO pins free for frequency selection which I will implement using 3 dip switches which will set the bits directly: no need for fancy pancy rotary switches and diode matrixes or (worse) touchscreen crap.

David Hess and 2N3055: Great stuff! I'd like to hear about the experiments.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #36 on: August 03, 2017, 01:55:11 pm »
Yes, the project does seem to be coming together nicely.   We do need some input here from the fast pulse, short risetime gurus, for the most cost effective way of producing the buffered output, without 'select on test' parts, as I for one don't have a good enough scope to do that selection.  I think we'll need the PCB layout for that section as well as some of the factors involved are not obvious to many of us.   Unless there is a *CLEAR* case to reject them, I suggest aiming for the same output options and amplitude trimmability as the HZ60.

DIP switches do seem a little clumsy for the UI, but I suppose they aren't a bad choice if you want to make it as a cheap as possible bare board OSHW project.   Use a 4 switch one with 3 for selection and the 4th for power and silk screen the frequency table next to it on the PCB.    For power, I'm thinking 9V PP3 and linear regulator to keep it as cheap as possible while still being able to run to about 90% 0f its 0.8V/cell EOL - it isn't worth putting the effort into designing a low enough noise switching regulator or single sell boost converter.  It would be nice to put together a community project good enough to send to Dave.

On the UI side of things, if there's a spare inverter I could mod the code to use two three position slide switches or center off toggle switches, to select the frequencies from a 3x3 grid which might be a bit more intuitive than DIP switches.  Use DPDT-CO switches and the center position of the grid can be power off, or if you stick to SPST-CO switches, I could re-work the code to add a 0.1Hz option, or any other pulse pattern suggested.  I do feel its worth retaining the Hameg Hz60's look and feel and to that end, I could also use a SP10T rotary switch with 8 2.2K resistor wired between 9 of its positions as a potential divider feeding an ADC input for frequency selection.  If I add a ultra low power regulator with a /SHUTDOWN pin, the same switch's 10th position can be power off - simply put a 3.3Meg pullup to +Batt on  /SHUTDOWN to turn the regulator on, and when the switch is in the OFF position, it sinks a few uA through the ADC input (via a 1K series resistor)  and the PIC's upper input protection diode into the  Vcc rail to hold it off.  100K from Vdd to 0V will keep the rail low enough for it to stay in shutdown.  To actually get it to turn off, in the first place, the PIC would make the ADC pin an output and drive it low periodically, between polling the ADC for the switch setting.   That arrangement with a regulator that has 1uA standby current would use 23% of the alkeline PP3 battery capacity during its 5 year shelf life*.  If the regulator has 5uA standby current it will use 48% of the battery capacity - still acceptable.  Add a micropower comparator and a few resistors and I can add low battery detection, and make the PIC blink the power LED if there isn't enough headroom to maintain the 5V rail.  HZ60 style auto-power-off is a little trickier without going up in pin count and leaving the PIC powered in sleep mode.   Its easy to get auto-power-off wrong: EPE and Silicon Chip magazines seem to manage it at least annually judging by the number of their project articles that have a part 2 or 3 errata that's basically ripping out the auto-power-off or dumbing it down to a long time constant RC network!

I can also help with porting to other PICs - tell me what you've got with an (E)CCP/10 bit PWM module and I can probably churn out a version to suit pretty quickly.  An AVR/Arduino port would be a *MUCH* bigger project for me as I'm not familiar with the AVR OC/PWM modules to anywhere near the same extent I know the PIC ones, and don't have a cycle-accurate AVR simulator to verify the timing on.

*ENERGIZER 522 (9V PP3 Alkaline): Capacity typ. 700mAH to 6.0V @10mA CC load.  Shelf life is nominally 5 years to 80% capacity remaining.
« Last Edit: August 03, 2017, 02:26:16 pm by Ian.M »
 

Offline HighVoltage

  • Super Contributor
  • ***
  • Posts: 5468
  • Country: de
Re: Oscilloscope tester like Hameg HZ60
« Reply #37 on: August 03, 2017, 03:16:57 pm »
I still have my original Hameg HZ 60-2 from a long time ago, bought it brand new.
Growing up in Germany, one had to have a Hameg scope and an HZ60.
These days, I am using my Keysight 33522B Generator to calibrate old analog scopes.

If it helps the project, I could take measurements of what this HZ 60-2 is capable of, on a modern scope.
There are 3 kinds of people in this world, those who can count and those who can not.
 
The following users thanked this post: 2N3055

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #38 on: August 03, 2017, 03:56:15 pm »
That would be nice, especially an A-B comparison between it and the Keysight 33522 set for the same nominal output.  Also, if you are willing to open the HZ-60, some good closeup photos of both sides of the board would be a big help with the output stage layout for the DIY version - copying Hameg's output stage layout and circuit should give closely comparable specs.
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Oscilloscope tester like Hameg HZ60
« Reply #39 on: August 03, 2017, 04:37:59 pm »
That would be nice, especially an A-B comparison between it and the Keysight 33522 set for the same nominal output.  Also, if you are willing to open the HZ-60, some good closeup photos of both sides of the board would be a big help with the output stage layout for the DIY version - copying Hameg's output stage layout and circuit should give closely comparable specs.

You can find schematics of the Hameg HZ-60 online or at least enough of them to see what they were doing.

All three outputs come from resistor dividers driven by a single 74HC00 logic gate powered by some type of discrete low dropout regulator which I assume is trimmed for an exact output voltage.  That can provide enough accuracy for limited vertical calibration but is not suitable for transient response testing on anything faster than about 20 MHz.

In theory the same output stage can be used for high bandwidth transient response testing and vertical calibration up to maybe 5 volts but in practice I have always seen them implemented as separate outputs which is just easier.  A full capability calibrator needs to support outputs up to at least 20 volts peak-to-peak (4 divisions at 5V/div) which is incompatible with edges fast enough for 100 MHz bandwidth testing.
 
The following users thanked this post: 2N3055

Offline HighVoltage

  • Super Contributor
  • ***
  • Posts: 5468
  • Country: de
Re: Oscilloscope tester like Hameg HZ60
« Reply #40 on: August 03, 2017, 04:57:40 pm »
Here are some pictures of the HZ60 inside
There are 3 kinds of people in this world, those who can count and those who can not.
 
The following users thanked this post: 2N3055

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Oscilloscope tester like Hameg HZ60
« Reply #41 on: August 03, 2017, 05:36:14 pm »
That Hameg custom divider IC is hilarious.

The 4060 is part of a timing circuit which powers the instrument for about 3 minutes when the power button is pressed and then shuts it off.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #42 on: August 03, 2017, 05:54:23 pm »
@HighVoltage,

So its single sided with the only proper ground plane round the board edges.  One could reproduce that output stage with copper foil tape on matrix board and get almost identical results.   

As you couldn't easily photo the track side, its fortunate that the Radiomuseum HZ-60 page has the top-view PCB layout.   Rotated 180 deg, it looks like it matches your board photo #2.  Its interesting to see the how the 50R terminator has been removed from the board and wired direct to the BNC socket to reduce inductance.

Can you check the 74HC00 supply voltage and the DC out 2.5V level to 3 d.p.s please?   I suspect a +/- 0.5V adjustment range for an adjustable LDO will be plenty, and the PIC will be happy enough over the same supply range.   

We've nearly got enough info to build a PIC based functional clone . . .

That Hameg custom divider IC is hilarious.
How else would you do it back in 1985 or '86 without a board full of logic?  I don't think you could fit a 5 decade divider chain in a contemporary PAL.  ASICs were very much the thing.
Quote
The 4060 is part of a timing circuit which powers the instrument for about 3 minutes when the power button is pressed and then shuts it off.
Yes that bit seems like either it was an afterthought or they couldn't fit another two decades into the ASIC.   Otherwise it would have been a no-brainer to expand it to 0.1Hz (the switch is already 12 way stopped to 8 way) and put the power hold on logic in the ASIC so all it needs is an external level shifter and pass transistor.   


« Last Edit: August 03, 2017, 06:17:47 pm by Ian.M »
 

Offline cosenmarcoTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: de
Re: Oscilloscope tester like Hameg HZ60
« Reply #43 on: August 03, 2017, 08:30:03 pm »
Hey @HighVoltage vielen Dank for the close ups. The measurements on the voltage rails would be very much appreciated.

David Hess:
Quote
A full capability calibrator needs to support outputs up to at least 20 volts peak-to-peak
For sure this project doesn't aim at being a full fledged calibrator. For me it would be a handy device with close to no setup to whack into the scope and check roughly its calibration status and to check probe compensation when changing probes. I'm talking about low-end analog scopes.

@Ian.M: auto power off would be a nice little touch. I still have to think about the best way to implement the UI in a way that allows minimal setup and makes economy of PIC pins...

I don't know if anybody spotted yet the TL431-based adjustable voltage reference. Looking at the resistance divider for the 2.5V output, the output of the 74HC00 should be at (2.5Vpp*650Ohm)/500Ohm = 3.25Vpp which is compatible with the 74HC00 datasheet for recommeded operation and also makes sense to power with 4xAA batteries. This is though not good for PIC operation at 16Mhz so the replication of the Hameg's output stage is not an option with PIC driven oscillator.
« Last Edit: August 03, 2017, 08:32:56 pm by cosenmarco »
 

Offline cosenmarcoTopic starter

  • Regular Contributor
  • *
  • Posts: 59
  • Country: de
Re: Oscilloscope tester like Hameg HZ60
« Reply #44 on: August 03, 2017, 09:02:54 pm »
So, speaking of pin economy, in the PIC12F683 we have 8 pins total.
- 2 are for power supply (VDD, VSS)
- 2 are for crystal oscillator (ORC1, OSC2)
- 1 is for the output (CCP1)

This leaves 3 pins for UI. Enough to build all 8 frequency combinations but we would need 2 other pins:
- 1 pin to turn the device on (INTx)
- 1 pin to drive the other parts of the circuit on (voltage reference and output stage)

Am I missing something?

If the output stage uses the 74AC14 we could use one of the spare inverters to build a https://en.wikipedia.org/wiki/Pierce_oscillator and provide external clock to the PIC effectively gaining one pin (would cross -talk in the 74AC14 actually be a problem?) but still 1 pin would be missing.

The alternative suggested by Ian.M is to drive an ADC pin (ANx) with a resistor ladder and some sort of rotary / linear switch to represent different UI settings. This would free up 2 pins.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #45 on: August 03, 2017, 10:07:33 pm »
I don't know if anybody spotted yet the TL431-based adjustable voltage reference. Looking at the resistance divider for the 2.5V output, the output of the 74HC00 should be at (2.5Vpp*650Ohm)/500Ohm = 3.25Vpp which is compatible with the 74HC00 datasheet for recommeded operation and also makes sense to power with 4xAA batteries. This is though not good for PIC operation at 16Mhz so the replication of the Hameg's output stage is not an option with PIC driven oscillator.
Not a problem.  If you need to run the output buffer at about 3.3V, make sure the regulator's feedback input is ground referenced, then simply use 2 silicon diodes after the adjustable regulator to drop the output voltage and take the feedback from the 3.3V rail.   The PIC can be powered by a minimum of  4.5V, probably somewhere between there and 5V.   The logic level mismatch can be easily handled with a potential divider with a few pF of capacitance across the upper resistor, tweaked to be slightly underdamped for best risetime.

Alternatively, just use a PIC that's rated for 3.3V operation at 16MHz. A 14 pin PIC16F1823 would be a good candidate  and the extra I/O pins could simplify frequency selection, or if we are sticking to shoehorning it into to an 8 pin PIC then use a PIC12F1822.   We could also use the Reference Clock Module, routed through the Data Signal Modulator (as its default output is on OSC2) to concurrently output a 1MHz reference clock - or any other binary divisor of the crystal frequency down to /128.

I could probably also tweak the PIC12F683 code to run with an 8MHz crystal and still output 1MHz.   I'd need to change all the PR2 constants (integer divide by 2), and add code to right shift the duty cycles before loading CCPR1L and dump the original LSB into CCP1CONbits.DC1B1.
So, speaking of pin economy, in the PIC12F683 we have ...
...
... 3 pins for UI. Enough to build all 8 frequency combinations but we would need 2 other pins:
- 1 pin to turn the device on (INTx)
- 1 pin to drive the other parts of the circuit on (voltage reference and output stage)

Am I missing something?

If the output stage uses the 74AC14 we could use one of the spare inverters to build a https://en.wikipedia.org/wiki/Pierce_oscillator and provide external clock to the PIC effectively gaining one pin (would cross -talk in the 74AC14 actually be a problem?) but still 1 pin would be missing.

The alternative suggested by Ian.M is to drive an ADC pin (ANx) with a resistor ladder and some sort of rotary / linear switch to represent different UI settings. This would free up 2 pins.
You can get cute and read a digital I/O pin as High/Low/Floating - it needs a small cap (few tens of pF) at the pin to hold the state + a series resistor to the moving contact of a SPDT center off switch.   The strategy is to read the pin, then briefly make it an output and pulse it to the opposite state  - if it stays there long enough, the input is floating.   If it is floating, make it an output until you poll it again to avoid floating pins increasing power consumption.    Two pins would give nine possible combos.  Together with freeing up GP4/OSC2, that would give you the extra input (only) pin - GP3 and output pin you need.   I really wouldn't recommend stealing gates from the output buffer for a Pierce oscillator, as there's far too much risk of crosstalk.  A Pierce oscillator spends too much time in the linear region so there would almost certainly be intermodulation due to the supply and ground impedance, leading to Fosc ripple on the top and bottom of the squarewave and if you are unlucky with the gate delays a possible glitch on the rising or falling edge.  It would be much safer to use a separate TCXO module which would also improve the uncalibrated frequency accuracy.

And yes, using the ADC input for mode selection is fairly trivial - After adding ADC setup code to the initialisation section, in the main loop simply rip out the line that that sets mode from the GPIO port:
Code: [Select]
  mode=(GPIObits.GP3<<2)|(GPIO&0b11);replacing it with code that triggers the ADC and waits for the result, then shifts the whole result left one bit adds 0x0080 to it for rounding, then throws away the low byte to get a three bit result in the high byte to stuff into mode directly compatible with the rest of the existing code. (or you could even shift it two bits to keep a 4 bit result and add the intermediate 500KHz, 50KHz, 5KHz, 500Hz, 50Hz and 5Hz frequencies).   The minimum hardware is a 1P7T rotary switch (possibly 1P8T if we want to get cute with using it for power as well) and seven equal resistors in a potential divider chain between Vdd and Vss.

On the subject of UIs, 6 LEDs arranged on the sides of a  3x3 grid can be charliplexed with only 3 I/O pins to indicate any one of nine states (without getting into blinking etc.) and the control could be a simple pushbutton to cycle through them or two, one for each side.  You'd need a PIC16 to have enough pins but it could be a lot cheaper than a decent quality rotary switch.   You can do 12 LEDs with 4 I/O pins which would allow an individual LED for each mode.
« Last Edit: August 03, 2017, 10:22:34 pm by Ian.M »
 

Offline 2N3055

  • Super Contributor
  • ***
  • Posts: 6595
  • Country: hr
Re: Oscilloscope tester like Hameg HZ60
« Reply #46 on: August 03, 2017, 10:13:56 pm »
You can't use 74AC14 for anything except that one gate for output.. You can inject all kinds of crap into output.
I think single gate logic would be perfect here, but I want to replicate previous results before going further..
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Oscilloscope tester like Hameg HZ60
« Reply #47 on: August 03, 2017, 11:56:56 pm »
That Hameg custom divider IC is hilarious.

How else would you do it back in 1985 or '86 without a board full of logic?  I don't think you could fit a 5 decade divider chain in a contemporary PAL.  ASICs were very much the thing.

I suspect they either already had that IC in production or someone else had it and marked it for Hameg.  Of course Tektronix was making low volume ICs for their own use and so maybe Hameg was doing the same.

Did Hameg make an oscilloscope with selectable frequencies for its probe calibrator output?

Quote
Quote
The 4060 is part of a timing circuit which powers the instrument for about 3 minutes when the power button is pressed and then shuts it off.

Yes that bit seems like either it was an afterthought or they couldn't fit another two decades into the ASIC.   Otherwise it would have been a no-brainer to expand it to 0.1Hz (the switch is already 12 way stopped to 8 way) and put the power hold on logic in the ASIC so all it needs is an external level shifter and pass transistor.

The Hameg counter IC only provides one output at a time.  The switch controls various logic inputs to the counter IC to select which output is selected.

You can't use 74AC14 for anything except that one gate for output.. You can inject all kinds of crap into output.
I think single gate logic would be perfect here, but I want to replicate previous results before going further..

I would probably try to use the CMOS output from the PIC itself.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12852
Re: Oscilloscope tester like Hameg HZ60
« Reply #48 on: August 04, 2017, 12:41:53 am »
There was an interesting thread on fast rise time logic gates for scope calibration a few years back: https://www.eevblog.com/forum/testgear/fast-rise-time-2ns-or-1ns-signal-generator/

The SN74LVC1G04 single inverter was suggested and one of the members was getting sub-ns rise-times.

The SN74LVC1G17 Schmitt input buffer/driver might also be worth a look - depending on the risetime of its input from the PIC's CCP pin, it *may* do better.   

Both SN74LVC1G series gates have 5.5V tolerant inputs even when their Vcc is reduced and are suitable for logic level down-conversion so the amplitude can easily be trimmed with a variable regulator.

 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16607
  • Country: us
  • DavidH
Re: Oscilloscope tester like Hameg HZ60
« Reply #49 on: August 04, 2017, 04:08:01 am »
I was looking at doing this before I got a PG506.  One of the designs I considered used a tristate LVC or similar CMOS gate to drive an RF transistor cascode (1) and schottky diode as shown in those schematics I posted.  The collector of the RF transistor drives the diode and 50 ohm parallel termination at the output BNC.  10 milliamps of collector current then gives a 0.5V open circuit output and 0.25 volts into a 50 termination but 4, 8, or 20 milliamps could be used also for 0.2/0.1, 0.4/0.2, and 1.0/0.5 volts.  Higher voltages would require more current and parallel CMOS gates.

The gain of the transistor produces a faster edge than the gate can produce by itself and the configuration makes for a cleaner edge.

The problem here is that it requires a second supply voltage higher or lower than ground or Vcc.

(1) Something like a SOT-223 packaged BFG31 or BFG97 or SOT-89 packaged BFQ149 or BFQ19 but there are lots of options.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf