Need help in coding ,don't know where the error.

here is a diagram in proteus:http://yadi.sk/d/SwY2sj8rQRpNb