From f7669a3fcc87d4f6040257c3dd8708c263331458 Mon Sep 17 00:00:00 2001
From: Rr42
Date: Fri, 25 May 2018 10:13:59 +0530
Subject: Added all LDmicro filles to be ported

---
 ldmicro/reg/tests/avr-hw.ld          | 61 ++++++++++++++++++++++++++++++++++++
 ldmicro/reg/tests/contacts.ld        | 41 ++++++++++++++++++++++++
 ldmicro/reg/tests/integers.ld        | 61 ++++++++++++++++++++++++++++++++++++
 ldmicro/reg/tests/misc-ops.ld        | 53 +++++++++++++++++++++++++++++++
 ldmicro/reg/tests/pic16-hw.ld        | 61 ++++++++++++++++++++++++++++++++++++
 ldmicro/reg/tests/timers-counters.ld | 57 +++++++++++++++++++++++++++++++++
 6 files changed, 334 insertions(+)
 create mode 100644 ldmicro/reg/tests/avr-hw.ld
 create mode 100644 ldmicro/reg/tests/contacts.ld
 create mode 100644 ldmicro/reg/tests/integers.ld
 create mode 100644 ldmicro/reg/tests/misc-ops.ld
 create mode 100644 ldmicro/reg/tests/pic16-hw.ld
 create mode 100644 ldmicro/reg/tests/timers-counters.ld

(limited to 'ldmicro/reg/tests')

