interface

once I have my arduino programmed to display frequency. how do I interface my funtion generator with the arduino?

Well, mine's over IEE488, but you haven't told us anything about yours.

I have a ATMEGA328

I am making a function generator with a xr2206 funtion generator chip. It has a frequency selector with 6 settings form 1 meg to 1 Hz and fine tune with a potentiometer. I am using an arduino ATMEGA328

http://www.exar.com/Common/Content/Document.ashx?id=16&LanguageId=1033

not really understanding still...is there a pin off of the chip that I would use?

Yes you need to feed the signal from the function generator into one of the digital input pins. You need to make sure of two things:- 1) The voltage the arduino sees is enough to make it recognise it as a logic level signal. 2) You have to make sure it stays within the 0 and 5V limit on the input pins.

You can do this with an opto isolator or transistor buffer.

I assume he wants to display the frequency of the function generator on the arduino using the LCD that he has interfaced. @OP:- If this is wrong then please say what you want to do.

Yes im trying to have the Lcd display the frequency, what do i feed into the arduino? the outputs of the waveforms? or do I feed it directly from the potentiometer?

ok so how do I ensble that resistor and would i use…
#include <FreqCounter.h>

void setup() {
Serial.begin(57600); // connect to the serial port
Serial.println(“Frequency Counter”);
}

long int frq;
Void loop() {

FreqCounter::f_comp= 8; // Set compensation to 12
FreqCounter::start(100); // Start counting with gatetime of 100ms
while (FreqCounter::f_ready == 0) // wait until counter ready

frq=FreqCounter::f_freq; // read result
Serial.println(frq); // print result
delay(20);
}

for the code? or

#ifndef PulseCounter_h
#define PulseCounter_h

#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))

#include <avr/interrupt.h>
#include <WProgram.h>

namespace PulseCounter {
extern unsigned long pulses;
extern volatile boolean ready;
extern volatile unsigned long overflows;
extern volatile unsigned int refreshCount;
extern volatile unsigned int refreshTime;
void start(int ms);
void checkOverflow();
}

#endif

or

#include “PulseCounter.h”

unsigned long PulseCounter::pulses;
volatile boolean PulseCounter::ready;
volatile unsigned long PulseCounter::overflows;
volatile unsigned int PulseCounter::refreshCount;
volatile unsigned int PulseCounter::refreshTime;

void PulseCounter::start(int ms) {

#if defined (AVR_ATmega168)
refreshTime = ms / 2;

TCCR1A = 0;
TCCR1B = 0;
TCNT1 = 0;
sbi (TCCR1B, CS10);
sbi (TCCR1B, CS11);
sbi (TCCR1B, CS12);

TCCR2A = 0;
TCCR2B = 0;
cbi (TCCR2B, CS20);
sbi (TCCR2B, CS21);
sbi (TCCR2B, CS22);

cbi (TCCR2A, WGM20);
sbi (TCCR2A, WGM21);
cbi (TCCR2B, WGM22);
OCR2A = 124; // 16 MHz / 256 / 125 = 500 Hz

ready = false;
overflows = 0;
refreshCount = 0;
sbi (GTCCR, PSRASY);
TCNT2 = 0;
TCNT1 = 0;

cbi (TIMSK0, TOIE0);
sbi (TIMSK2, OCIE2A);

TCCR1B = TCCR1B | 7;

#endif
}

void PulseCounter::checkOverflow() {
if (TIFR1 & 1) {
PulseCounter::overflows++;
sbi(TIFR1, TOV1);
}
}

ISR(TIMER2_COMPA_vect) {
if (PulseCounter::refreshCount >= PulseCounter::refreshTime) {
TCCR1B = TCCR1B & ~7;
cbi (TIMSK2, OCIE2A);
sbi (TIMSK0, TOIE0);
PulseCounter::checkOverflow();
PulseCounter::pulses = (PulseCounter::overflows << 16) | TCNT1;
PulseCounter::ready = true;
}
PulseCounter::checkOverflow();
PulseCounter::refreshCount++;
}

Sorry to ask so many questions