1325098 九、發明說明: 【發明所屬之技術領域】 本發明涉及一種控制系統及方法,尤其涉及一種透過 發送指令來控制機台運動的系統及方法。 【先前技術】 ' 品質係一個企業保持長久發展能力的重要因素之 一,如何保證和提高產品品質,係企業活動中的重要内容。 製造工廠在批量生産産品前需對生産出的樣品進行量測, ® 以檢驗是否存在品質問題,如工件的尺寸和形狀是否在公 差規定範圍内,目前這種量測方式大多由人爲使用量具來 ' 完成,人工作業誤差大、效率低、準確度難以保證。 隨著電腦技術的發展及應用,量測技術不再局限於人 工的操作,電腦在工件檢驗活動中被大量的引入,提高了 檢驗準確性。在對樣品進行量測時,人工將工件放入量測 機台,透過電腦控制進行量測。但係在量測過程中量測精 φ 度不高,量測同樣的工件時仍然需要進行重複的操作,機 台上的運動部件不能精確的定位在指定位置上,且量測過 程中不能即時監控量測機台的各種狀態以確保機台運動時 的安全性及可靠性。 【發明内容】 鑒於以上内容,有必要提供一種機台運動控制系統及 方法,其可控制機台運動部件的運動執跡,同時也監控機 台的各種狀態。 本發明較佳實施例提供一種機台運動控制系統,該系 7 丄 置:ί控:卡:伺服系統及安裝在機台的運動部件上的位 1二二’ δ亥控制卡與伺服系統相連’該系統還包括盥 制卡相連的電腦,該電腦包括:監控單元,用於7 ^運行前及運行中的狀態;指令發送單元,用於接二 戶輸4指令’並發送令給控制卡,由㈣卡來控制 糸統驅動運動部件運動,該指令包括運動部件需到達 的位置、運動部件㈣的速度比率及方向資訊;計算單元, 動部件運動後,根據當前運動部件的速度比率來 速度值’及根據位置回饋元件的當前脈衝計數 值來计异運動部件當前位置。 、本發明較佳實施例提供一種機台運動控制方法, ί包2下步驟:檢查機台運行前的狀態;透過控制卡發 =才曰令給伺服系統,該指令包括指定機台的運動部件需 /的位置、運動料運動的速纽率及料ϋ 機台的運動部件的最大行程來判斷該指定的位置是否: t若該指定的位置沒超程,則執行該指令使運動部件按 1述速度比率及方向資訊運動到所需到達的位置;若爷 指定的位置超程,則重新修正指令。 / 相較於習知技術,所述之機台運動控㈣統及方法, '過發运指令來控制運動部件的運動以精確的完成用戶定 ==動執跡,此外,還能即時監控機台的各種狀態以確 二運動的安全及可靠性’從而提高了機台運動執跡的精確 8 1325098 【實施方式】 針對本發明涉及的專有術語作如下解釋: 伺服系統:由伺服驅動裝置和驅動元件(電機)組成, 接收來自數控裝置的指令,驅動該數控裝置的運動部件跟 隨指令脈衝運動,以保證運動的快速和準確;在本發明的 較佳實施例中,該數控裝置爲一影像量測機台(簡稱機 台),該機台包括一運動部件,該伺服系統由驅動器、電機 及編碼器組成(如圖1所示); 開環:伺服系統環路的斷開狀態; 閉環:伺服系統環路的閉合狀態; 歸零:當機台上電後,首先進行歸零操作,這係由於 一般機台每次斷電後,對各個座標軸的位置記憶自動遺 失。因此開機後,必須讓機台各座標軸回到一個固定位置 點上,既回到機台的座標系零點,也稱座標系的原點或參 考點,這一過程就稱爲機台歸零; 限位:包括硬體限位和軟體限位,硬體限位係機台上 用來制止運動部件機械運動的一開關,而軟體限位係透過 軟體來設置一指定位置從而使運動部件到該指定位置時停 止運動。 參閱圖1所示,係本發明機台運動控制系統較佳實施 例的硬體架構圖。其包括:電腦1、控制卡2、伺服系統3 及光柵尺6。其中,該電腦1透過發送指令給控制卡2來 控制伺服系統3,從而驅動機台的運動部件(圖中未示出) 運動,達到控制運動部件的運動軌跡,即速度、方向及移 9 動距離。該光柵尺6係一位置回饋元件,該位置回饋元件 • 還可用磁柵尺或旋轉編碼器來代替。該光栅尺6安裴在運 動部件上’跟隨運動部件一起運動,運動部件開始運動後, • 光柵尺6輸出一反饋脈衝給控制卡2 ’並同時開始從零開 始計數,透過該計數值(包括X、Υ及Ζ軸三個值)可計 异出當前運動部件的位置。在圖中,伺服系統3包括驅動 益30 ’電機31及編碼器32 ’該電機31與編碼器32被固 φ 疋在—起,其中控制卡2輸出一類比電壓給驅動器3〇,驅 動器 30 輪出一 pwm ( pUise width modulation )信號給電 ,31 ’與此同時,電機31帶動編碼器32進行運動,編碼 时32輪出—反饋脈衝給驅動器3〇以控制運動部件的運動 =度:電腦1還可監控機台當前狀態,如伺服系統3的狀 二機台各軸的歸零狀態'限位開關的狀態及電機狀態等。 ^伺=系統3具有開環及閉環狀態;歸零狀態係指機台的 車疋否回到座“原點;限位開關的狀態包括開通和 鲁 1,龟機狀態包括運行、停止和出錯等。 翏閱圖2所示,係本發明機台運動控制系統較佳實施 例中電腦的功能單元圖。該電腦工包括多個功能單元:一 ,控單元11、-歸零單元12、一指令發送單元13及一計 异單元14。 —士風控單元11用於監控機台的各種狀態以確保機台運 了^安全性及可#性。其包括在機台運行前,檢查機台 下了緊急按鈕、限位開關是否開通、伺服系統3是 汗衣機口各座標轴是否歸零等。在運行中,監控限位 10 1325098 開關的狀態及伺服系統3狀態等。 ^零單元12驗在機台運行前,當監控單元^檢查 到機台各座標軸未歸零時進杆♦ 仃知零。即機台的X、γ及z ==標,以確定機台有—個統一的計數起點,以 減少機台在置測過程的量測誤差。 於入Ltf送單元13用於當機台各轴歸零後,接收用戶 輸的“令,並發送該指令給控制卡2。該指令包括了運 動部件需到達的位置、運動部件運動速度比率及方向等資 ::3 :制卡2接收到指令後輸出-類比電壓以控制伺服系 =驅動器30及電機31,從而控制運動部件的運動速 方向及其需到達的位置。用户可透過電腦工輸入 用戶萬發送的指令,也可透過其他裝置來發送指令,如一 手柄控制裝置(圖中未示出)。 當伺服系統3驅動運動部件開始運動後,計算單元μ 根據目前運動部件的速度比率來計算當前的速度值,還可 根據光栅尺6的當前脈衝計數值來計算運㈣件當前位 置。其中速度值的計算係透過用速度比率乘以一機a 動部件的速度極限值得到-速度值,如當前速度口率^ 3〇% ’而運動部件極限速度爲a米,秒,則當前速度值爲 3〇%*A米/秒。而當前位置係透過光柵尺6 #前脈衝計數 值除以一固定值得到運動部件當前位置的座標值,如春前 脈衝計數值爲⑵,35, 40),而固定值爲b,則當前^動 部件的位置爲(21/B,35/B,4G/B)毫米,其中Β可根據 需求設定。 η 1325098 參閱圖3所示,係本發明機台運動控制方法較佳實施 例的流程圖。該方法主要包括步驟:首先,進行發送指令 前的一些準備工作,即在機台上電後,對機台進行檢查, 以確保機台運動時的安全性及可靠性。當機台上電後,監 ’ 控單元11檢查機台是否按下緊急按鈕(步驟S301);若按 • 下了緊急按鈕,則彈出緊急按鈕(步驟S302);若沒按下 緊急按鈕,則檢查限位開關是否開通(步驟S303);若沒 開通則將限位開關開通(步驟S304);若限位開關開通, ® 則檢查伺服系統3,即驅動器30和電機31是否閉環(步 驟S305);若不閉環,則排除故障(步驟S306);若驅動 器30和電機31閉環,則檢查機台的X、Y及Z軸是否回 到零點座標,即是否歸零(步驟S307);若上述三個轴都 沒歸零或者還有部分沒歸零則進行該轴的歸零(步驟 S308);當所有檢查工作都已完成了,則指令發送單元13 根據用戶輸入的指令資訊發送指令給控制卡2,該指令包 ^ 括:運動部件運動速度比率、方向及指定運動部件需到達 的位置等資訊(步驟S309);根據運動部件的最大行程來 判斷所輸入的到達位置是否超程(步驟S310);若所輸入 的位置超程了,則修正該指令中的位置資訊,並返回步驟 S309 (步驟S311);若所到達位置沒超程,則執行指令(步 驟S312);在運動部件開始運動後,計算單元14計算運動 部件當前到達的位置,並判斷其是否已到指定位置(步驟 S313);若沒到達指定位置,則等待其到達指令位置的資 訊,並返回步驟S313 (步驟S314);在運動部件到達位置 12 1325098 後,即執行完該指令後,指令發送單元13判斷是否需要執 行下一指令(步驟S315),若不需執行下一指令,則結束 流程。 在步驟S315中,若需執行下一指令,則流程轉至步 驟 S310。 如圖4所示,係圖3中步驟S308的座標軸進行歸零 的具體流程圖。該歸零係將機台各個軸進行歸零,其可以 按X、Y及Z軸的先後順序進行每一軸的歸零,也可按照 其他順序進行歸零。在本較佳實施例中,以X、Y及Z轴 的先後順序進行歸零。首先,歸零單元12設定X軸限位 無效,該設定係爲了使機台X軸到達某個指定位置後不會 固定不動(步驟S401);設定歸零方向和速度,即設定機台 X軸回到零點座標的方向及速度比率(步驟S402);設定觸 發位置,使控制卡2能在得到對應的觸發信號後觸發X軸 (步驟S403);設定X軸的零位偏移量,該偏移量係根據機 台本身製造結構來確定的(步驟S404);透過控制卡2發送 X軸的歸零指令給伺服系統3,以控制X軸的歸零(步驟 S405);計算單元14根據光柵尺6的當前脈衝計數值計算 X轴當前到達的位置,即計算當前的X軸的座標值,並判 斷其是否已到指令中指定的位置,即X軸是否已回到零點 座標(步驟S406);若沒到達指定的位置,則等待其到達 指令位置的資訊,即等待X軸的歸零資訊(步驟S407); 若X軸已完成了歸零動作,則判斷是否需要進行另一軸的 歸零,如Y或Z轴(步驟S408),若不需進行另一軸的歸零, 13 1325098 則結束流程。 若需進行另一軸的歸零,則流程返回步驟S401,接下 來進行Y軸及Z軸的歸零。 本發明機台運動控制系統及方法,雖以較佳實施方式 揭露如上,然其並非用以限定本發明。任何熟悉此項技藝 之人士,在不脫離本發明之精神和範圍内,當可做更動與 潤飾,因此本發明之保護範圍當視後附之申請專利範圍所 界定者為準。 【圖式簡單說明】 圖1係本發明機台運動控制系統較佳實施例的硬體架 構圖。 圖2係本發明機台運動控制系統較佳實施例中電腦的 功能單元圖。 圖3係本發明機台運動控制方法較佳實施例的流程 圖。 圖4係圖3中對各個軸進行歸零的具體流程圖。 【主要元件符號說明】 電腦 1 控制卡 2 伺服系統 3 光柵尺 6 監控單元 11 歸零單元 12 指令發送單元 13 14 1325098 計算單元 141325098 IX. Description of the Invention: [Technical Field] The present invention relates to a control system and method, and more particularly to a system and method for controlling motion of a machine by transmitting commands. [Prior Art] 'Quality is one of the important factors for a company to maintain its long-term development ability. How to ensure and improve product quality is an important part of corporate activities. The manufacturing plant needs to measure the produced samples before mass production, ® to check whether there are quality problems, such as whether the size and shape of the workpiece are within the tolerance range. Currently, most of the measurement methods are made by artificial measuring tools. Come 'complete, manual operation error, low efficiency, accuracy is difficult to guarantee. With the development and application of computer technology, measurement technology is no longer limited to manual operation, and the computer has been introduced in a large number of workpiece inspection activities, which improves the accuracy of inspection. When measuring the sample, the workpiece is manually placed in the measuring machine and measured by computer control. However, the measurement accuracy is not high during the measurement process. Repeated operations are still required when measuring the same workpiece. The moving parts on the machine cannot be accurately positioned at the specified position, and the measurement process cannot be instantaneous. Monitor the various states of the machine to ensure safety and reliability when the machine is moving. SUMMARY OF THE INVENTION In view of the above, it is necessary to provide a machine motion control system and method that can control the movement of the moving parts of the machine while also monitoring various states of the machine. The preferred embodiment of the present invention provides a machine motion control system, which is provided with a servo system and a servo system and a bit 1 22' δhai control card mounted on the moving parts of the machine. 'The system also includes a computer connected to the system card, the computer includes: a monitoring unit for 7 ^ pre-run and running state; an instruction sending unit for receiving two commands 4 and sending a command to the control card The (four) card controls the movement of the moving parts of the system, the command includes the position that the moving part needs to reach, the speed ratio and the direction information of the moving part (4); the calculating unit, after the moving part moves, according to the speed ratio of the current moving part The value 'and the current position of the moving part based on the current pulse count value of the position feedback element. The preferred embodiment of the present invention provides a machine motion control method, and the following steps: checking the state before the machine is running; sending a command to the servo system through the control card, the command includes the moving parts of the designated machine. The position of the demand, the speed of the moving material, and the maximum stroke of the moving part of the machine to determine whether the specified position is: t If the specified position does not go over, execute the command to press the moving part. The speed ratio and direction information are moved to the desired position; if the position specified by the master is overtraveled, the command is re-corrected. / Compared with the prior art, the machine motion control (four) system and method, 'over-delivery command to control the movement of the moving parts to accurately complete the user's fixed == action, in addition, the real-time monitoring machine The various states of the station ensure the safety and reliability of the movements' thus improve the accuracy of the machine movements. 8 1325098 [Embodiment] The specific terms related to the present invention are explained as follows: Servo system: by servo drive and The driving component (motor) is configured to receive an instruction from the numerical control device, and the moving component of the numerical control device is driven to follow the command pulse motion to ensure the movement is fast and accurate; in the preferred embodiment of the invention, the numerical control device is an image Measuring machine (referred to as machine), the machine includes a moving part, the servo system is composed of a driver, a motor and an encoder (as shown in Figure 1); an open loop: a disconnected state of the servo system loop; : The closed state of the servo system loop; Zeroing: When the machine is powered on, the zeroing operation is first performed. This is because each of the coordinate axes of the servo machine is turned off after each power failure. The location memory is automatically lost. Therefore, after starting the machine, the coordinate axes of the machine must be returned to a fixed position point, returning to the zero point of the coordinate system of the machine, also called the origin or reference point of the coordinate system. This process is called zero return of the machine; Limit: includes a hardware limit and a software limit, a switch on the machine for stopping the mechanical movement of the moving part, and the software limit is set by the software to set a designated position to move the part to the Stop motion when you specify a location. Referring to Figure 1, there is shown a hardware architecture diagram of a preferred embodiment of the machine motion control system of the present invention. It includes: computer 1, control card 2, servo system 3 and scale 6 . Wherein, the computer 1 controls the servo system 3 by sending a command to the control card 2, thereby driving the moving parts of the machine (not shown) to control the movement track of the moving parts, that is, the speed, the direction and the movement distance. The scale 6 is a position feedback element, and the position feedback element can also be replaced by a magnetic scale or a rotary encoder. The scale 6 is mounted on the moving part to follow the moving part to move together, after the moving part starts to move, the scale 6 outputs a feedback pulse to the control card 2' and simultaneously starts counting from zero, through which the count value is included (including The three values of X, Υ and Ζ axis can be used to determine the position of the current moving part. In the figure, the servo system 3 includes a drive benefit 30 'motor 31 and an encoder 32'. The motor 31 and the encoder 32 are solidified, wherein the control card 2 outputs an analog voltage to the driver 3, the driver 30 wheel A pwm (pUise width modulation) signal is supplied to the power, 31 ' at the same time, the motor 31 drives the encoder 32 to move, and 32 pulses are output during the encoding - the feedback pulse is given to the driver 3 to control the motion of the moving parts = degree: computer 1 It can monitor the current status of the machine, such as the zero return status of each axis of the servo system 3, the status of the limit switch and the motor status. ^Serve=System 3 has an open loop and closed loop state; the return to zero state refers to whether the rut of the machine returns to the seat “origin; the status of the limit switch includes open and 鲁1, and the state of the turtle machine includes operation, stop and error. Figure 2 is a functional unit diagram of a computer in a preferred embodiment of the motion control system of the machine of the present invention. The computer worker includes a plurality of functional units: a control unit 11, a return-to-zero unit 12, and a The command sending unit 13 and the metering unit 14 are used to monitor various states of the machine to ensure that the machine is shipped with safety and availability. It includes checking the machine before the machine is running. After the emergency button and the limit switch are turned on, the servo system 3 is whether the coordinate axes of the sweating machine port are returned to zero, etc. During operation, the status of the limit switch 10 1325098 and the state of the servo system 3 are monitored. Before the machine is running, when the monitoring unit ^ checks that the coordinate axes of the machine are not reset to zero, the input rod ♦ knows zero. The X, γ and z == marks of the machine table to determine that the machine has a uniform Count the starting point to reduce the measurement error of the machine during the placement process. Ltf feeding unit 13 for the respective axes when the machine zero, receiving user input of "order, and transmits the command to the control card 2. The command includes the position that the moving part needs to reach, the moving speed ratio and the direction of the moving part, etc.: 3: After the card 2 receives the command, the output-analog voltage is used to control the servo system=the driver 30 and the motor 31, thereby controlling the moving parts. The direction of motion speed and the position to be reached. The user can input the command sent by the user through the computer, or send the command through other devices, such as a handle control device (not shown). After the servo system 3 drives the moving part to start moving, the calculating unit μ calculates the current speed value according to the speed ratio of the current moving part, and can also calculate the current position of the (four) piece according to the current pulse count value of the scale 6. The calculation of the speed value is obtained by multiplying the speed ratio by the speed limit value of a moving part, such as the current speed rate ^ 3〇% ' and the moving speed limit of the moving part is a meter, second, the current speed. The value is 3〇%*A m/s. The current position is obtained by dividing the pre-pulse count value of the grating ruler 6 by a fixed value to obtain the coordinate value of the current position of the moving part, such as the pre-spring pulse count value (2), 35, 40), and the fixed value is b, then the current ^ The position of the moving parts is (21/B, 35/B, 4G/B) mm, of which Β can be set according to requirements. η 1325098 Referring to Figure 3, there is shown a flow chart of a preferred embodiment of the motion control method of the machine of the present invention. The method mainly includes the steps of: first, performing some preparatory work before sending the command, that is, after the machine is powered on, the machine is inspected to ensure the safety and reliability of the machine when moving. After the machine is powered on, the monitoring unit 11 checks whether the machine presses the emergency button (step S301); if the emergency button is pressed, the emergency button is popped up (step S302); if the emergency button is not pressed, Check whether the limit switch is turned on (step S303); if not, turn on the limit switch (step S304); if the limit switch is turned on, ® check the servo system 3, that is, whether the driver 30 and the motor 31 are closed (step S305) If the loop is not closed, the fault is eliminated (step S306); if the driver 30 and the motor 31 are closed loop, check whether the X, Y and Z axes of the machine return to the zero coordinate, that is, whether to return to zero (step S307); If the axes are not returned to zero or if some of the axes are not returned to zero, the zeroing of the axis is performed (step S308); when all the checking operations have been completed, the command transmitting unit 13 sends an instruction to the control card according to the instruction information input by the user. 2. The instruction package includes: information such as the moving speed ratio of the moving component, the direction, and the position at which the specified moving component needs to be reached (step S309); determining whether the input arriving position is overtraveled according to the maximum stroke of the moving component (step S310) If the input position is overtraveled, the position information in the command is corrected, and the process returns to step S309 (step S311); if the arrived position does not go over, the command is executed (step S312); after the moving part starts exercising The calculating unit 14 calculates the current position of the moving part and determines whether it has reached the designated position (step S313); if the specified position is not reached, waits for the information to reach the command position, and returns to step S313 (step S314); After the moving part reaches the position 12 1325098, after executing the instruction, the instruction transmitting unit 13 determines whether it is necessary to execute the next instruction (step S315), and if the next instruction is not required, the flow ends. In step S315, if the next instruction is to be executed, the flow proceeds to step S310. As shown in Fig. 4, a specific flowchart of zeroing the coordinate axis of step S308 in Fig. 3 is performed. The zeroing system zeroes each axis of the machine. It can zero each axis in the order of X, Y, and Z axes, or zero in other orders. In the preferred embodiment, zeroing is performed in the order of the X, Y, and Z axes. First, the zeroing unit 12 sets the X-axis limit to be invalid. This setting is not fixed until the machine X-axis reaches a certain position (step S401); setting the zero-return direction and speed, that is, setting the machine X-axis Returning to the direction and speed ratio of the zero coordinate (step S402); setting the trigger position, enabling the control card 2 to trigger the X axis after obtaining the corresponding trigger signal (step S403); setting the zero offset of the X axis, the bias The shift amount is determined according to the manufacturing structure of the machine itself (step S404); the zero return command of the X axis is transmitted to the servo system 3 through the control card 2 to control the zero return of the X axis (step S405); the calculating unit 14 is based on the grating The current pulse count value of the ruler 6 calculates the current position of the X axis, that is, calculates the coordinate value of the current X axis, and determines whether it has reached the position specified in the command, that is, whether the X axis has returned to the zero point coordinate (step S406). If the specified position is not reached, wait for the information to reach the command position, that is, wait for the zero return information of the X axis (step S407); if the X axis has completed the zero return operation, determine whether it is necessary to perform zero return of the other axis. , such as the Y or Z axis (step S408) If it is not zero for the other axis, the process ends 131,325,098. If the return of the other axis is to be performed, the flow returns to step S401, and the zeroing of the Y-axis and the Z-axis is performed next. The machine motion control system and method of the present invention are disclosed above in the preferred embodiments, but are not intended to limit the present invention. Any person skilled in the art will be able to make modifications and refinements without departing from the spirit and scope of the invention, and the scope of the invention is defined by the scope of the appended claims. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a view showing a hardware frame of a preferred embodiment of the machine motion control system of the present invention. Figure 2 is a functional unit diagram of a computer in a preferred embodiment of the machine motion control system of the present invention. Fig. 3 is a flow chart showing a preferred embodiment of the motion control method of the machine of the present invention. Figure 4 is a detailed flow chart of zeroing each axis in Figure 3. [Description of main component symbols] Computer 1 Control card 2 Servo system 3 Scale 6 Monitor unit 11 Zero unit 12 Command transmission unit 13 14 1325098 Calculation unit 14
1515