diff --git a/ldmicro/reg/tests/avr-hw.ld b/ldmicro/reg/tests/avr-hw.ld
new file mode 100644
index 0000000..7053aa4
--- /dev/null
+++ b/ldmicro/reg/tests/avr-hw.ld
@@ -0,0 +1,61 @@
+LDmicro0.1
+MICRO=Atmel AVR ATmega128 64-TQFP
+CYCLE=10000
+CRYSTAL=4000000
+BAUD=2400
+COMPILED=C:\depot\ldmicro\reg\expected\avr-hw.hex
+
+IO LIST
+    Xinc at 2
+    Aanalog at 61
+END
+
+PROGRAM
+RUNG
+    COMMENT The more hardware-oriented ops (PWM, ADC, UART, EEPROM), test for the\r\nAVRs.
+END
+RUNG
+    PERSIST saved
+END
+RUNG
+    READ_ADC Aanalog
+END
+RUNG
+    PARALLEL
+        CONTACTS Xinc 0
+        GEQ Aanalog 512
+    END
+    OSR
+    ADD saved saved 1
+END
+RUNG
+    PARALLEL
+        SERIES
+            LES saved 10
+            MOVE duty 20
+        END
+        SERIES
+            GEQ saved 10
+            MOVE duty 50
+        END
+        SET_PWM duty 2000
+    END
+END
+RUNG
+    TON Tfmtd 1000000
+    OSR
+    FORMATTED_STRING saved 15 115 97 118 101 100 32 61 32 92 45 53 92 114 92 110
+END
+RUNG
+    MOVE char 'x'
+END
+RUNG
+    TON Tutx 2000000
+    OSR
+    UART_SEND char
+END
+RUNG
+    UART_RECV inchar
+    EQU inchar 'a'
+    MOVE saved 0
+END
diff --git a/ldmicro/reg/tests/contacts.ld b/ldmicro/reg/tests/contacts.ld
new file mode 100644
index 0000000..07dd6a1
--- /dev/null
+++ b/ldmicro/reg/tests/contacts.ld
@@ -0,0 +1,41 @@
+LDmicro0.1
+MICRO=Microchip PIC16F876 28-PDIP or 28-SOIC
+CYCLE=10000
+CRYSTAL=4000000
+BAUD=2400
+COMPILED=C:\depot\ldmicro\reg\expected\contacts.hex
+
+IO LIST
+    Xa at 2
+    Xb at 3
+    Xc at 4
+    Xd at 5
+    Xe at 6
+    Yf at 11
+    Yg at 7
+    Yh at 12
+END
+
+PROGRAM
+RUNG
+    COMMENT All types of contacts (NO, NC), and all types of coils (normal, inverted, set,\r\nreset); also test series and parallel combinations.
+END
+RUNG
+    CONTACTS Xa 0
+    COIL Yf 0 0 0
+END
+RUNG
+    PARALLEL
+        CONTACTS Xb 0
+        CONTACTS Xc 0
+    END
+    COIL Yg 0 1 0
+END
+RUNG
+    CONTACTS Xd 0
+    CONTACTS Xe 1
+    PARALLEL
+        COIL Yg 0 0 1
+        COIL Yh 1 0 0
+    END
+END
diff --git a/ldmicro/reg/tests/integers.ld b/ldmicro/reg/tests/integers.ld
new file mode 100644
index 0000000..d38a597
--- /dev/null
+++ b/ldmicro/reg/tests/integers.ld
@@ -0,0 +1,61 @@
+LDmicro0.1
+MICRO=Atmel AVR ATmega162 40-PDIP
+CYCLE=50000
+CRYSTAL=10000000
+BAUD=2400
+COMPILED=C:\depot\ldmicro\reg\expected\integers.hex
+
+IO LIST
+    Xa at 1
+    Yno at 16
+    Yok at 37
+END
+
+PROGRAM
+RUNG
+    COMMENT Test integer variable manipulations: move, arithmetic, comparison. Also test\r\na 50 ms cycle time, and the ATmega162 (odd timer register locations).
+END
+RUNG
+    PARALLEL
+        SERIES
+            CONTACTS Xa 0
+            MOVE a 1323
+        END
+        SERIES
+            CONTACTS Xa 1
+            MOVE a -12
+        END
+    END
+END
+RUNG
+    PARALLEL
+        ADD c a 1000
+        SUB d a 5
+        MUL e a 3
+        DIV f e 3
+    END
+END
+RUNG
+    PARALLEL
+        EQU a 1323
+        SHORT
+    END
+    PARALLEL
+        LES c 0
+        LEQ d 1318
+        SHORT
+    END
+    SHORT
+    PARALLEL
+        GRT c 20000
+        GEQ e 3969
+        OPEN
+    END
+    COIL Yok 0 0 0
+END
+RUNG
+    NEQ e -36
+    GRT a 0
+    TON Ton 1000000
+    COIL Yno 0 0 0
+END
diff --git a/ldmicro/reg/tests/misc-ops.ld b/ldmicro/reg/tests/misc-ops.ld
new file mode 100644
index 0000000..9fff1c4
--- /dev/null
+++ b/ldmicro/reg/tests/misc-ops.ld
@@ -0,0 +1,53 @@
+LDmicro0.1
+MICRO=Microchip PIC16F876 28-PDIP or 28-SOIC
+CYCLE=10000
+CRYSTAL=4000000
+BAUD=2400
+COMPILED=C:\depot\ldmicro\reg\expected\misc-ops.hex
+
+IO LIST
+    Xon at 2
+    Yalways at 3
+    Ain at 4
+END
+
+PROGRAM
+RUNG
+    COMMENT Little things: shift register, look-up table, master control relay.\r\n
+END
+RUNG
+    CONTACTS Xon 0
+    MASTER_RELAY
+END
+RUNG
+    CONTACTS Rosc 0
+    TON Ton 500000
+    TOF Tof 500000
+    COIL Rosc 1 0 0
+END
+RUNG
+    CONTACTS Rosc 0
+    SHIFT_REGISTER reg 7
+END
+RUNG
+    PARALLEL
+        READ_ADC Ain
+        MOVE reg0 Ain
+    END
+END
+RUNG
+    PARALLEL
+        SERIES
+            CONTACTS Rosc 0
+            CTC Ci 4
+        END
+        LOOK_UP_TABLE duty Ci 5 0 10 70 80 70 10
+        SET_PWM duty 10000
+    END
+END
+RUNG
+    MASTER_RELAY
+END
+RUNG
+    COIL Yalways 0 0 0
+END
diff --git a/ldmicro/reg/tests/pic16-hw.ld b/ldmicro/reg/tests/pic16-hw.ld
new file mode 100644
index 0000000..9c9ec46
--- /dev/null
+++ b/ldmicro/reg/tests/pic16-hw.ld
@@ -0,0 +1,61 @@
+LDmicro0.1
+MICRO=Microchip PIC16F877 40-PDIP
+CYCLE=10000
+CRYSTAL=4000000
+BAUD=2400
+COMPILED=C:\depot\ldmicro\reg\expected\pic-hw.hex
+
+IO LIST
+    Xinc at 2
+    Aanalog at 3
+END
+
+PROGRAM
+RUNG
+    COMMENT The more hardware-oriented ops (PWM, ADC, UART, EEPROM), test for the\r\nPIC16s.
+END
+RUNG
+    PERSIST saved
+END
+RUNG
+    READ_ADC Aanalog
+END
+RUNG
+    PARALLEL
+        CONTACTS Xinc 0
+        GEQ Aanalog 512
+    END
+    OSR
+    ADD saved saved 1
+END
+RUNG
+    PARALLEL
+        SERIES
+            LES saved 10
+            MOVE duty 20
+        END
+        SERIES
+            GEQ saved 10
+            MOVE duty 50
+        END
+        SET_PWM duty 2000
+    END
+END
+RUNG
+    TON Tfmtd 1000000
+    OSR
+    FORMATTED_STRING saved 15 115 97 118 101 100 32 61 32 92 45 53 92 114 92 110
+END
+RUNG
+    MOVE char 'x'
+END
+RUNG
+    TON Tutx 2000000
+    OSR
+    UART_SEND char
+END
+RUNG
+    UART_RECV inchar
+    EQU inchar 'a'
+    MOVE saved 0
+END
diff --git a/ldmicro/reg/tests/timers-counters.ld b/ldmicro/reg/tests/timers-counters.ld
new file mode 100644
index 0000000..867c6ff
--- /dev/null
+++ b/ldmicro/reg/tests/timers-counters.ld
@@ -0,0 +1,57 @@
+LDmicro0.1
+MICRO=Atmel AVR ATmega128 64-TQFP
+CYCLE=10000
+CRYSTAL=4000000
+BAUD=2400
+COMPILED=C:\depot\ldmicro\reg\expected\timers-counters.ld
+
+IO LIST
+    Xdown at 2
+    Xres at 3
+    Xup at 4
+    Ydown at 27
+    Ypulse at 46
+    Yup at 56
+END
+
+PROGRAM
+RUNG
+    COMMENT Test all the timers (TON, TOF, RTO) and counters (CTC, CTU, CTD), and the\r\nreset (RES) instruction. Also test one-shots.
+END
+RUNG
+    CONTACTS Rosc 0
+    TOF Tof 100000
+    TON Ton 100000
+    COIL Rosc 1 0 0
+END
+RUNG
+    CONTACTS Rosc 0
+    CONTACTS Xup 0
+    CTU Ccnt 20
+    RTO Trto 10000000
+    COIL Yup 0 0 0
+END
+RUNG
+    CONTACTS Rosc 0
+    CONTACTS Xdown 0
+    CTD Ccnt 10
+    COIL Ydown 0 0 0
+END
+RUNG
+    CONTACTS Xres 0
+    PARALLEL
+        OSR
+        OSF
+    END
+    RES Trto
+END
+RUNG
+    CONTACTS Rosc 0
+    CTC Ccirc 7
+END
+RUNG
+    EQU Ccirc 3
+    OSF
+    TOF Tpulse 200000
+    COIL Ypulse 0 0 0
+END
-- 
cgit