teensypulse
New member
Hello,
I am trying to use Teensy as a very fast pattern generator. The pattern should be like ~us of pattern data and repetition rate of let say 50us.
In the past I used Arduino with the code something like this:
void setup() {
TIMSK0 = 0; // no interrupts
OCR0A = 0; // count to 2
DDRB = B00011100;
} // end of setup
// trigger 1 (port 11)
// pulse bit 2 (port 12)
// blanking 3 (port 13)
void loop()
{
double a;
PORTB = B00000000; // important to keep here
PORTB = B00000000; // important to keep here
PORTB = B00010000;
PORTB = B00010100; // ____||______
PORTB = B00010100; // __|------|___
PORTB = B00010100; // ________|---|_
PORTB = B00010000;
PORTB = B00011000; // pulse + protection
PORTB = B00010000;
PORTB = B00010000;
PORTB = B00010000;
PORTB = B00010000;
PORTB = B00000000; // important to keep here
PORTB = B00000000; // important to keep here
for(int i = 0; i <80; i++) // 50 us per 100 reps
PORTB = B00000000;
}
this worked fine, for the purpose, at the clock rate of imho 16MHz
Question - will I have any lack using this on Teensy architecture ? Can I reach clock rate of the chip with this approach ?
Thanks!!!
Boris
I am trying to use Teensy as a very fast pattern generator. The pattern should be like ~us of pattern data and repetition rate of let say 50us.
In the past I used Arduino with the code something like this:
void setup() {
TIMSK0 = 0; // no interrupts
OCR0A = 0; // count to 2
DDRB = B00011100;
} // end of setup
// trigger 1 (port 11)
// pulse bit 2 (port 12)
// blanking 3 (port 13)
void loop()
{
double a;
PORTB = B00000000; // important to keep here
PORTB = B00000000; // important to keep here
PORTB = B00010000;
PORTB = B00010100; // ____||______
PORTB = B00010100; // __|------|___
PORTB = B00010100; // ________|---|_
PORTB = B00010000;
PORTB = B00011000; // pulse + protection
PORTB = B00010000;
PORTB = B00010000;
PORTB = B00010000;
PORTB = B00010000;
PORTB = B00000000; // important to keep here
PORTB = B00000000; // important to keep here
for(int i = 0; i <80; i++) // 50 us per 100 reps
PORTB = B00000000;
}
this worked fine, for the purpose, at the clock rate of imho 16MHz
Question - will I have any lack using this on Teensy architecture ? Can I reach clock rate of the chip with this approach ?
Thanks!!!
Boris