I'm a bit confused with your description.
Does this code work like the comments said?
G28 ;home G4 P0 ;wait until home is done M106 S255 ;activate D9 G1 X100 F1000 ;move G4 P0 ;wait until move is done M106 S0 ;deactivate D9 G28 ;home again
Does this code work like the comments said?