Counter and speed code