Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 7406|回復: 3

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

[複製鏈接]
發表於 2012-2-10 19:37:24 | 顯示全部樓層 |閱讀模式
RT,我要實現兩塊單片機時間同步,然後在同一個時間點做同一個指令,
發表於 2012-2-10 22:30:26 | 顯示全部樓層
BS2沒有中斷機制...只能靠輪詢試試。

別叫BS2去做他沒辦法做的事情...
 樓主| 發表於 2012-2-11 10:23:09 | 顯示全部樓層
回復 2# g921002


    我想用的是BS2中的計時器timer來做,就是不知道有沒有這項功能
發表於 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有)
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-3-29 16:53 , Processed in 0.069524 second(s), 9 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表