ren1994 發表於 2012-2-10 19:37:24

BS2 如何使用計時器達到時間同步

RT,我要實現兩塊單片機時間同步,然後在同一個時間點做同一個指令,

g921002 發表於 2012-2-10 22:30:26

BS2沒有中斷機制...只能靠輪詢試試。

別叫BS2去做他沒辦法做的事情...

ren1994 發表於 2012-2-11 10:23:09

回復 2# g921002


    我想用的是BS2中的計時器timer來做,就是不知道有沒有這項功能

g921002 發表於 2012-2-11 15:00:38

節錄自http://www.parallax.com/tabid/385/Default.aspx
Does the BASIC Stamp module support interrupts?

No, the interpreter chip used in the BASIC Stamp microcontroller does not support interrupts. In many cases, a fast polling routine may be used to accomplish the same effect, however, depending on the number and size of the tasks involved in some applications, this will not be fast enough and the BASIC Stamp microcontroller may not be a plausible solution. While not true interrupts, the BS2p24, BS2p40 and BS2px24 modules support 「polled interrupts.」 The 「polling」 commands allow the BASIC Stamp modules to respond to certain I/O pin events at a faster rate than what is normally possible through manual PBASIC programming. In this case the interpreter periodically checks the state of the designated polled-input pins. It 「polls」 these pins after the end of each PBASIC command and before it reads the next PBASIC command from the user program; giving the appearance that it is polling 「in the background.」

http://www.phanderson.com/stamp/stamp-pic.html
Stamp 2 is the lack of interrupts and lack of a real time clock / counter.

簡單來說,BS2沒有中斷機制,沒有硬體Timer(即使上面的uC有)。
BS2p24, BS2p40 and BS2px24 支援所謂 「polled interrupts."也非硬體的中斷(即便使用的uC有)
頁: [1]
查看完整版本: BS2 如何使用計時器達到時間同步