summaryrefslogtreecommitdiff
path: root/ldmicro/reg/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ldmicro/reg/tests')
-rw-r--r--ldmicro/reg/tests/avr-hw.ld61
-rw-r--r--ldmicro/reg/tests/contacts.ld41
-rw-r--r--ldmicro/reg/tests/integers.ld61
-rw-r--r--ldmicro/reg/tests/misc-ops.ld53
-rw-r--r--ldmicro/reg/tests/pic16-hw.ld61
-rw-r--r--ldmicro/reg/tests/timers-counters.ld57
6 files changed, 334 insertions, 0 deletions
diff --git a/ldmicro/reg/tests/avr-hw.ld b/ldmicro/reg/tests/avr-hw.ld
new file mode 100644
index 0000000..f25da88
--- /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..efe35bf
--- /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..2beea69
--- /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..5197d9c
--- /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..7a47f5f
--- /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..606aac2
--- /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