added setup routine to set DDR registers