extern volatile int IOstate;  // declaration of IOstate