自動化制造系統(tǒng)畢業(yè)論文中英文資料外文翻譯文獻(xiàn)_第1頁
自動化制造系統(tǒng)畢業(yè)論文中英文資料外文翻譯文獻(xiàn)_第2頁
自動化制造系統(tǒng)畢業(yè)論文中英文資料外文翻譯文獻(xiàn)_第3頁
自動化制造系統(tǒng)畢業(yè)論文中英文資料外文翻譯文獻(xiàn)_第4頁
自動化制造系統(tǒng)畢業(yè)論文中英文資料外文翻譯文獻(xiàn)_第5頁
已閱讀5頁,還剩50頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、中英文資料外文翻譯文獻(xiàn)基于 PLC 的自動化制造系統(tǒng)15.梯形圖邏輯函數(shù)主題: 數(shù) 據(jù) 組合邏輯函數(shù)學(xué)運(yùn)算、換、陣列計(jì)、比較、布爾量運(yùn)算等函數(shù) 設(shè)計(jì)實(shí)例宗旨: 理解基本函數(shù),允許計(jì)算和比較了解使用了內(nèi)存文件的數(shù)組函數(shù)15.1 介紹繼電器觸點(diǎn)線圈處理、數(shù) 數(shù) 據(jù) 轉(zhuǎn) 操作、統(tǒng)梯行圖邏輯輸入觸點(diǎn)和輸出線圈之間允許簡單的邏輯判斷。這些函數(shù)把基 本的梯形圖邏輯延伸到其他控制形式中。 例如, 附加的定時(shí)器和計(jì)數(shù)器允許基于 事件的控制。在下圖 15.1 中有一個(gè)較長的關(guān)于這些函數(shù)的表。這包括了組合邏輯和事件函數(shù)。 本章將會研究數(shù)據(jù)處理和數(shù)值的邏輯。 下一章將介紹表、 程序控制和一些輸入和輸出函數(shù)。剩下的函

2、數(shù)會在后面的章節(jié)中討論事件函數(shù)數(shù)據(jù)處理函數(shù)數(shù)字邏輯函數(shù)列表函數(shù)程序控制函數(shù)輸入輸出函數(shù)計(jì)時(shí)顯示計(jì)數(shù)顯示移動數(shù)學(xué)運(yùn)算轉(zhuǎn)換布爾量運(yùn)算 比較轉(zhuǎn)移入棧/出棧 序列發(fā)生器 分支/循環(huán)立即輸入/輸出 錯(cuò)誤/中斷檢測PID通訊高速計(jì)數(shù)器 字符串函數(shù)圖 15.1 基本 PLC 函數(shù)分類大多數(shù)的函數(shù)會使用 PLC 的存儲單元獲取值、儲存值和跟蹤函數(shù)狀態(tài)。一般大部分函數(shù)當(dāng)輸入值是“真”時(shí),會被激活。但是,有些函數(shù),如延時(shí)斷開定 時(shí)器,可以在無輸入時(shí),保持激活狀態(tài)。其它的函數(shù)僅當(dāng)輸入由“假”變“真” 時(shí), 才會被執(zhí)行, 這就是所謂的上升沿觸發(fā)。 想想, 一計(jì)數(shù)器僅僅是輸入由“假” 變“真”時(shí)才會計(jì)數(shù),輸入為“真”狀

3、態(tài)的持續(xù)時(shí)間并不影響函數(shù)動作。而下降 沿觸發(fā)函數(shù)僅當(dāng)輸入由“真”變“假”時(shí)才會觸發(fā)。多數(shù)函數(shù)并非邊沿觸發(fā):除非有規(guī)定說明函數(shù)不是邊沿觸發(fā)。標(biāo)簽:我并沒有像說明書或者軟件里那樣準(zhǔn)確的畫出這些函數(shù)。因?yàn)檫@樣會節(jié)省空間并且易于閱讀,但是所有的必要信息我都給出了。15.2 數(shù)據(jù)處理15.2.1 傳遞函數(shù)有兩種基本的傳遞函數(shù);MOV(值,操作數(shù)) -把值傳遞到指定的存儲位置。MVM(值,標(biāo)號,操作數(shù)) -把值傳遞到指定的存儲位置,但是用標(biāo)號來指定一個(gè) 傳遞的位。1這個(gè) MOV 函數(shù)從一個(gè)存儲空間取出一個(gè)值放置到另外一個(gè)存儲空間里。 下 圖 15.2 給出了 MOV 的基本用法。當(dāng)A 為“真”, MOV

