Writing to Ports in Teesnsy 4.0

I am in no way a programmer, but I have played with the Arduino for some projects that are similar to pattern generators. I need to write to a port as fast as possible. The Teensy 4.0 should be much faster, but my simplest program fails to compile.

It seems that neither the DDRC or DDRB work in the Teensy 4.0 and it didn't like my While () without an argument. That's ok, I can remove it since there is no branch in this simplified code.

DigitalWriteFast only writes one bit at a time and I need to write to a full parallel output, though I don't need 32 bits (8 is generally enough). So, how do I write data to a port?

I imagine this is pretty basic and hopefully someone can point me in the write direction. I've tried looking for example code to replicate, but this doesn't look like a popular application, though it is for me.

Here is my very basic code that I wanted to use just to measure the output frequency of the pulses.

void setup() {



void loop() {

noInterrupts();//don't want them to mess with timing and for bit banging I don't generally use them


PORTB=34;// pulse
PORTB=30;// pulse


Direct write to PORTB is implemented in avr-gcc for AVR processors, but does PORTB even exist on the Teensy 4.0 ARM-Cortex processor?

Why would you use while() without an argument?

Consider posting on the PCJR (Teensy) forum, or browse through the forum yourself, where you might possibly encounter this post, which asks basically the same question.