Perhaps it's best if I explain what I'm undertaking. I'm trying to create a simple circuit using a nano to test analog devices. These devices are old BBDs (bucket brigade device). There are two things I'm having trouble with.
Here's a very simple start;
#include <TimerOne.h>
void setup()
{
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
Timer1.initialize(100);
Timer1.pwm(9,512);
Timer1.pwm(10,512);
}
void loop(){
}
This code is providing 10kHz @ 50% duty cycle on two pins. I need pin 10 to be inverted from pin 9.
I would also like to implement a counter for each time pin 9 goes high. The thought is to record each stage/click it takes for a signal to travel through the BBD. The output would be monitored by a designated pin on the nano where the counter would freeze once a signal is provided.
Any suggestions?
I think you're out of luck with the inverted pin, without using a different processor than an AVR and writing a lot of custom register level code (the STM32F108C8 can do it, for example).
The counter can be done if you can tie an ISR to the timer.
Does your BBD require a two phase, non-overlapping clock? What is the part number?
They overlap at about 10% of the supply voltage - the original clock source doesn't provide perfect square pulses. A sharper pulse shouldn't hurt anything but if they cross high it may damage the device.
The concept should work on any panasonic MN3XXX BBDs.
Here's an ideal one - datasheet
Going back to the basics...
Secrets of PWM
The ATmega328P timers can generate inverted PWM but I don't know if the TimerOne library gives you access to that feature. You can also generate an interrupt once per cycle for the counting, but again I don't know if you can get the TimerOne library to do that for you. I would switch to direct register access of Timer/Counter 1.
KevinMitchell:
They overlap at about 10% of the supply voltage - the original clock source doesn't provide perfect square pulses. A sharper pulse shouldn't hurt anything but if they cross high it may damage the device.
The concept should work on any panasonic MN3XXX BBDs.
Here's an ideal one - datasheet
Going back to the basics...
Secrets of PWM
That is exactly what I said, a 2 phase non-overlapping clock. This adds another strict requirement to your application. Obviously, just an inverted output won't be enough. Notice that in the datasheet, a specialized clock IC is used to provide clock signals.
aarg:
That is exactly what I said, a 2 phase non-overlapping clock. This adds another strict requirement to your application. Obviously, just an inverted output won't be enough. Notice that in the datasheet, a specialized clock IC is used to provide clock signals.
Yeah you said it and I elaborated on the datasheet drawing.
These requirement aren't strict and the device can be and has been driven by logic ICs alone. The "specialized IC" only provides appropriate pulses and 14/15th of the supply voltage for VGG. It's accommodating, not specialized. In many ways its inferior to logic based clocks.
The basics are getting me close.

@johnwasser, I had tried that but was having trouble getting 50% duty cycle.
I may be over complicating things. Honestly what I'm trying to achieve shouldn't be that difficult. It's just something I haven't done with an arduino before.