2023年全國碩士研究生考試考研英語一試題真題(含答案詳解+作文范文)_第1頁
已閱讀1頁,還剩36頁未讀 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、<p>  屆本科畢業(yè)設(shè)計(論文)外文</p><p><b>  文獻(xiàn)翻譯</b></p><p>  學(xué) 院: </p><p>  專 業(yè): </p><p>  姓 名: <

2、;/p><p>  學(xué) 號: </p><p>  外文出處: Automating Manufacturing Systems with PLCs </p><p>  附 件:1、外文翻譯 2、外文原文 </p><p&

3、gt;  附錄1:外文資料翻譯譯文</p><p>  基于PLC的自動化制造系統(tǒng)</p><p>  15.梯形圖邏輯函數(shù)</p><p><b>  主題:</b></p><p>  ? 數(shù)據(jù)處理、數(shù)學(xué)運算、數(shù)據(jù)轉(zhuǎn)換、陣列操作、統(tǒng)計、比較、布爾量運算等函數(shù)</p><p><b>

4、  ? 設(shè)計實例</b></p><p><b>  宗旨:</b></p><p>  ? 理解基本函數(shù),允許計算和比較</p><p>  ?了解使用了內(nèi)存文件的數(shù)組函數(shù)</p><p><b>  15.1介紹</b></p><p>  梯行圖邏輯輸入觸點

5、和輸出線圈之間允許簡單的邏輯判斷。這些函數(shù)把基本的梯形圖邏輯延伸到其他控制形式中。例如,附加的定時器和計數(shù)器允許基于事件的控制。在下圖15.1中有一個較長的關(guān)于這些函數(shù)的表。這包括了組合邏輯和事件函數(shù)。本章將會研究數(shù)據(jù)處理和數(shù)值的邏輯。下一章將介紹表、程序控制和一些輸入和輸出函數(shù)。剩下的函數(shù)會在后面的章節(jié)中討論</p><p>  圖15.1 基本PLC函數(shù)分類</p><p>  大多數(shù)

6、的函數(shù)會使用PLC的存儲單元獲取值、儲存值和跟蹤函數(shù)狀態(tài)。一般大部分函數(shù)當(dāng)輸入值是“真”時,會被激活。但是,有些函數(shù),如延時斷開定時器,可以在無輸入時,保持激活狀態(tài)。其它的函數(shù)僅當(dāng)輸入由“假”變“真”時,才會被執(zhí)行,這就是所謂的上升沿觸發(fā)。想想,一計數(shù)器僅僅是輸入由“假”變“真”時才會計數(shù),輸入為“真”狀態(tài)的持續(xù)時間并不影響函數(shù)動作。而下降沿觸發(fā)函數(shù)僅當(dāng)輸入由“真”變“假”時才會觸發(fā)。多數(shù)函數(shù)并非邊沿觸發(fā):除非有規(guī)定說明函數(shù)不是邊沿觸發(fā)

7、。</p><p><b>  15.2數(shù)據(jù)處理</b></p><p>  15.2.1傳遞函數(shù)</p><p>  有兩種基本的傳遞函數(shù);</p><p>  MOV(值,操作數(shù)) -把值傳遞到指定的存儲位置。</p><p>  MVM(值,標(biāo)號,操作數(shù)) -把值傳遞到指定的存儲位置,

8、但是用標(biāo)號來指定一個傳遞的位。</p><p>  這個MOV函數(shù)從一個存儲空間取出一個值放置到另外一個存儲空間里。下圖15.2給出了MOV的基本用法。當(dāng)A為“真”,MOV函數(shù)把一個浮點數(shù)從原操作數(shù)傳遞到操作數(shù)存儲位置。原操作數(shù)地址中的數(shù)據(jù)沒有改變。當(dāng)B為“真”時,原操作數(shù)中的浮點數(shù)將被轉(zhuǎn)換成整數(shù)存儲在操作數(shù)存儲區(qū)中。浮點數(shù)會被四舍五入成整數(shù)。當(dāng)C為“真”時,整數(shù)“123”將被存儲在整數(shù)文件N7:23中。<

