ABSTRACT

This chapter explains the basic software of the PIC16F648A-based PLC. The basic software of the PIC16F648A-based PLC makes use of general purpose 8-bit registers of static random-access memory data memory of the PIC16F648A microcontroller. The user PLC program must be placed between get_inputs and send_outputs. The endless PLC scan cycles are obtained by means of the label "scan" and the instruction "goto scan". When a mechanical contact, such as a push-button switch, user interface button, limit switch, relay, or contactor contact, is opened or closed, the contact seldom demonstrates a clean transition from one state to another. There are two types of contacts: normally open and normally closed. In some industrial applications debouncing is required to eliminate both mechanical and electrical effects. Most switches seem to exhibit bounce duration under 10 ms, and therefore it is reasonable to pick a debounce period in the 20 to 50 ms range.