1. 本例功能介紹
由于cpu 的數(shù)據(jù)容量有限,可以把cpu 的數(shù)據(jù)存放于mmc 中,并對(duì)其中數(shù)據(jù)進(jìn)行讀寫操作,典型應(yīng)用為數(shù)據(jù)配方功能,這些數(shù)據(jù)可以只存于 mmc (load memory) 中,而不占cpu 的容量(working memory),當(dāng)需要使用時(shí)可通過(guò)程序讀寫。注意 mmc 的存儲(chǔ)次數(shù)為100000 次。
2. 示例系統(tǒng)的體系結(jié)構(gòu)
圖 0 本例中選用一個(gè)s7-300 cpu314c-2dp, 并插入mmc 卡
3. 本例需要的設(shè)備
a. 需要軟件
step7 v5.2或以上版本
b. 需要硬件
1. 一個(gè)s7-300 cpu314c-2dp
2. 帶有cp5611 的 field pg 710
3. 512k mmc 卡
4. 只在mmc 中創(chuàng)建數(shù)據(jù)塊
4.1 方法1:在step7 中手動(dòng)創(chuàng)建只存于mmc 的數(shù)據(jù)塊
打開step7,創(chuàng)建一個(gè)新的項(xiàng)目,在“blocks”插入數(shù)據(jù)塊,例如db1,點(diǎn)右鍵打開屬性窗口,選擇“unlinked” ,這樣db1 將只存于mmc 中。
圖 1
4.2 方法2: 在程序中創(chuàng)建只存于mmc 的數(shù)據(jù)塊
在ob1 中調(diào)用sfc82
圖 2
這樣m0.1 為1 時(shí),將在mmc 中創(chuàng)建db2,3,4,5,6。每個(gè)db 塊容量為16k ,當(dāng)mw4 等于5 時(shí),完成創(chuàng)建工作,用戶應(yīng)復(fù)位m0.1。
圖 3
5. 讀寫mmc 的數(shù)據(jù)
5.1 寫數(shù)據(jù)到mmc 卡中,調(diào)用sfc84
圖 4
m0.2 為1 時(shí),cpu 中的數(shù)據(jù)源db10.dbb0~9 10 個(gè)字節(jié)將寫到已經(jīng)在mmc 中創(chuàng)建好的db2.dbb0~9 中, m1.2 為1 mw6 為w#16#7002 時(shí),用戶將復(fù)位m0.2 。
5.2 讀mmc 中的數(shù)據(jù)到cpu 中,調(diào)用sfc83
圖 5
m0.3 為1 時(shí),mmc 卡中的數(shù)據(jù)源db2.dbb0~9 10 個(gè)字節(jié)將讀到cpu db10.dbb10~19 中,m1.3 為1,mw8 為w#16#7002 時(shí),用戶將復(fù)位m0.3。