9、/p><p>  圖15.2 MOV的基本用法</p><p>  下圖15.3給出了更多更復(fù)雜的MOV函數(shù)用法。當(dāng)A為“真”時,第一個模塊將會把值“123”送入N7:0,同時第二個模塊將會把值“-9385”從N7:1 送到 N7:2中(這個值之所以為負(fù)數(shù),是因為我們使用了2S的compliment)。對于基本的MOV函數(shù)使用中,二進(jìn)制數(shù)值不是必要的;但是在MVM函數(shù)中,二進(jìn)制數(shù)值卻是必要的。

10、這個模塊中從N7:3 移動二進(jìn)制數(shù)值到 N7:5中。但是這些“位”在N7:4中仍為“ON”,操作數(shù)的其他位將不會受到影響。請注意:N7:5的第一位N7:5/0在指令執(zhí)行前后仍為“ON”,但是在N7:4中卻不同,MVM函數(shù)當(dāng)應(yīng)用在個別二進(jìn)制位的處理中時非常有用,但是處理實數(shù)卻是用處不大了。</p><p>  圖15.3MOV和MVM函數(shù)的使用實例</p><p>  15.2.2數(shù)學(xué)函數(shù)&

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

12、其中的一些,如“取負(fù)”是一元的函數(shù),也就是說它只有一個原操作數(shù)。</p><p><b>  圖15.4數(shù)學(xué)函數(shù)</b></p><p>  圖15.5列出了數(shù)學(xué)函數(shù)的用法,多數(shù)函數(shù)的執(zhí)行會給出我們期待的結(jié)果,第二個ADD函數(shù)從N7:3中取了一個值,加1然后送入原操作數(shù),這就是通常所說的“自加”操作。第一個DIV,執(zhí)行操作整數(shù)25除以整數(shù)10,結(jié)果四舍五入為最接近的整

13、數(shù),這時,結(jié)果被儲存在N7:6中。NEG指令取走了新數(shù)“-10”,而不是源數(shù)據(jù)“0”,從N7:4取出的數(shù)據(jù)符號被取反,結(jié)果存入N7:7。</p><p>  圖15.5 數(shù)學(xué)函數(shù)例子</p><p>  圖15.6列出了更多的高級函數(shù)。這個列表包括基本的三角函數(shù)、取絕對值函數(shù)、對數(shù)函數(shù)、取二次方根函數(shù)。最后一個函數(shù)CPT能接受表達(dá)式并且可以執(zhí)行一個復(fù)雜的運算。</p><

14、;p>  圖15.6 高級數(shù)學(xué)函數(shù)</p><p>  圖15.7展示的是把表達(dá)式轉(zhuǎn)化成梯形圖邏輯。轉(zhuǎn)換的第一步是把表達(dá)式的變量存入PLC中沒被使用過的存儲區(qū)中。接下來擁有很多嵌套運算的方程就可以被轉(zhuǎn)化,例如LN函數(shù)。這時LN函數(shù)的運算結(jié)果被保存在其他存儲空間中,之后會被調(diào)用。其它的一些操作會應(yīng)用在相似的情況下。(注意:這些方程可能應(yīng)用在其他場合中,占用更少的存儲空間。)</p><p&

15、gt;  圖15.7 用梯形圖表示的方程</p><p>  和圖15.7中一樣的方程被應(yīng)用于圖15.8所示的CPT函數(shù)中。存儲區(qū)也和上圖使用的一樣。該表達(dá)式被直接輸進(jìn)了PLC程序中。</p><p>  圖15.8 利用CPT函數(shù)計算</p><p>  數(shù)學(xué)函數(shù)可以導(dǎo)致諸如溢出,進(jìn)位等狀態(tài)標(biāo)識位變化,注意要盡量避免出現(xiàn)像“溢出”這樣的問題。但是使用浮點數(shù)時這種問

