Monday, September 14, 2020

PLC basic UART ladder diagram instructions

UART sends and receives data between the PLC and its peripheral devices, especially a host PC. In LDMicro there some UART instructions to use.
  1. UART RECV : Is avail ?
This instruction output true whenever its buffer is not empty. It's just a flag for testing the availability of data.
UART RECV : Is avail ?

  1. UART (SERIAL) RECEIVE 
This instruction reads data from UART buffer and send it to a destination.
UART (SERIAL) RECV


We have to set the number of bytes and its destination to store.

  1. UART (SERIAL) SEND
This instruction reads data from a source and send it over the UART.
UART (SERIAL) SEND


Source is a data source to read from and it will be send to the UART transmit buffer.

Within this example, I use these basic three instructions to read data from UART and send it back to the UART terminal.

PLC basic UART ladder diagram instructions
PLC Simulation echos received data

The ladder diagram of this example made by a single rung.

Ladder diagram program

Click here to download a full zip file of this ladder diagram example.




No comments:

Post a Comment

Labels

ADC (10) Analog (14) Arduino (12) Atmega16 (19) Audio (2) AVR (20) Charger (1) Cortex-M0 (1) Counter (10) CPLD (25) Digital I/O (22) Display (34) EEPROM (2) Environment Sensor (1) esp8266 (2) Experiment Board (10) I2C (4) Interrupt (7) LCD (1) LDmicro (29) measurement and instrumentation (7) Microchip Studio (3) MikroC (1) One-Shot (3) OpAmp (1) PCB (31) PIC16 Microcontrollers (16) PIC16F877A (2) PIC16F887 MikroC (22) PLC (35) PWM (11) Regulator (1) RTC (2) Sensor (8) Shift Registers (5) SPI (5) Timer (34) UART (2) ultra-sonic sensor (1) USB (1) VHDL (21) xc8 (1) XC95108 (9) XC9536 (15) XC9572 (1) Xilinx (23) Xilinx ISE (22)