Add counter definition code

I think ATS2TUTORIAL miss some code.