16、題會少一點。而整數(shù)極易出現(xiàn)這樣的問題,因為它們受到-32768—32767這樣一個數(shù)據(jù)范圍的限制。</p><p>  15.2.3 轉(zhuǎn)換函數(shù)</p><p>  梯形圖中的轉(zhuǎn)換函數(shù)列在了圖15.9中。例子中的函數(shù)將會從D存儲區(qū)讀取一個BCD碼數(shù)據(jù),然后把它轉(zhuǎn)換為浮點數(shù)存儲在F8:2中。其它的函數(shù)將把二進(jìn)制負(fù)數(shù)轉(zhuǎn)換成BCD碼數(shù)據(jù),下面的函數(shù)也包含了弧度數(shù)和角度的轉(zhuǎn)化。</p>

17、<p>  圖15.9 轉(zhuǎn)換函數(shù)</p><p>  圖15.10給出了轉(zhuǎn)換函數(shù)的例子。這些函數(shù)讀取一個源數(shù)據(jù)后,開始轉(zhuǎn)換,結(jié)束后儲存結(jié)果。TOD函數(shù)轉(zhuǎn)換成BCD碼將會出現(xiàn)“溢出”錯誤。</p><p>  圖15.10 轉(zhuǎn)換例子</p><p>  15.2.4矩陣函數(shù)</p><p>  矩陣可以儲存多列數(shù)據(jù)。在PLC中這將是

18、一系列的整數(shù)數(shù)字,浮點數(shù)或者</p><p>  其它類型的數(shù)據(jù)。例如,假定我們測量和保存一塊封裝芯片的重量時要使用浮點數(shù)存儲區(qū)F8:20。每十分鐘要讀取一次重量數(shù)據(jù),并且一小時后找出平均重量。這一節(jié)我們將聚焦于矩陣中多組數(shù)據(jù)的處理技術(shù),也就是說明書中所謂的“塊”。</p><p>  15.2.4.1-統(tǒng)計</p><p>  這些函數(shù)也是可以處理統(tǒng)計數(shù)據(jù)的。圖1

19、5.11列出了這些函數(shù),當(dāng)A變?yōu)椤罢妗盇VE函數(shù)的轉(zhuǎn)換操作從存儲區(qū)F8:0開始,并算出四個數(shù)的平均值??刂谱諶6:1被用來跟蹤運算的進(jìn)程,并判斷運算何時結(jié)束。這些運算還有其它的一些是邊沿觸發(fā)的。該次運算可能會需要經(jīng)過多個掃描周期才能完成。運算結(jié)束后,平均值被儲存在F8:0中,同時R6:1/DN位被置ON。</p><p>  圖15.11統(tǒng)計函數(shù)</p><p>  如圖15.12給出的統(tǒng)

20、計函數(shù)例子,它擁有一個有四個字長從F8:0開始的數(shù)組數(shù)據(jù)。每次執(zhí)行平均值運算的結(jié)果儲存在F8:4中,標(biāo)準(zhǔn)差儲存在F8:5中。一系列數(shù)值被存放在從F8:0到F8:3的按升序排列的存儲區(qū)中。為防止出現(xiàn)數(shù)據(jù)覆蓋現(xiàn)象,每個函數(shù)都應(yīng)該有自己的控制存儲器。同時觸發(fā)該函數(shù)與其他運算不是一個明智的選擇,因為在計算期間該函數(shù)會移動數(shù)據(jù),這會導(dǎo)致錯誤的結(jié)果。</p><p>  圖15.12 統(tǒng)計運算</p><

21、p>  15.2.4.2-塊操作</p><p>  圖15.13給出了最基本的塊函數(shù)。這個COP函數(shù)將會拷貝從N7:50到N7:40擁有十個數(shù)據(jù)的數(shù)組。FAL函數(shù)將會通過一個表達(dá)式執(zhí)行數(shù)學(xué)運算。FSC函數(shù)通過使用表達(dá)式允許數(shù)組之間進(jìn)行比較。FLL函數(shù)會利用一個數(shù)據(jù)把塊存儲區(qū)填充起來。</p><p>  圖15.13塊操作函數(shù)</p><p>  圖15.1