4、函數(shù)把一個(gè)浮點(diǎn)數(shù)從原 操作數(shù)傳遞到操作數(shù)存儲位置。原操作數(shù)地址中的數(shù)據(jù)沒有改變。當(dāng) B 為“真” 時(shí), 原操作數(shù)中的浮點(diǎn)數(shù)將被轉(zhuǎn)換成整數(shù)存儲在操作數(shù)存儲區(qū)中。 浮點(diǎn)數(shù)會被四 舍五入成整數(shù)。當(dāng) C 為“真”時(shí),整數(shù)“123”將被存儲在整數(shù)文件 N7:23 中。MOV原操作數(shù)F8:07操作數(shù)F8:23MOV原操作數(shù)F8:07操作數(shù)N7:23MOV原操作數(shù)123操作數(shù)N7:23標(biāo)簽:當(dāng)函數(shù)值改變時(shí),除了輸入與輸出,其值是瞬間改變的。試想:圖 15.2 中,如果 ABC 都為“真”,那么 F8:23 的值將會在下一個(gè)指令到來前就變化。這與輸入輸出掃描只發(fā)生在邏輯掃描之前或者之后不同。圖 15.2 MO

5、V 的基本用法下圖 15.3 給出了更多更復(fù)雜的 MOV 函數(shù)用法。當(dāng)A 為“真”時(shí),第一個(gè) 模塊將會把值“123”送入 N7:0,同時(shí)第二個(gè)模塊將會把值“-9385”從N7:1 送 到 N7:2 中(這個(gè)值之所以為負(fù)數(shù),是因?yàn)槲覀兪褂昧?2S 的 compliment)。對 于基本的 MOV 函數(shù)使用中,二進(jìn)制數(shù)值不是必要的;但是在MVM 函數(shù)中,二 進(jìn)制數(shù)值卻是必要的。這個(gè)模塊中從 N7:3 移動二進(jìn)制數(shù)值到 N7:5 中。 但是這 些“位”在 N7:4 中仍為“ON”,操作數(shù)的其他位將不會受到影響。請注意: N7:5 的第一位 N7:5/0 在指令執(zhí)行前后仍為“ON”,但是在 N7:4

6、中卻不同, MVM 函數(shù)當(dāng)應(yīng)用在個(gè)別二進(jìn)制位的處理中時(shí)非常有用,但是處理實(shí)數(shù)卻是用處不大 了。2MOV原操作數(shù)130 dest N7:0MOV原操作數(shù)N7:1 dest N7:2MVM原操作數(shù)N7:3 標(biāo)號N7:4 dest N7:5MVM原操作數(shù)N7:3 標(biāo)號N7:4 dest N7:6地址N7:0N7:1N7:2N7:3N7:4N7:5N7:6之前數(shù)據(jù)二進(jìn)制B#0000000000000000B#1101101101010111B#1000000000000000B#0101100010111011B#0010101010101010B#0000000000000001B#11011101

7、11111111十進(jìn)制0-9385-3276822715109221之后數(shù)據(jù)二進(jìn)制B#0000000010000010B#1101101101010111B#1101101101010111B#1101100010111011B#0010101010101010B#00001000101010B#1101110111111111十進(jìn)制130-9385-9385-10053109222219標(biāo)簽: 標(biāo)號的概念非常重要, 并且也可以用在其他函數(shù)中。 標(biāo)號允許指令改變一個(gè)二進(jìn)制數(shù)據(jù)的其中四位, 而不用改變它的全部數(shù)值。 當(dāng)你使用二進(jìn)制數(shù)據(jù)中的位來表示聲明, 模式或者狀態(tài)等內(nèi)容時(shí), 你會很希望這么做。

