Hi,
I'm trying to read in a digital signal with a clock speed of 2.1168MHz (using an Ardoino UNO r3). First I just want to forward that signal to another output pin. Shotly before I thought that there wouldn't be a possibility (after measuring a samplerate of ~125kHz) I found this forum post:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1208715493/11
Ok, they are changing the pre scale value for the analog inputs, but how can I achieve a higher digital sampling rate?
Later on I found articles about changing the prescale value of timers, but this does't affect my sampling rate at all. What am I doing wrong? Or is it possible to mess up with my clock speed in general?
My current code looks like this:
// defines for setting and clearing register bits
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
void setup(){
// set analog prescale to 2
cbi(ADCSRA,ADPS2) ;
cbi(ADCSRA,ADPS1) ;
cbi(ADCSRA,ADPS0) ;
//set timer1 prescale to clk/1, no prescaling
TCCR1B = 0x01;
DDRB = DDRB | B011011;
PORTB = B000000;
}
void loop(){
PORTB = (PINB & B000100) >> 1;
}
I hope someone can help me,
many greetings from germany
Jan