22、4顯示的是擁有不同地址模式的FAL函數(shù)使用例子。第一個FAL函數(shù)將會執(zhí)行下列運算:</p><p>  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.</p><p>  第二個FAL函數(shù)中在表達(dá)式值之前缺少“#”標(biāo)識,因此運算將變?yōu)椋?lt;/p><p>  N7:5=N7:0+5, N

23、7:6=N7:0+5, N7:7=N7:0+5, N8:7=N7:0+5, N7:9=N7:0+5.</p><p>  當(dāng)B為真,且為模式2時該指令在每次掃描周期到來時執(zhí)行兩個運算。最后一個FAL運算的結(jié)果為:</p><p>  N7:5=N7:0+5, N7:5=N7:1+5, N7:5=N7:2+5, N7:5=N7:3+5, N7:5=N7:4+5.</p><

24、;p>  最后一個操作貌似沒什么用處,但是請注意,該運算是增值的。在C上升沿到來時該運算都會執(zhí)行一次。每次掃描周期經(jīng)過時,這幾個運算將執(zhí)行所有的5個操作一次。用來指示每次掃描運算的編號,而插入一個號碼也是有可能的。由于有較大的數(shù)組,運算時間可能會很長,同時嘗試每次掃描時執(zhí)行所有運算也將會導(dǎo)致看門狗超時錯誤。</p><p>  圖15.14 文本代數(shù)函數(shù)例子</p><p><

25、b>  15.3 邏輯函數(shù)</b></p><p>  15.3.1 數(shù)值比較</p><p>  圖15.15所示為比較函數(shù),先前的函數(shù)塊是輸出,它取代了輸入聯(lián)系。例子展示的是比較兩個浮點數(shù)大小的函數(shù)EQU。如果數(shù)值相當(dāng),則輸出位B3:5/1為真,否則為假。其他形式的相等函數(shù)也裂了出來。</p><p>  圖15.15比較函數(shù)</p>

26、;<p>  圖15.16展示了六個基本的比較函數(shù)。圖右邊是比較函數(shù)的操作例子,</p><p>  圖15.16比較函數(shù)例子</p><p>  圖15.16中的梯形圖程序在圖15.17中又用CMP函數(shù)表達(dá)了一遍,該函數(shù)可以使用文本表達(dá)式。</p><p>  圖15.17使用CMP函數(shù)的等價表述</p><p>  表達(dá)式可

27、以被用來做許多復(fù)雜運算,如圖15.18所示。表達(dá)式將會判斷F8:1是否介于F8:0和F8:2之間。</p><p>  圖15.18一個更加復(fù)雜的比較函數(shù)</p><p>  LIM和MEQ函數(shù)如圖15.19所示。前三個函數(shù)將會判斷待檢測值是否處在范圍內(nèi)。如果上限值大于下限值且待測值介于限值之間或者等于限值,那么輸出為真。如果下限值大于上限值,則只有待測值在范圍之外時輸出值才為真。<

28、/p><p>  圖15.19復(fù)雜的比較函數(shù)</p><p>  圖15.20LIM函數(shù)的線段表示</p><p>  圖15.20展示的線段可以幫助我們判斷待測數(shù)值是否在限值內(nèi)。</p><p>  在圖15.21中使用FSC指令進(jìn)行文件與文件的比較也是被允許的。該指令使用了控制字R6:0。它將解釋表達(dá)式10次,做兩次比較在每次邏輯掃描中(模式

29、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)一個錯誤狀態(tài)或者完成比較。如果比較完成沒有發(fā)現(xiàn)錯誤狀態(tài)那么輸出A將為“真

