Andes Workshop

It is currently Thu Mar 28, 2024 6:27 pm

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: 如何使得程式碼不被interrupt中斷?
PostPosted: Fri Feb 22, 2013 12:07 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
在programming時,
需要保護一段code,使得它不被中斷打斷(岔斷),
該怎麼做呢?

在C語言裡,並沒有避免中斷的語法,
中斷是硬體的行為。
要保護code不被中斷打擾,最簡單的方法是把GIE關掉。
等到這幾行code執行完之後,再把GIE打開。
(用mask把中斷關掉亦可)


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group