Now that you are running a Teensy, you can use the method I am using for the printhead driver right now.
The assembler no operation command instructs the microcontroller directly to not not do any operation this cycle.
1 no operation is around 10 nanoseconds and is written like this
You can string them together like this.
Code: Select all
__asm__("nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t""nop\n\t"); //18 NOP's, ca. 200ns"
Use this code like it were a delay.
This value is for 96MHz on a Teensy 3.2. I will be different on a Teensy 3.6, but that you can tweak.
You also do not need the 8 pins and diodes to make it reach this speed on a single pin. The code below will do the same, only on just pin 1.
Code: Select all
byte pinTable[] = {2,14,7,8,6,20,21,5};
void setup()
{
for (int i=0; i<8; i++)
{
pinMode(pinTable[i],OUTPUT);
}
}
void loop()
{
GPIOD_PDOR |= 1;
GPIOD_PDOR &= !1;
}