8、 圖 15.3 是 MOV 和MVM 函數(shù)對二進(jìn)制數(shù)值的操作例子圖 15.3MOV 和 MVM 函數(shù)的使用實(shí)例15.2.2 數(shù)學(xué)函數(shù)數(shù)學(xué)函數(shù)將檢索一個(gè)或多個(gè)值,執(zhí)行一個(gè)操作然后把結(jié)果儲存在內(nèi)存中。 圖 15.4 展示的是一個(gè) ADD 函數(shù)從 N7:4 和 F8:35 中讀取數(shù)據(jù)操,把他們轉(zhuǎn)換成 操作數(shù)的地址格式,把兩個(gè)浮點(diǎn)數(shù)相加,結(jié)果儲存在F8:36 中。該函數(shù)有兩個(gè)原 操作數(shù)記做“原操作數(shù) A” 、“原操作數(shù) B”。對于該函數(shù)來說原操作數(shù)順序 可以改變,但是這對于“減法函數(shù)”或“除法函數(shù)”等其他操作來說卻不一定正 確,下面列出了其他一些基本的數(shù)學(xué)函數(shù)。其中的一些,如“取負(fù)”是一元的函 數(shù),也

9、就是說它只有一個(gè)原操作數(shù)。3加原 操 作 數(shù) A N7:04原 操 作 數(shù) B F8:35操 作 數(shù) F8:36加(值 1,值 2,操作數(shù)) -累加兩個(gè)值減(值 1,值 2,操作數(shù)) -值 1 減值 2 給操作數(shù)乘(值 1,值 2,操作數(shù)) -值 1 乘值 2 給操作數(shù)除(值 1,值 2,操作數(shù)) -值 1 除值 2 給操作數(shù)取反(值,操作數(shù))清除(值)-將值取反送給操作數(shù)-將值存儲區(qū)清零標(biāo)簽:為了節(jié)省空間上圖給出了函數(shù)的縮略符號,例如函數(shù) ADD (值 1,值 2,操作數(shù)) 需要兩個(gè)原操作數(shù), 并把值存入操作數(shù)。 為了減少描述函數(shù)時(shí)的空間這些符號將被用在很多地方圖 15.4 數(shù)學(xué)函數(shù)圖 15

10、.5 列出了數(shù)學(xué)函數(shù)的用法,多數(shù)函數(shù)的執(zhí)行會給出我們期待的結(jié)果, 第二個(gè) ADD 函數(shù)從 N7: 3 中取了一個(gè)值,加 1 然后送入原操作數(shù),這就是通常所說的“自加”操作。第一個(gè)DIV,執(zhí)行操作整數(shù) 25 除以整數(shù) 10,結(jié)果四舍五入為最接近的整數(shù),這時(shí),結(jié)果被儲存在 N7:6 中。 NEG 指令取走了新數(shù)“-10”,而不是源數(shù)據(jù)“0”,從 N7:4 取出的數(shù)據(jù)符號被取反,結(jié)果存入 N7:7。地址N7:0N7:1N7:2N7:3N7:4之前值1025000之后值1025351-104N7:5N7:6N7:7N7:8F8:0F8:1F8:2F8:300010010.025.00025031001

11、0.025.02.52.5圖 15.5 數(shù)學(xué)函數(shù)例子標(biāo)簽:調(diào)用,整數(shù)范圍從-32768 到 32767 并且沒有小數(shù)。圖 15.6 列出了更多的高級函數(shù)。這個(gè)列表包括基本的三角函數(shù)、取絕對值函數(shù)、 對數(shù)函數(shù)、 取二次方根函數(shù)。 最后一個(gè)函數(shù) CPT 能接受表達(dá)式并且可以執(zhí)行一個(gè)復(fù)雜的運(yùn)算。ACS(值,操作數(shù)) - 反余弦COS(值,操作數(shù)) - 余弦ASN(值,操作數(shù)) - 反正弦SIN(值,操作數(shù)) - 正弦ATN(值,操作數(shù)) -反正切TAN(值,操作數(shù)) - 正切XPY(值 1,值 2,操作數(shù)) - X 的 Y 次冪LN(值,操作數(shù)) - 自然對數(shù)LOG(值,操作數(shù)) - 以 10 為底

