Yes, you can visit Edinburgh Castle on Sundays. The opening hours are 9.30 - 6pm.