南京航空航天大学硕士学位论文基于RTLinux的通用数控平台构建姓名:吴木林申请学位级别:硕士专业:机械电子工程指导教师:游有鹏20080101PCCNCPLCCNCPC104RTLinuxRTLinuxRTLinuxLinuxRTLinuxLinuxRTLinuxPC104QtCFrameBufferLinuxXLibRTLinuxRTLinuxABSTRACTWiththedevelopmentofPCtechnology,thecomputernumericalcontrolsystemisenteringabrand-newstagesoftwareCNC.SoftwareCNCmeansthatallthefunctionsofCNCsystem,suchasinterpolation,positioncontrolandPLCareimplementedwithsoftwaremodules.ComparingwithtraditionalCNC,softwareCNChasabetterflexibility,versatility,efficiencyandopenness.Inthethesis,thehardwareplatformofthesystemisPC104,andthesoftwareplatformofthesystemisRTLinuxwhichisagenuinehardreal-timeandfreeoperationsystem.RTLinuxisabletoschedulemanyreal-timetasks,anditmeetsthedemandoftheCNCtaskswhichneedhighreal-time.ConstructingallsoftwaregeneralCNCplatformbasedonRTLinuxmakesthefollowingdevelopmentoftheCNCsystemwhichhastheproprietaryintellectualpropertyrightseasy,anditishelpfulinraisingourcountryCNCtechnicallevel.AftertheanalysisandcomparisonofpopularstructuresofsoftwareCNCsystems,anopenarchitectureCNCsystemwiththreelayersisdesignedbasedonRTLinux.Inaddition,themethodsusedinthecommunicationoflayersandmodulesaredesignedaccordingtotheresourcesofLinuxandRTLinux,andtheinterfaceprotocolamongmodulesisdesignedanddefinedaccordingtothedataandcommandsstreamsofCNCsystem.TheLinuxkernelandtheRTLinuxkernelarecustomizedaccordingtothedemandsofCNCsystem,andtheparticularreplantingprocessesonPC104areintroducedtoo.Toimprovethestabilityandrunningefficiency,Qtisusedinthedevelopmentofthegraphicaluserinterface,andClanguageisusedinthedevelopmentofthemanagementlayerandcontrollayer.ThesystemrunningonFrameBufferwithoutthesupportsoftheLinuxdesktopandXLibreducesthedemandofthememoryandthestorage.Finally,thedebugginganddevelopmentofapplicationprogramandkernelprogramareintroduced.ThesystemhasbeentestedonPC104,andtheresultshowsthatthemainfunctionsoftheCNCsystemcanmeettheexpecteddesigndemandswell.KeyWords:softwareCNC,RTLinux,kernelreplant,real-timethread,Communication1.2.1RTLinux……………………………………………………...122.2.2RTLinux……………………….……………….153.3.1………………………………….……………………174.3.2….………….……….…..…………………185.3.3CPU…………………….……….……………………186.3.4………………………………….…………………217.3.5………………………………………….……………………228.3.6………………………….…………………249.4.1Linux……………………………………….…………………3310.4.2RTLinux………………………………………………………3511.4.3RTLinux……………………………………………………3612.4.4FrameBuffer………………………...……………..4013.5.1……………………………………………………..4214.5.2……………………………………………………………..4415.5.3………………………………………………………………..4516.5.4…………………………………….………………………..4617.5.5………………………………………….………………..5318.5.6…………………………………………………..………..6119.6.1Linux…………………………………………………..………...…..6520.6.2vi…………………………………………………..………………..…..6621.6.3…………………………………………………..……………..7022.6.4…………………………………………………..……………..7123.6.5……………………………………………………………741.6.1GCC..……..………….….…….……..……………………..722.6.2GDB………..…………………………………..………………...74,()1(FMC)(FMS)(CIMS)(ComputerNumericControlCNC)CNC1.11.1.11952(ParsonsCo.)(ServoMechanismsLaboratoryofTheMassachuset'sInstituteofTechnology)[1-3](1)(NC)19591965(NC)(2)(CNC)701970RTLinux21974CNC7080CRTCNC/(3)CNCCNC32CPUCNCCNC1986CPU6802032CNC32CNC(4)PCCNC(PersonalComputer,PC)81632PCPCCNC1994PCCNCPCCNCCNCPC-NC1.1.21958445060607080CNC319861990()901995PCCNCCNC1.1.3FMSCIMS:[4](1)CPUCPU(2)(3)RTLinux4(4)PCPC(5)1.21.2.1CNCCNCFANUCSIEMENS[5]:(NC)5:NGCOMACOSACAOSEC[6][7]CNCPC1.2.2PC-NC()CNCPCPCCNCPCPC-NCPCPCPC-NC[8][9]PCNCNCPC(1)PCNCCNCRTLinux6CNCCNCPCPCNC(2)NCPCCNC(PLC)PCCNCNCPMACCNC(3)CNCPLCCNC[5]:CAD/CAM()()(MMCPCMCACPLC)I/OI/OSERCOSIEEE1394USBRS485SCSIMMS(ManufacturingMessageSpecification)CNC7COMCOBRACAD/CAM(Agent)FMSCIMS1.3PCSoftServoSystemsServoWorksAutomationIntelligenceAMLMDSIOpenCNCPowerAutomationPA8000NTCincinnatiMilaomnA2100[10][11]CNCI/OPC[12]WLONCS(WindowsNTandLinuxbasedOpenNumericalControlSystem)WLONCSWLONCSWLONCSWindowsNT+RTXLinux+RTLinux[13]WindowsVenturcomRTXRTX[14]RTLinuxCNC()[15](LinuxWindowsWindows)SERCOSWindowsSERCOSWindowsSERCOS[16]CNCWinNT+RTXRTLinux81.4PCDOSWindowsRTLinuxLinuxRTLinuxRTLinuxRTLinuxDOSWindowsRTLinuxRTLinux:LinuxRTLinuxRTLinuxPC104LinuxRTLinuxI/O9RTLinuxPCCNCPLCPCDOSWindowsRTLinux2.12.1.1DOSDOSDOSCPUDOS/(PC8253/8254)()PC82530()12CPU8259IRT0PCPCDOS55msDOSDOS()DOS[17][18][19]RTLinux10DOSDOSDOSDOSDOSCPU640KDOSDOSDOS2.2.2WindowsWindowsPCWindowsWindowsWindowsWindowsWindows[20-25]:WindowsWindows3.1/3.2DPMI(DOSProtectedModeInterfaceDOS)DOSWindows95/NTDOSWindowsAPI(MMSYSTEM.LIB)(vxd)l0msWindowsWindows3.XWindows95/NTWindows3.1/3.2WindowsWindowsDSP11WindowsDSPWindowsPC[26]2.2.3RTLinuxpSOSVxWorksWindowsCE[27][28]RTLinuxLinuxRTLinux(Linux)RTLinux()()RTLinuxLinuxLinuxRTLinuxLinuxLinuxLinuxRTLinux2.1RTLinuxRTLinuxx86PC()15()25pSOSVxWorksWindowsCERTLinuxDOSWindowsRTLinux[29][30]:(1)RTLinux(2)RTLinuxRTLinuxRTLinux12(3)RTLinuxRTLinuxRTLinuxDOSWindows:(1)RTLinux(2)RTLinux(3)RTLinux(4)RTLinuxI/ORTLinuxLinux2.1RTLinux2.2RTLinuxRTOSRTLinux[26]POSIX1003.13LinuxBSDUnixRT-Linux13LinuxRT-LinuxLinuxCPURT-LinuxRT-LinuxRTLinux(ISR)LinuxRTLinuxPOSIX(RM)(EDF)RTLinuxEDF2.3RTLinux2.3.1PC104PC104PC104:(1)PC104PC104PC(2)PC104CNCCNCPC10