12、的對數(shù)SQR(值,操作數(shù)) - 開二次方根CPT(操作數(shù),表達(dá)式) - 做運(yùn)算圖 15.6 高級數(shù)學(xué)函數(shù)圖 15.7 展示的是把表達(dá)式轉(zhuǎn)化成梯形圖邏輯。轉(zhuǎn)換的第一步是把表達(dá)式的 變量存入 PLC 中沒被使用過的存儲區(qū)中。接下來擁有很多嵌套運(yùn)算的方程就可 以被轉(zhuǎn)化,例如 LN 函數(shù)。這時(shí) LN 函數(shù)的運(yùn)算結(jié)果被保存在其他存儲空間中,5之后會被調(diào)用。其它的一些操作會應(yīng)用在相似的情況下。 (注意:這些方程可能 應(yīng)用在其他場合中,占用更少的存儲空間。)給定方程指定存儲圖 15.7 用梯形圖表示的方程和圖 15.7 中一樣的方程被應(yīng)用于圖 15.8 所示的 CPT 函數(shù)中。存儲區(qū)也和上圖使用的一樣。該表

13、達(dá)式被直接輸進(jìn)了PLC 程序中。圖 15.8 利用CPT 函數(shù)計(jì)算數(shù)學(xué)函數(shù)可以導(dǎo)致諸如溢出,進(jìn)位等狀態(tài)標(biāo)識位變化,注意要盡量避免出 現(xiàn)像“溢出”這樣的問題。但是使用浮點(diǎn)數(shù)時(shí)這種問題會少一點(diǎn)。而整數(shù)極易出現(xiàn)這樣的問題,因?yàn)樗鼈兪艿?3276832767 這樣一個(gè)數(shù)據(jù)范圍的限制。15.2.3 轉(zhuǎn)換函數(shù)6梯形圖中的轉(zhuǎn)換函數(shù)列在了圖 15.9 中。例子中的函數(shù)將會從D 存儲區(qū)讀取 一個(gè) BCD 碼數(shù)據(jù), 然后把它轉(zhuǎn)換為浮點(diǎn)數(shù)存儲在 F8:2 中。 其它的函數(shù)將把二進(jìn)制負(fù)數(shù)轉(zhuǎn)換成 BCD 碼數(shù)據(jù),下面的函數(shù)也包含了弧度數(shù)和角度的轉(zhuǎn)化。TOD(value,destination) 把 BCD 碼轉(zhuǎn)換為二進(jìn)

14、制數(shù)FRD(value,destination) - 把二進(jìn)制值轉(zhuǎn)換為 BCD 碼DEG(value,destination) 把弧度數(shù)轉(zhuǎn)換為度數(shù)RAD(value,destination) - 把度數(shù)轉(zhuǎn)換為弧度數(shù)圖 15.9 轉(zhuǎn)換函數(shù)圖 15.10 給出了轉(zhuǎn)換函數(shù)的例子。這些函數(shù)讀取一個(gè)源數(shù)據(jù)后,開始轉(zhuǎn)換, 結(jié)束后儲存結(jié)果。 TOD 函數(shù)轉(zhuǎn)換成 BCD 碼將會出現(xiàn)“溢出”錯(cuò)誤。地址 之前值N7:0 0N7:1 548F8:0 3.141F8:1 45F8:2 0F8:3 0D9:0 0000 0000 0000 0000D9:1 0001 0111 1001 0011之后值17935483.

15、141451800.7850000 0101 0100 10000001 0111 1001 0011圖 15.10 轉(zhuǎn)換例子715.2.4 矩陣函數(shù)矩陣可以儲存多列數(shù)據(jù)。在 PLC 中這將是一系列的整數(shù)數(shù)字,浮點(diǎn)數(shù)或者 其它類型的數(shù)據(jù)。 例如, 假定我們測量和保存一塊封裝芯片的重量時(shí)要使用浮點(diǎn) 數(shù)存儲區(qū) F8:20。每十分鐘要讀取一次重量數(shù)據(jù),并且一小時(shí)后找出平均重量。 這一節(jié)我們將聚焦于矩陣中多組數(shù)據(jù)的處理技術(shù), 也就是說明書中所謂的“塊”。 15.2.4.1-統(tǒng)計(jì)這些函數(shù)也是可以處理統(tǒng)計(jì)數(shù)據(jù)的。圖 15.11 列出了這些函數(shù),當(dāng) A 變?yōu)?“真”AVE 函數(shù)的轉(zhuǎn)換操作從存儲區(qū) F8:0