30、”。在一個掃描周期中該模式也會一直執(zhí)行所有比較。或者當(dāng)函數(shù)前面的輸入為真時就更新增量---在這種情況下輸入為一條線,而一直為真。</p><p>  圖15:21使用表達(dá)式的文件比較</p><p>  15.3.2布爾函數(shù)</p><p>  圖15.22顯示的是布爾代數(shù)函數(shù)。函數(shù)顯示從位存儲單元獲取數(shù)據(jù)字,執(zhí)行一個AND操作,把結(jié)果儲存在一個新的位邏輯單元。這些

31、函數(shù)都是面向“字”層面的運算。執(zhí)行布爾運算的能力,該能力允許不止單一位上的邏輯運算。</p><p>  圖15.22布爾函數(shù)</p><p>  圖15.23展示了布爾函數(shù)的使用。前三個函數(shù)需要兩個參數(shù),最后一個函數(shù)只需要一個參數(shù)。與函數(shù)只有兩個操作數(shù)同時為真結(jié)果位才會被置ON?;蚝瘮?shù)只要兩個操作數(shù)中任意一個為ON,那么它就將結(jié)果位置ON。異或函數(shù)兩操作數(shù)中有且僅有一個為ON那么結(jié)果位才

32、會被置ON。非函數(shù)將字中所有位取反。</p><p><b>  附錄2:外文原文</b></p><p>  Automating Manufacturing Systems with PLCs</p><p>  15.LADDER LOGIC FUNCTIONS</p><p><b>  Topics:

33、</b></p><p>  ? Functions for data handling, mathematics, conversions, array operations, statistics,</p><p>  comparison and Boolean operations.</p><p>  ? Design examples<

34、/p><p>  Objectives:</p><p>  ? To understand basic functions that allow calculations and comparisons</p><p>  ? To understand array functions using memory files</p><p>  

35、15.1INTRODUCTION</p><p>  Ladder logic input contacts and output coils allow simple logical decisions. Functions</p><p>  extend basic ladder logic to allow other types of control. For example,

36、the addition of</p><p>  timers and counters allowed event based control. A longer list of functions is shown in</p><p>  Figure 15.1. Combinatorial Logic and Event functions have already been c

37、overed. This</p><p>  chapter will discuss Data Handling and Numerical Logic. The next chapter will cover</p><p>  Lists and Program Control and some of the Input and Output functions. Remaining

38、 functions</p><p>  will be discussed in later chapters.</p><p>  Figure 15.1 Basic PLC Function Categories</p><p>  Most of the functions will use PLC memory locations to get value

39、s, store values</p><p>  and 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 f

40、unctions will only operate when the input goes from false to 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 tru

41、e does not change the function behavior. A negative edge triggered function would be triggered whe</p><p>  15.2 DATA HANDLING</p><p>  15.2.1 Move Functions</p><p>  There are two

42、basic types of move functions;</p><p>  MOV(value,destination) - moves a value to a memory location</p><p>  MVM(value,mask,destination) - moves a value to a memory location, but with a</p>

43、;<p>  mask to select specific bits.</p><p>  The simple MOV will take a value from one location in memory and place it in</p><p>  another memory location. Examples of the basic MOV are

44、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 i

45、n the source 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 w

46、ill b</p><p>  Figure 15.2 Examples of the MOV Function</p><p>  A more complex example of move functions is given in Figure 15.3. When A</p><p>  becomes true the first move statem

47、ent 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 using 2s compliment.) For the simple MOVs the

48、 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 de

49、stination will be left unt</p><p>  15.2.2 Mathematical Functions</p><p>  Mathematical functions will retrieve one or more values, perform an operation and</p><p>  store the resul

50、t 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 store the result in F8:36. The f

51、unction 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

52、function follows. Some of the functions, such</p><p>  Figure 15.4 Arithmetic Functions</p><p>  An application of the arithmetic function is shown in Figure 15.5. Most of the</p><p&g

53、t;  operations provide the results we would expect. The second ADD function retrieves a</p><p>  value from N7:3, adds 1 and overwrites the source - this is normally known as an increment operation. The firs

54、t 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, f

