每个人编程都会有不同的习惯和特点,不能强求一致。但是一些好的习惯还是应该为大多数人所遵循。一是理顺逻辑关系、时序关系,编制程序框图;二是合理分配主程序、子程序和中断程序;三是合理分配寄存器,编制寄存器符号表。
PLC编程更接近于单片机,或者说PLC就是模块化的单片机。因此PLC的很多操作都是直接针对寄存器的,如果在程序中出现不合理的寄存器地址重叠,一定会出现不可预想的后果。编制寄存器符号表不仅可以避免上述问题(MicroWin会有问题提示),而且可以使程序具备更好的可读性。这和VB中定义变量有异曲同工之处。
VB编程中关注的是事件,不强调主程序和子程序的观念,因为VB主程序的工作是由PC的操作系统完成的。PLC则不然。PLC程序是以主程序为主干的,CPU不断的循环执行主程序,只有触发条件成立时才会调用子程序或中断程序。即子程序和中断程序所执行的任务不是全时需要的。如果把这些任务都放在主程序中会无端增加主程序的工作量,降低程序的效率。这点和单片机的编程思路是一致的。子程序的使用可以使整个程序的逻辑更清晰。而且子程序可以分开编写、调试,最后“安装”到主程序上。这样你可以一个一个解决问题。
Arktite Plug - AP20468 - Appleton Powertite ARC 20034E
Crouse Hinds 3PH 200 Amp 600V AC 250V DC 4 Pole
Servicemaster / Advance Vacuum
Fuji 400A 480VAC 3 Pole Circuit Breaker BU-KHA 3400
Woodhead Hazardous Duty Fluorescent Hand Lamp
NEW Cermax 300W Xenon UV Bulb EX300-10UV
Miller 5" Base-Lok Piston Seal Kit 051-KR015-500
NEW BEI Encoder H25E-F1-SS-2500?-ABZC-8830-SM18?-S
CHROMALOX HEATING ELEMENT 393-071215-030, 230V 3000W
TYCO Termi-Point Tool, with clips (P/N 4-330495-2)
TYCO Pneumatic Crimp Gun with Clips
S&S X-RAY 6 Panel Film Illuminator #140006
PHOENIX CONTACT/ FLKM D37,FLKM D37/S/LA SUB & TERMINALS
Precision Gear Hobbling Fixtures with Expanding Sleeves
093.1415 093.1414
Moog Brushless Servo Motor 304X066 340 volts 6600 rpm
Jet Equipment Drilling & Milling Machine No. 16
Parker Electro Hydraulic Valve - D1VW20HYY50
BLACKHAWK Automotive Jack 50 Ton MODEL# GB11
GEBR. BECKER VACUUM PUMP VT-6 & MOTOR D71 A4
Grindmaster model P-300E Single Shuttle Coffee Brewer
Square D Econoflex Motor Controller - Class 8839
100% Satisfaction Guaranteed.
SY/MAX Class 8020 SCP-311, 512 RAM
SCR Power Panel - Rockwell Fincore F210
100% Satisfaction Guaranteed
Gould Vertically Immersed End Suction Pump-G&L Md. NPV
Stewart Warner Alemite Oil Mist Unit - Mod 4978-D6 New
Brand New Oil Mist Systems, bearings
NEW Barksdale Heavy Duty Valve 141R3WC3 14 Series
LOUIS ALLIS ADJUSTO SPEDE MOTOR 3 Phase 10 HP
Enerpac Parts - Lot of 23 Assorted Parts
DAYTON 20 HP MOTOR, 3540 RPM, MODEL 3N673A
McGunn Safe
Wellmark Pressure Relief Valve
Lubricating Systems LS-7AFIL Oil Mister
Square D 25S3H Single Phase General Purpose Transformer
Miller 4.5" Base-Lok Piston Seal Kit 051-KR015-450
Fafnir 2MM311WI DUL Superprecision Bearing Set
Advanced Machine & Engineering Layout Plate
54" X 20" X 2 5/8"
Fanuc AC Servo Motor C97144103
Similar P/N A06B-0123-B077?#7000
Woodhead / Pow-R-Mite Cable Reel #358A