16、開始,并算出四個(gè)數(shù)的平均值。控制 字 R6:1 被用來跟蹤運(yùn)算的進(jìn)程,并判斷運(yùn)算何時(shí)結(jié)束。這些運(yùn)算還有其它的一 些是邊沿觸發(fā)的。該次運(yùn)算可能會需要經(jīng)過多個(gè)掃描周期才能完成。運(yùn)算結(jié)束后, 平均值被儲存在 F8:0 中,同時(shí) R6:1/DN 位被置 ON。AVE(開始值,操作數(shù),控制字,長度)STD(開始值,操作數(shù),控制字,長度)SRT(開始值,控制字,長度) 求平均值 求標(biāo)準(zhǔn)差 排列一串值圖 15.11 統(tǒng)計(jì)函數(shù)如圖 15.12 給出的統(tǒng)計(jì)函數(shù)例子,它擁有一個(gè)有四個(gè)字長從 F8:0 開始的數(shù) 組數(shù)據(jù)。每次執(zhí)行平均值運(yùn)算的結(jié)果儲存在 F8:4 中,標(biāo)準(zhǔn)差儲存在 F8:5 中。一 系列數(shù)值被存放在從

17、 F8:0 到 F8:3 的按升序排列的存儲區(qū)中。為防止出現(xiàn)數(shù)據(jù)覆 蓋現(xiàn)象, 每個(gè)函數(shù)都應(yīng)該有自己的控制存儲器。 同時(shí)觸發(fā)該函數(shù)與其他運(yùn)算不是 一個(gè)明智的選擇,因?yàn)樵谟?jì)算期間該函數(shù)會移動數(shù)據(jù),這會導(dǎo)致錯(cuò)誤的結(jié)果。89A 導(dǎo) 通 B 導(dǎo) 通 C地址 之前 后 后 后F8:0 3 3 3F8:1 1 1 1F8:2 2 2 2F8:3 4 4 4F8:4 0 2.5 2.5F8:5 0 0 1.29導(dǎo) 通12342.51.29圖 15.12 統(tǒng)計(jì)運(yùn)算旁白:這些函數(shù)允許 SPC (統(tǒng)計(jì))數(shù)據(jù)控制中的實(shí)數(shù)運(yùn)算。僅有的不是這樣的 PLC 函數(shù)是隨機(jī)函數(shù),它允許出現(xiàn)隨機(jī)樣本數(shù)據(jù)。15.2.4.2-塊操作圖

18、 15.13 給出了最基本的塊函數(shù)。這個(gè) COP 函數(shù)將會拷貝從 N7:50 到 N7:40 擁有十個(gè)數(shù)據(jù)的數(shù)組。 FAL 函數(shù)將會通過一個(gè)表達(dá)式執(zhí)行數(shù)學(xué)運(yùn)算。 FSC 函數(shù)通 過使用表達(dá)式允許數(shù)組之間進(jìn)行比較。 FLL 函數(shù)會利用一個(gè)數(shù)據(jù)把塊存儲區(qū)填充 起來。COP(開始值,操作數(shù),長度) 拷貝一個(gè)數(shù)據(jù)塊FAL(控制字,長度,模式,操作數(shù),表達(dá)式) 為得到一個(gè)多重值而執(zhí)行基本的數(shù)學(xué)運(yùn)算FSC(控制字,長度,模式,操作數(shù),表達(dá)式) 為得到一個(gè)多重值而作一個(gè)比較FLL(值,操作數(shù),長度) 把一個(gè)單一值拷貝到一個(gè)數(shù)據(jù)塊圖 15.13 塊操作函數(shù)圖 15.14 顯示的是擁有不同地址模式的 FAL 函

19、數(shù)使用例子。第一個(gè) FAL 函 數(shù)將會執(zhí)行下列運(yùn)算:N7:5=N7:0+5, N7:6=N7:1+5, N7:7=N7:2+5, N8:7=N7:3+5, N7:9=N7:4+5. 第二個(gè) FAL 函數(shù)中在表達(dá)式值之前缺少“#”標(biāo)識,因此運(yùn)算將變?yōu)椋篘7:5=N7:0+5, N7:6=N7:0+5, N7:7=N7:0+5, N8:7=N7:0+5, N7:9=N7:0+5.當(dāng) B 為真,且為模式 2 時(shí)該指令在每次掃描周期到來時(shí)執(zhí)行兩個(gè)運(yùn)算。最后一 個(gè) FAL 運(yùn)算的結(jié)果為:N7:5=N7:0+5, N7:5=N7:1+5, N7:5=N7:2+5, N7:5=N7:3+5, N7:5=N7

