prepare dc motor drive code