HandBooks Professional Java-C-Scrip-SQL part 201

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 201', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Il Il Il Acknowledge the timer interrupt. II EOI_NONSPECIFIC II II Clear the Maximum Count bit to start the next cycle . II timer 2 .control TIMER_MAXCOUNT I Interrupt I Of course the tick method of the TimerList class does most of the work here. This method is mostly concerned with linked list manipulation and is not very exciting to look at. Briefly stated the tick method starts by decrementing the tick count of the timer at the top of the list. If that timer s count has reached zero it changes the state of the software timer to Done and removes it from the timer list. It also does the same for any timers that are set to expire on the very same tick. These are the ones at the new head of the list that also have a count of zero. After creating and starting a software timer the application programmer can do some other processing and then check to see if the timer has expired. The waitfor method is provided for that purpose. This routine will block until the software timer s state is changed to Done by . The implementation of this method is as follows Method waitfor Description Wait for the software timer to finish. Notes Returns 0 on success -1 if the timer is not running. I int Timer waitfor if state Active return -1 Wait for the timer to expire. while state Done Restart or idle the timer depending on its type. if type Periodic state Active this else state Idle return 0 waitfor One important thing to notice about this code is that the test while state Done is not an infinite loop. That s because as we just learned a few paragraphs back the timer s state is modified by which is called from the interrupt service routine. In fact if we were being careful embedded programmers we would have declared state as volatile. Doing so would prevent the compiler from incorrectly assuming that the timer s state is either done or not done and optimizing away the while .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU LIÊN QUAN
5    176    1
5    255    1
5    106    0
5    121    1
6    103    1
6    107    1
6    121    1
6    103    0
6    140    0
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.