20、:4+5.最后一個(gè)操作貌似沒什么用處,但是請注意,該運(yùn)算是增值的。在C上升沿到來 時(shí)該運(yùn)算都會執(zhí)行一次。每次掃描周期經(jīng)過時(shí),這幾個(gè)運(yùn)算將執(zhí)行所有的5個(gè)操 作一次。 用來指示每次掃描運(yùn)算的編號, 而插入一個(gè)號碼也是有可能的。 由于有 較大的數(shù)組, 運(yùn)算時(shí)間可能會很長, 同時(shí)嘗試每次掃描時(shí)執(zhí)行所有運(yùn)算也將會導(dǎo) 致看門狗超時(shí)錯(cuò)誤。圖 15.14 文本代數(shù)函數(shù)例子15.3 邏輯函數(shù)15.3.1 數(shù)值比較10圖 15.15 所示為比較函數(shù), 先前的函數(shù)塊是輸出, 它取代了輸入聯(lián)系。 例子 展示的是比較兩個(gè)浮點(diǎn)數(shù)大小的函數(shù) EQU。如果數(shù)值相當(dāng),則輸出位 B3:5/1為 真,否則為假。其他形式的相等函數(shù)也

21、裂了出來。EQU(值 1,值 2)NEQ(值 1,值 2)LES(值 1,值 2)LEQ(值 1,值 2)GRT(值 1,值 2)GEQ(值 1,值 2)CMP (表達(dá)式)MEQ (值,符號,臨界值)LIM (低限,值,高限)相等不相等小于小于等于大于大于等于比較兩值是否相等使用一個(gè)符號來比較值是否相等檢測值是否在范圍內(nèi)圖 15.15 比較函數(shù)圖 15.16 展示了六個(gè)基本的比較函數(shù)。圖右邊是比較函數(shù)的操作例子,圖 15.16 比較函數(shù)例子11圖 15.16 中的梯形圖程序在圖 15.17 中又用 CMP 函數(shù)表達(dá)了一遍,該函數(shù) 可以使用文本表達(dá)式。圖 15.17 使用 CMP 函數(shù)的等價(jià)表述

22、表達(dá)式可以被用來做許多復(fù)雜運(yùn)算, 如圖 15.18 所示。 表達(dá)式將會判斷 F8:1 是否介于 F8:0 和 F8:2 之間。圖 15.18 一個(gè)更加復(fù)雜的比較函數(shù)LIM 和 MEQ 函數(shù)如圖 15.19 所示。 前三個(gè)函數(shù)將會判斷待檢測值是否處在 范圍內(nèi)。 如果上限值大于下限值且待測值介于限值之間或者等于限值, 那么輸出 為真。如果下限值大于上限值,則只有待測值在范圍之外時(shí)輸出值才為真。1213地址N7:0N7:0N7:0N7:0N7:0N7:0十進(jìn)制(之前值)15111580二進(jìn)制(之前值) 0000000000000001 0000000000000101 000000000000101

23、1 0000000000001111 00000000000010000000000000000000二進(jìn)制(之后值) 0000000000000001 0000000000000101 0000000000001011 0000000000001111 00000000000010000000000000001101圖 15.19 復(fù)雜的比較函數(shù)上 限下 限下 限 上 限圖 15.20LIM 函數(shù)的線段表示圖 15.20 展示的線段可以幫助我們判斷待測數(shù)值是否在限值內(nèi)。在圖15.21中使用FSC指令進(jìn)行文件與文件的比較也是被允許的。該指令使用了控制字R6:0。它將解釋表達(dá)式10次, 做兩次比

24、較在每次邏輯掃描中(模式2)。比較為: F8:10<F8:0 , F8:11<F8:0 然后 F8:12<F8:0 , F8:13<F8:0 然后F8:14<F8:0 , F8:15<F8:0 然后 F8:16<F8:0 , F8:17<F8:0 然后是F8:18<F8:0 , F8:19<F8:0 。函數(shù)將會繼續(xù)執(zhí)行除非發(fā)現(xiàn)一個(gè)錯(cuò)誤狀態(tài)或者完成比較。如果比較完成沒有發(fā)現(xiàn)錯(cuò)誤狀態(tài)那么輸出A將為“真”。在一個(gè)掃描周期中該模式也會一直執(zhí)行所有比較?;蛘弋?dāng)函數(shù)前面的輸入為真時(shí)就更新增量-在這種情況下輸入為一條線,而一直為真。FSC控制字R6