55、rom N7:4 inverts the sign and stores it in N7:7.</p><p>  Figure 15.5 Arithmetic Function Example</p><p>  A list of more advanced functions are given in Figure 15.6. This list includes basic<

56、;/p><p>  trigonometry functions, exponents, logarithms and a square root function. The last function CPT will accept an expression and perform a complex calculation.</p><p>  Figure 15.6 Advanced

57、Mathematical Functions</p><p>  Figure 15.7 shows an example where an equation has been converted to ladder</p><p>  logic. The first step in the conversion is to convert the variables in the eq

58、uation to unused memory locations in the PLC. The equation can then be converted using the most nested calculations in the equation, such as the LN function. In this case the results of the LN function are stored in anot

59、her 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 fewer memory locations.)</p><p>  F

60、igure 15.7 An Equation in Ladder Logic</p><p>  The same equation in Figure 15.7 could have been implemented with a CPT function as shown in Figure 15.8. The equation uses the same memory locations chosen in

61、 Figure 15.7. The expression is typed directly into the PLC programming software.</p><p>  Figure 15.8 Calculations with a Compute Function</p><p>  Math functions can result in status flags suc

62、h as overflow, carry, etc. care must be</p><p>  taken to avoid problems such as overflows. These problems are less common when using floating point numbers. Integers are more prone to these problems because

63、 they are limited to the range from -32768 to 32767.</p><p>  15.2.3 Conversions</p><p>  Ladder logic conversion functions are listed in Figure 15.9. The example function</p><p>  

64、will 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 convert from 2s compliment binary to BCD, and between radians and deg

65、rees.</p><p>  Figure 15.9 Conversion Functions</p><p>  Examples of the conversion functions are given in Figure 15.10. The functions</p><p>  load in a source value, do the conver

66、sion, and store the results. The TOD conversion to BCD could result in an overflow error.</p><p>  Figure 15.10 Conversion Example</p><p>  15.2.4 Array Data Functions</p><p>  Arra

67、ys allow us to store multiple data values. In a PLC this will be a sequential</p><p>  series of numbers in integer, floating point, or other memory. For example, assume we are measuring and storing the weig

68、ht of a bag of chips in floating point memory starting at #F8:20 (Note the ’#’ for a data file). We could read a weight value every 10 minutes, and once every hour find the average of the six weights. This section will f

69、ocus on techniques that manipulate groups of data organized in arrays, also called blocks in the manuals.</p><p>  15.2.4.1 - Statistics</p><p>  Functions are available that allow statistical c

70、alculations. These functions are</p><p>  listed in Figure 15.11. When A becomes true the average (AVE) conversion will start at memory location F8:0 and average a total of 4 values. The control word R6:1 is

71、 used to keep track of the progress of the operation, and to determine when the operation is complete. This operation, and the others, are edge triggered. The operation may require multiple scans to be completed. When th

72、e operation is done the average will be stored in F8:4 and the R6:1/DN bit will be turned on.</p><p>  Figure 15.11 Statistic Functions</p><p>  Examples of the statistical functions are given i

73、n Figure 15.12 for an array of data</p><p>  that starts at F8:0 and is 4 values long. When done the average will be stored in F8:4, and the standard deviation will be stored in F8:5. The set of values will

74、also be sorted in ascending order from F8:0 to F8:3. Each of the function should have their own control memory to prevent overlap. It is not a good idea to activate the sort and the other calculations at the same time, a

75、s the sort may move values during the calculation, resulting in incorrect calculations.</p><p>  15.2.4.2 - Block Operations</p><p>  A basic block function is shown in Figure 15.13. This COP (c

76、opy) function will copy an array of 10 values starting at N7:50 to N7:40. The FAL function will perform</p><p>  mathematical operations using an expression string, and the FSC function will allow two arrays

77、 to be compared using an expression. The FLL function will fill a block of memory with a single value.</p><p>  Figure 15.13 Block Operation Functions</p><p>  Figure 15.14 shows an example of t

