Charley468
Member
I have been learning the Teensy 3.6 and have a few questions which will show that I am new to the Teensy world!
Is there an equivalent for the Teensy like the Language Reference for the Arduino
https://www.arduino.cc/reference/en/
that shows the differences from the generic Arduino and the Teensy 3.6 and 4.0?
Like, where are the instructions and example on how to use “touchRead”? Is there a document with that information?
True, I found information on the forum but there must be instructions I don’t know about. I just came across “digitalWriteFast()” today… What other powerful and usefulness do I not know about??
The Arduino has “PORTB =0x00;”
The Teensy 3.6 has “GPIOD_PDDR = 0xFBFF;”
Neither of those work on the Teensy 4 (I totally understand “not yet implemented”)
I need to write 12 bits out at once
I see in the example “analogContinuousRead” that the ADC can read 16 bits at 193khz and 12 bits at 231khz. Is that only in the continuous read mode? Can I read one 16 bit word once every 10 us, do processing on that work then send it to the DAC in a 10us loop? If this is doable, are there code examples that show ADC/DAC setup and reading and writing single words?
“ContinuousRead” seems so asynchronous and where is the data that is read stored? How is it used in that example?
I need to read and write every 10 us – any jitter is seen as quantization noise
In this example I see this code:
digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN));
to toggle the LED? How does a read turn the LED off?
Is that faster then what Paul used in his I/O speed test
digitalWriteFast(14, HIGH);
digitalWriteFast(14, LOW);
Finally, am I missing some setup on A1, A21 and A22?
From the K66 spec:
“ 41.1.1 12-bit DAC Overview
This device contains two 12-bit digital-to-analog converters (DAC) with programmable
reference generator output.”
“39.2 Introduction
The 16-bit analog-to-digital converter (ADC) is a successive approximation ADC
designed for operation within an integrated microcontroller system-on-chip.”
void setup()
{
pinMode(A1, INPUT);
pinMode(21, OUTPUT);
Serial.begin(9600);
}
int result;
void loop()
{
result = analogRead(A1);
Serial.print(result);
analogWrite(A21, result);
}
The input read never goes over 1023 (if 16 bits it should be 0 to 64k) and anything over 255 output results in 3.3 volts output. 12 bits should give 0 to 4095 for 3.3 volts output. Why is the input limited to 10 bits and the output limited to 8 bits?
I realize the questions show my newness.
Thank you for your patience in answering my questions (that everybody should know!)
Is there an equivalent for the Teensy like the Language Reference for the Arduino
https://www.arduino.cc/reference/en/
that shows the differences from the generic Arduino and the Teensy 3.6 and 4.0?
Like, where are the instructions and example on how to use “touchRead”? Is there a document with that information?
True, I found information on the forum but there must be instructions I don’t know about. I just came across “digitalWriteFast()” today… What other powerful and usefulness do I not know about??
The Arduino has “PORTB =0x00;”
The Teensy 3.6 has “GPIOD_PDDR = 0xFBFF;”
Neither of those work on the Teensy 4 (I totally understand “not yet implemented”)
I need to write 12 bits out at once
I see in the example “analogContinuousRead” that the ADC can read 16 bits at 193khz and 12 bits at 231khz. Is that only in the continuous read mode? Can I read one 16 bit word once every 10 us, do processing on that work then send it to the DAC in a 10us loop? If this is doable, are there code examples that show ADC/DAC setup and reading and writing single words?
“ContinuousRead” seems so asynchronous and where is the data that is read stored? How is it used in that example?
I need to read and write every 10 us – any jitter is seen as quantization noise
In this example I see this code:
digitalWriteFast(LED_BUILTIN, !digitalReadFast(LED_BUILTIN));
to toggle the LED? How does a read turn the LED off?
Is that faster then what Paul used in his I/O speed test
digitalWriteFast(14, HIGH);
digitalWriteFast(14, LOW);
Finally, am I missing some setup on A1, A21 and A22?
From the K66 spec:
“ 41.1.1 12-bit DAC Overview
This device contains two 12-bit digital-to-analog converters (DAC) with programmable
reference generator output.”
“39.2 Introduction
The 16-bit analog-to-digital converter (ADC) is a successive approximation ADC
designed for operation within an integrated microcontroller system-on-chip.”
void setup()
{
pinMode(A1, INPUT);
pinMode(21, OUTPUT);
Serial.begin(9600);
}
int result;
void loop()
{
result = analogRead(A1);
Serial.print(result);
analogWrite(A21, result);
}
The input read never goes over 1023 (if 16 bits it should be 0 to 64k) and anything over 255 output results in 3.3 volts output. 12 bits should give 0 to 4095 for 3.3 volts output. Why is the input limited to 10 bits and the output limited to 8 bits?
I realize the questions show my newness.
Thank you for your patience in answering my questions (that everybody should know!)