25、:0長度10位置0模式2表達(dá)式#F8:10<F8:0圖 15:21 使用表達(dá)式的文件比較15.3.2 布爾函數(shù)圖 15.22 顯示的是布爾代數(shù)函數(shù)。函數(shù)顯示從位存儲單元獲取數(shù)據(jù)字,執(zhí) 行一個(gè) AND 操作, 把結(jié)果儲存在一個(gè)新的位邏輯單元。 這些函數(shù)都是面向 “字”層面的運(yùn)算。 執(zhí)行布爾運(yùn)算的能力,該能力允許不止單一位上的邏輯運(yùn)算。AND(值 1,值 2,操作數(shù))OR(值 1,值 2,操作數(shù))NOT(值 1,值 2,操作數(shù))XOR(值 1,值 2,操作數(shù))二進(jìn)制“與”函數(shù)二進(jìn)制“或”函數(shù)二進(jìn)制“非”函數(shù)二進(jìn)制“異或”函數(shù)圖 15.22 布爾函數(shù)圖 15.23 展示了布爾函數(shù)的使用。前三個(gè)

26、函數(shù)需要兩個(gè)參數(shù),最后一個(gè)函 數(shù)只需要一個(gè)參數(shù)。與函數(shù)只有兩個(gè)操作數(shù)同時(shí)為真結(jié)果位才會被置 ON?;蚝?數(shù)只要兩個(gè)操作數(shù)中任意一個(gè)為 ON,那么它就將結(jié)果位置 ON。異或函數(shù)兩操作 數(shù)中有且僅有一個(gè)為 ON 那么結(jié)果位才會被置 ON。非函數(shù)將字中所有位取反。14Automating Manufacturing Systems with PLCs15.LADDER LOGIC FUNCTIONSTopics: Functions for data handling, mathematics, conversions, array operations, statistics,comparison

27、 and Boolean operations. Design examplesObjectives: To understand basic functions that allow calculations and comparisons To understand array functions using memory files15.1INTRODUCTIONLadder logic input contacts and output coils allow simple logical decisions. Functionsextend basic ladder logic to

28、 allow other types of control. For example, the addition oftimers and counters allowed event based control. A longer list of functions is shown inFigure 15.1. Combinatorial Logic and Event functions have already been covered. Thischapter will discuss Data Handling and Numerical Logic. The next chapt

29、er will coverLists and Program Control and some of the Input and Output functions. Remaining functionswill be discussed in later chapters.15Combinatorial Logic- relay contacts and coilsEvents- timer instructions- counter instructionsData Handling- moves- mathematics- conversionsNumerical Logic- bool

30、ean operations- comparisonsLists- shift registers/stacks- sequencersProgram Control- branching/looping- immediate inputs/outputs- fault/interrupt detectionInput and Output- PID- communications- high speed counters- ASCII string functionsFigure 15.1 Basic PLC Function CategoriesMost of the functions

31、will use PLC memory locations to get values, store valuesand track function status. Most function will normally become active when the input is true. But, some functions, such as TOF timers, can remain active when the input is off. Other functions will only operate when the input goes from false to

32、true, this is known as positive edge triggered. Consider a counter that only counts when the input goes from false to true, the length of time the input is true does not change the function behavior. A negative edge triggered function would be triggered when the input goes from true to false. Most f

33、unctions are not edge triggered: unless stated assume functions are not edge triggered.NOTE: I do not draw functions exactly as they appear in manuals andprogramming software.This helps save space and makes the instructions somewhat easier to read. All of the necessary information is given.1615.2 DA

34、TA HANDLING15.2.1 Move FunctionsThere are two basic types of move functions;MOV(value,destination) - moves a value to a memory locationMVM(value,mask,destination) - moves a value to a memory location, but with a mask to select specific bits.The simple MOV will take a value from one location in memor

35、y and place it in another memory location. Examples of the basic MOV are given in Figure 15.2.When A is true the MOV function moves a floating point number from the source to the destination address. The data in the source address is left unchanged. When B is true the floating point number in the so

