Hello,
I was using arduino so far and this is my first project in teensy.
In fact I have a code running on arduino and want to transfer it (or modify accordingly) so to use teensy.
The whole task is to (mainly) calculate the product of 2 trigonometric numbers , do some conversions and output the result (for use with a DAC).
Because the floats are out of discussion (too slow on arduino), i used integer calculations instead (for example: uint16_t(sin(a)*65535)).
But even with this approach I cant go faster than 20usec
the project uses an ovf interrupt every 30usec (to redirect flow to the main routine), on a mega2560.
The code for the i/r is
I have done all the changes for the input, calculation and output, (for example instead of PORTA ->GPIOA_PDDR and GPIOA_PDOR ), no help is needed for this part
But I cannot find a solution for the i/r
Some help would be much appreciated
thank you.
I was using arduino so far and this is my first project in teensy.
In fact I have a code running on arduino and want to transfer it (or modify accordingly) so to use teensy.
The whole task is to (mainly) calculate the product of 2 trigonometric numbers , do some conversions and output the result (for use with a DAC).
Because the floats are out of discussion (too slow on arduino), i used integer calculations instead (for example: uint16_t(sin(a)*65535)).
But even with this approach I cant go faster than 20usec
the project uses an ovf interrupt every 30usec (to redirect flow to the main routine), on a mega2560.
The code for the i/r is
Code:
void setup()
{
....
pinMode(40, OUTPUT); //oscillo
pinMode(41, OUTPUT); //oscillo
for (x = 22; x < 38; x++) pinMode(x, OUTPUT); //outputs
cli();
// use timer5
// ( initialise values)
TCCR5A = 0; // set entire TCCR1A register to 0
TCCR5B = 0; // set entire TCCR1B register to 0
TIMSK0 &= ~(1 << TOIE0); //disable millis(), avoid jittering
TIMSK5 |= (1 << TOIE1 ); // Enable overflow interrupt
sei();
TCNT5 = LoadValue; // Preload timer with precalculated value
TCCR5B |= (1 << CS10 ); // Set up timer at Fcpu /1
}
//---------------------------------------------------
ISR ( TIMER5_OVF_vect )
{
//show on osc "start of isr"
PORTG = PORTG & B11111101;
....
//show on osc "end of isr"
PORTG = PORTG | B00000010;
}
I have done all the changes for the input, calculation and output, (for example instead of PORTA ->GPIOA_PDDR and GPIOA_PDOR ), no help is needed for this part
But I cannot find a solution for the i/r
Some help would be much appreciated
thank you.