78、he FAL function with different addressing</p><p>  modes. The first FAL function will do the following calculations N7:5=N7:0+5,</p><p>  N7:6=N7:1+5, N7:7=N7:2+5, N8:7=N7:3+5, N7:9=N7:4+5. The

79、second FAL statement does not have a file ’#’ sign in front of the expression value, so the calculations will be N7:5=N7:0+5, N7:6=N7:0+5, N7:7=N7:0+5, N8:7=N7:0+5, N7:9=N7:0+5. With a mode of 2 the instruction will do t

80、wo of the calculations for every scan where B is true. The result of the last FAL statement will be N7:5=N7:0+5, N7:5=N7:1+5, N7:5=N7:2+5, N7:5=N7:3+5, N7:5=N7:4+5. The last operation would seem to be useless, but notice

81、 tha</p><p>  15.3 LOGICAL FUNCTIONS</p><p>  15.3.1 Comparison of Values</p><p>  Comparison functions are shown in Figure 15.15. Previous function blocks were</p><p>

82、  outputs, these replace input contacts. The example shows an EQU (equal) function that compares two floating point numbers. If the numbers are equal, the output bit B3:5/1 is true, otherwise it is false. Other types of

83、equality functions are also listed.</p><p>  Figure 15.15 Comparison Functions</p><p>  The example in Figure 15.16 shows the six basic comparison functions. To the</p><p>  right o

84、f the figure are examples of the comparison operations.</p><p>  Figure 15.16 Comparison Function Examples</p><p>  The ladder logic in Figure 15.16 is recreated in Figure 15.17 with the CMP fun

85、ction</p><p>  that allows text expressions.</p><p>  Figure 15.17 Equivalent Statements Using CMP Statements</p><p>  Expressions can also be used to do more complex comparisons, a

86、s shown in Figure 15.18. The expression will determine if F8:1 is between F8:0 and F8:2.</p><p>  Figure 15.18 A More Complex Comparison Expression</p><p>  The LIM and MEQ functions are shown i

87、n Figure 15.19. The first three functions will compare a test value to high and low limits. If the high limit is above the low limit and the test value is between or equal to one limit, then it will be true. If the low l

88、imit is above the high limit then the function is only true for test values outside the range. The masked equal will compare the bits of two numbers, but only those bits that are true in the mask.</p><p>  F

89、igure 15.19 Complex Comparison Functions</p><p>  Figure 15.20 shows a numberline that helps determine when the LIM function will be true.</p><p>  Figure 15.20 A Number Line for the LIM Functio

90、n</p><p>  File to file comparisons are also permitted using the FSC instruction shown in Figure 15.21. The instruction uses the control word R6:0. It will interpret the expression 10 times, doing two compar

91、isons per logic scan (the Mode is 2). The comparisons will be F8:10<F8:0, F8:11<F8:0 then F8:12<F8:0, F8:13<F8:0 then F8:14<F8:0, F8:15<F8:0 then F8:16<F8:0, F8:17<F8:0 then F8:18<F8:0, F8:19&l

92、t;F8:0. The function will continue until a false statement is found, or the comparison completes. If the compariso</p><p>  Figure 15.21 File Comparison Using Expressions</p><p>  15.3.2 Boolean

93、 Functions</p><p>  Figure 15.22 shows Boolean algebra functions. The function shown will obtain</p><p>  data words from bit memory, perform an and operation, and store the results in a new loc

94、ation in bit memory. These functions are all oriented to word level operations. The ability to perform Boolean operations allows logical operations on more than a single bit.</p><p>  Figure 15.22 Boolean Fu

95、nctions</p><p>  The use of the Boolean functions is shown in Figure 15.23. The first three functions require two arguments, while the last function only requires one. The AND function will only turn on bits

96、 in the result that are true in both of the source words. The OR function will turn on a bit in the result word if either of the source word bits is on. The XOR function will only turn on a bit in the result word if the

溫馨提示

  • 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. 眾賞文庫僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論