36、urce will be converted to an integer and stored in the destination address in integer memory. The floating point number will be rounded up or down to the nearest integer. When C is true the integer value of 123 will be placed in the integer file N7:23.NOTE: when a function changes a value, except fo

37、r inputs and outputs, the value is changed immediately. Consider Figure 15.2, if A, B and C are all true, then the value in F8:23 will change before the next instruction starts. This is different than the input and output scans that only happen before and after the logic scan.17Figure 15.2 Examples

38、of the MOV FunctionA more complex example of move functions is given in Figure 15.3. When Abecomes true the first move statement will move the value of 130 into N7:0. And, the second move statement will move the value of -9385 from N7:1 to N7:2. (Note: The number is shown as negative because we are

39、using 2s compliment.) For the simple MOVs the binary values are not needed, but for the MVM statement the binary values are essential. The statement moves the binary bits from N7:3 to N7:5, but only those bits that are also on in the mask N7:4, other bits in the destination will be left untouched. N

40、otice that the first bit N7:5/0 is true in the destination address before and after, but it is not true in the mask. The MVM function is very useful for applications where individual binary bits are to be manipulated, but they are less useful when dealing with actual number values.1815.2.2 Mathemati

41、cal FunctionsMathematical functions will retrieve one or more values, perform an operation andstore the result in memory. Figure 15.4 shows an ADD function that will retrieve values from N7:4 and F8:35, convert them both to the type of the destination address,add the floating point numbers, and stor

42、e the result in F8:36. The function has two sources labelled source A and source B. In the case of ADD functions the sequence can change, but this is not true for other operations such as subtraction and division. A list of other simple arithmetic function follows. Some of the functions, such as the

43、 negative function are unary, so there is only one source.19Figure 15.4 Arithmetic FunctionsAn application of the arithmetic function is shown in Figure 15.5. Most of theoperations provide the results we would expect. The second ADD function retrieves avalue from N7:3, adds 1 and overwrites the sour

44、ce - this is normally known as an increment operation. The first DIV statement divides the integer 25 by 10, the result is rounded to the nearest integer, in this case 3, and the result is stored in N7:6. The NEG instruction takes the new value of -10, not the original value of 0, from N7:4 inverts

45、the sign and stores it in N7:7.20Figure 15.5 Arithmetic Function ExampleA list of more advanced functions are given in Figure 15.6. This list includes basictrigonometry functions, exponents, logarithms and a square root function. The last function CPT will accept an expression and perform a complex

46、calculation.21Figure 15.6 Advanced Mathematical FunctionsFigure 15.7 shows an example where an equation has been converted to ladderlogic. The first step in the conversion is to convert the variables in the equation to unused memory locations in the PLC. The equation can then be converted using them

47、ost nested calculations in the equation, such as the LN function. In this case the results of the LN function are stored in another memory location, to be recalled later. The other operations are implemented in a similar manner. (Note: This equation could have been implemented in other forms, using

48、fewer memory locations.)22Figure 15.7 An Equation in Ladder LogicThe same equation in Figure 15.7 could have been implemented with a CPTfunction as shown in Figure 15.8. The equation uses the same memory locationschosen in Figure 15.7. The expression is typed directly into the PLC programming softwa

49、re.Figure 15.8 Calculations with a Compute FunctionMath functions can result in status flags such as overflow, carry, etc. care must betaken to avoid problems such as overflows. These problems are less common when using floating point numbers. Integers are more prone to these problems because they a

50、re limited to the range from -32768 to 32767.2315.2.3 ConversionsLadder logic conversion functions are listed in Figure 15.9. The example functionwill retrieve a BCD number from the D type (BCD) memory and convert it to a floating point number that will be stored in F8:2. The other function will con

51、vert from 2s compliment binary to BCD, and between radians and degrees.Figure 15.9 Conversion FunctionsExamples of the conversion functions are given in Figure 15.10. The functionsload in a source value, do the conversion, and store the results. The TOD conversion to BCD could result in an overflow error.24Figure 15.10 Conversion Example15.2.4 Array Data FunctionsArrays allow us to store multiple data values. In a PLC this will be a sequential series of numbers in integer, floating point, or other memory. For exampl

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論