3 Phase Motor Driver and Fast Port Manipulation

Status
Not open for further replies.

RRdae

Active member
I am working on building the program for a 3 phase motor driver that I constructed, but I am noticing some timing discrepancies arising from small delays in digital write commands. Specifically, during times when I want all three phases to be low or high, I am seeing delays of approximately 250ns between each command. Using DigitalWriteFast offers nearly the same result as using DigitalWrite.

So I have two questions:

1. Does anyone know of an existing 3 phase driver library that is fairly well developed? I have not been able to locate anything of this nature and would rather not reinvent the wheel if not necessary.

2. If I am using a Teensy 3.6, what would the direct port manipulation command look like to set pins 21, 22, 23 to either high or low, simultaneously?


I can post code for the latter, but it would literally be three digitalWrite commands, one after another.
 
Update: I reformatted a few if statements and now the outputs are turning off almost simultaneously.
 
Status
Not open for further replies.
Back
Top