LDmicro: Ladder Logic for PIC and AVR > 자유게시판 | 레가토북스(음악전문서점)
본문 바로가기
사이트 내 전체검색

LDmicro: Ladder Logic for PIC and AVR

페이지 정보

작성자 Sofia Coleman 작성일 25-10-04 12:19 조회 17 댓글 0

본문

Quick summary: I wrote a compiler that begins with a ladder diagram and generates native PIC16 or AVR code. This program is free software program; source code and executables are available for obtain. PLCs are sometimes programmed in ladder logic. It is because PLCs originally replaced relay control techniques, and forty years later, we still haven't fairly let go. A PLC, like every microprocessor, executes a listing of instructions in sequence. Ladder logic instruments abstract this; you may program the PLC by wiring up relay contacts and coils on-screen, and the PLC runtime will simulate the circuit that you have drawn. A few of the relay contacts could be tied to input alerts from the real world; some of the coils could be tied to outputs. That way you can also make your simulated circuit work together with different units, and actually management issues. That's the purpose. Actually it is extra common than that, because you can incorporate timers and counters and arithmetic operations that you couldn't (simply) perform with simply relays.



96d36380-a585-4bd9-9e92-8e0aec4574e3.jpegThe circuit concept is still useful although, partly just because it is intuitive, but additionally as a result of it abstracts the concurrency issues. This is an easy piece of combinational logic. There are three enter terms, Xa, Xb, and Xc. There's one output term, Yout. Xa and (Xb or (not Xc)). This makes sense in the event you consider Xa and Xb as usually open relay contacts, Xc as normally closed relay contacts, and Yout as a relay coil. This is for a simple thermostat. There are two analog inputs; certainly one of them is for the setpoint, so that it might, for instance, be related to a pot that the consumer turns to select the desired temperature. The other offers the temperature measurement; it might be a semiconductor temperature sensor, or a platinum RTD with appropriate interfacing circuitry. There is a digital output, Yheater. That may management a heating aspect, by a suitable change (a TRIAC, or Alpha Heater product page a relay, or a stable-state relay, or whatever).



We shut the loop with a simple hysteretic (bang-bang) controller. We've selected plus or minus 20 ADC models of hysteresis. 20), we turn the buy alpha heater off. I selected so as to add a few small frills. First, there is an enable enter: the Alpha Heater info is compelled off when Xenable is low. This compares in opposition to a threshold barely colder than (setpoint - 20), so that the sunshine does not flicker with the traditional cycling of the thermostat. This can be a trivial instance, but it must be clear that the language is sort of expressive. Ladder logic is not a common-function programming language, but it's Turing-complete, accepted in business, energy saving heater and, for a limited class of (largely management-oriented) issues, Alpha Heater official site surprisingly handy. Modern sub-3.00 USD microcontrollers in all probability have concerning the computing power of a PLC circa 1975. They due to this fact present more than enough MIPS to run fairly complicated ladder logic with a cycle time of some milliseconds. I think PLCs usually have some form of runtime that's kind of like an interpreter or a virtual machine, but if we're doing simple logic on a processor with out much memory then a compiler might be a better concept.



So I wrote a compiler. You begin with an empty rung. You possibly can add contacts (inputs) and coils (outputs) and more complicated buildings to construct up your program. Timers (TON, TOF, RTO) are supported. The max/min durations rely upon the cycle time of the `PLC,' which is configurable; timers can rely from milliseconds to tens of minutes. There are counters and Alpha Heater info arithmetic operations (plus, minus, times, div). Circuit components could also be added in sequence or in parallel with present components. An I/O checklist is constructed from the ladder logic drawn. You'll be able to have inside relays (Rfoo), for which memory is automatically allotted, or inputs (Xfoo) and alpha heater reviews outputs (Yfoo), to which it's essential to assign a pin on the microcontroller. The selection of pins accessible will depend on the microcontroller. I have tried to assist the most popular PICs and AVRs (see beneath). Then you can take a look at this system by simulating it in actual time.

댓글목록 0

등록된 댓글이 없습니다.

레가토북스(음악전문서점) 정보

회사소개 개인정보 이용약관 PC 버전

회사명 레가토북스 주소 경북 포항시 북구 새천년대로 1235 105-1404
사업자 등록번호 801-09-00314
대표 권승칠 전화 054-242-3209 팩스 0504-088-7002
통신판매업신고번호 제 2020-경북포항-0071호
개인정보 보호책임자 권승칠 부가통신사업신고번호 71호
Copyright © 2001-2013 레가토북스. All Rights Reserved.

PC 버전