To DSP3MV de YT3MV 19.03.90 18:24 GMT 21609 Bytes kr5600 *** Bulletin-ID: 193003YT3A *** De YT3MV @ YT3A YT3MV Rotator Controller Instruction Set - 17/03/1990 ===================================================== 1. RS-232 port -------------- The RS-232 interface is using the following data format: 9600 bps, 8 data bits, no parity, 1 or more stop bits both to receive commands and to send status reports. Commands are received via the RXD line. The DSR control line is used as a "data valid" signal and should be asserted (positive voltage) for the commands to be accepted. Both RXD DSR inputs accept RS-232 or CMOS (0 to +5V) signal levels. The status report is transmitted via the TXD line. The RTS line is asserted (positive) at all times power is applied to the rotator interface. Both TXD and RTS lines only supply signal levels between 0 and +5V. These are accepted by most RS-232 receiver chips. Some RS-232 receivers however require a negative voltage for one of the logic levels and can not be used without an additional logic-level converter. 2. Instruction set ------------------ All implemented instructions require a command byte to be sent to the rotator interface. The command byte may be followed by a parameter value byte. Unimplemented instructions (any other command bytes) will reset the rotator interface. A reset sets all of the variables to their default values (00H) and stops all activity of the rotator controller. Implemented instructions include: Command 50H: Transmit status report. A status report consisting of 20 data bytes will be transmitted to the host computer. No other commands are allowed while this command is being executed! No parameter byte should follow. The 20 data bytes include: #1 Read parallel port A #2 Read parallel port C #3 Read parallel port B #4 AZ voltage count #5 EL voltage count #6 VAUX1 voltage count #7 VAUX2 voltage count #8 RS-232 RX buffer write pointer (byte) #9 RS-232 RX buffer read pointer (byte) #10 Command status byte (1st command byte) #11 AZ flag: FFH=NEW_COMMAND, F0H=RIGHT, 0FH=LEFT, 00H=OFF #12 AZ: 8-bit value #13 AZ damping coefficient #14 AZ inertial coefficient #15 EL flag: FFH=NEW_COMMAND, F0H=UP, 0FH=DOWN, 00H=OFF #16 EL: 8-bit value #17 EL damping coefficient #19 EL inertial coefficient #19 AZ timer #20 EL timer Command 51H: Set AZ value. A parameter byte: desired azimuth count between 0 and 255 should follow. After the parameter byte is received, the rotator controller will start executing the command by issuing LEFT and RIGHT commands to the rotator control box. The concurrent execution of other commands, either previous or following, is not affected. Command 52H: Set EL value. A parameter byte: desired elevation count between 0 and 255 should follow. After the parameter byte is received, the rotator controller will start executing the command by issuing DOWN and UP commands to the rotator control box. The concurrent execution of other commands, either previous or following, is not affected. Command 53H: AZ damping coefficient. A parameter byte: azimuth damping coefficient between 0 and 255 should follow. The concurrent execution of other commands, either previous or following, is not affected. Command 54H: EL damping coefficient. A parameter byte: elevation damping coefficient between 0 and 255 should follow. The concurrent execution of other commands, either previous or following, is not affected. Command 55H: AZ inertial coefficient. A parameter byte: azimuth inertial coefficient between 0 and 255 should follow. The concurrent execution of other commands, either previous or following, is not affected. Command 56H: EL inertial coefficient. A parameter byte: elevation inertial coefficient between 0 and 255 should follow. The concurrent execution of other commands, either previous or following, is not affected. Command 57H: Set AUX outputs. A parameter byte specifying the three AUX outputs as the three low order bits should follow. The AUX outputs are reset by the command 50H as well. The concurrent execution of other commands, either previous or following, is not affected. 3. Rotator control algorithm ---------------------------- The rotator control algorithm operates in timing steps defined by the A/D conversions. During each time step the software performs 160 A/D conversions, lasting around 20msec. Elevation and azimuth voltage counts are obtained by averaging the result of 64 consecuitve conversions for each of them to eliminate noise. Each of these measurement cycles is preceeded by 16 voltage-settling cycles, yielding a total of 160 cycles. Both azimuth and elevation controls use the same algorithm that requires two different coefficients: damping and inertia. When an azimuth (51H) or elevation (52H) command is issued, the corresponding timer is reset and the desired value is checked against the actual voltage count. According to the result of the comparison, the rotator motor may be switched on. The timer is then incremented in each timing step. The actual difference between the desired and measured voltage count is computed and multiplied by the damping coefficient. If the multiplied difference is found smaller than the timer content, the rotator motor is stopped. The inertial coefficient defines the maximum count the timer is allowed to reach, beyond this point the timer will no longer be incremented. The damping coefficient defines the amount of time the motor will be turned on for a small correction. A too large damping coefficient will cause oscillations of the system. A too small damping coefficient will slow-down the system or prevent accurate tracking at all. The inertial coefficient is related to the maximum speed the rotator motor can reach. It should always be set larger than the damping coefficient. The inertial coefficient divided by the damping coefficient is the difference count limit beyond which the motor will remain on continuously, as long as the difference count will remain larger than this limit. All of the coefficients are set to zero initially and after any microprocessor reset. The coefficients should be set by the host computer before the azimuth (51H) or elevation (52H) commands are used, otherwise the rotator controller can not operate properly. Although it is sufficient to set the damping and inertial coefficients once, it is recommended to set them each time the rotator position is updated. 4. Software bugs ---------------- The present software has two bugs identified. Bug #1 is concerning an error-handling routine. In the case of a false start bit, the program executes a jump to the wrong location. The rotator interface will most likely be reset when this happens. The bug was not discovered before since these errors are extremly unlikely on a short, shielded RS-232 cable that is usually used between the host computer and the rotator controller. During normal use this bug has no effect on the controller performance. To correct this bug, the relative jump offset should be corrected (JR NZ,2BH in place of JR NZ,23H). Bug #2 is concerning the A/D data averaging routine. A wrong constant makes the controller much more sensitive to noise than the averaging routine could allow. This bug causes sometimes oscillations of the system that can not be dampened by adjusting the damping and inertial coefficients. To correct this bug, the initial constant used for averaging should be corrected (LD HL,0020H in place of LD HL,0000H). Both bugs were only discovered recently and will be corrected immediately in future releases of the rotator controller software. *************************************************************** YT3MV Rotator Controller Memory Map - 15/03/1990 ================================================ 1. Address decoding ------------------- 0000H - 1FFFH: EPROM 27C64 - 8 kbytes 2800H - 2FFFH: Parallel port uPD71055 - 4 locations used 3000H - 37FFH: RAM 6116 - 2 kbytes 6000H - 67FFH: ADC0804 - 1 location used Other addresses are not fully decoded and should not be accessed by the software! 2. Parallel port (uPD71055) bit assignments ------------------------------------------- Command register (write only) on 2803H, mode command byte 90H Port A (IN:2800H) Port B (OUT:2802H) Port C (OUT:2801H) ----------------- ------------------ ------------------ PA0 = INT ADC0804 PB0 = AUX OUT 1 PC0 = LEFT (-AZ) PA1 = Jumper 1 PB1 = AUX OUT 2 PC1 = RIGHT (+AZ) PA2 = Jumper 2 PB2 = AUX OUT 3 PC2 = DOWN (-EL) PA3 = Rotator PWR PB3 = NC PC3 = UP (+EL) PA4 = Jumper 3 PB4 = NC PC4 = VAZ PA5 = Jumper 4 PB5 = NC PC5 = VEL PA6 = DSR\ PB6 = NC PC6 = VAUX1 PA7 = RXD PB7 = TXD PC7 = VAUX2 3. RAM variables ---------------- 3000H: RS-232 RX buffer write pointer (byte) 3001H: RS-232 RX buffer read pointer (byte) 3002H: Command status byte (1st command byte) 3003H: AZ flag: FFH=NEW_COMMAND, F0H=RIGHT, 0FH=LEFT, 00H=OFF 3004H: AZ: 8-bit value 3005H: AZ damping coefficient 3006H: AZ inertial coefficient 3007H: EL flag: FFH=NEW_COMMAND, F0H=UP, 0FH=DOWN, 00H=OFF 3008H: EL: 8-bit value 3009H: EL damping coefficient 300AH: EL inertial coefficient 300BH: AZ timer 300CH: EL timer 300DH - 36FFH: System stack from 36FFH down, otherwise unused 3700H - 37FFH: RS-232 RX buffer (256 bytes) 4. A/D converter (ADC0804 or ADC0802) ------------------------------------- Start conversion: write to 6000H any byte Data ready: INT (PA0) signal low, high otherwise Read data: read byte from 6000H *************************************************************** **** Rotator control interface - 11/01/1988 ***** 310036 LD SP,3600H ! Initialize stack pointer & interrupt ED56 IM 1 C3A202 JP 02A2H * Transmit byte in A / 2 stop bits - RST1 - 0008H * F3 DI F5 PUSH AF CD7400 CALL 0074H F1 POP AF FB EI C9 RET * Command decode - RST2 - 0010H * F5 PUSH AF C5 PUSH BC CDCA00 CALL 00CAH C1 POP BC F1 POP AF C9 RET * Byte from A/D converter - RST3 - 0018H * C5 PUSH BC D5 PUSH DE CD9800 CALL 0098H D1 POP DE C1 POP BC C9 RET * Transmit status - RST4 - 0020H * E5 PUSH HL F5 PUSH AF CD4201 CALL 0142H F1 POP AF E1 POP HL C9 RET * Azimuth control routine - RST5 - 0028H * F5 PUSH AF C5 PUSH BC CD7A01 CALL 017AH C1 POP BC F1 POP AF C9 RET * Elevation control routine - RST6 - 0030H * F5 PUSH AF C5 PUSH BC CD0E02 CALL 020EH C1 POP BC F1 POP AF C9 RET * Subroutine INT / 9600 bps reception - 0038H * C5 PUSH BC F5 PUSH AF 0606 LD B,06H ! Start bit delay 10FE DJNZ FEH 3A0028 LD A,(2800H) ! Check for false start E680 AND 80H 202B JR NZ,2BH ! >>---> 0E08 LD C,08H ! Data bit counter 00 NOP 0610 LD B,10H ! One-bit delay <---<< 10FE DJNZ FEH 47 LD B,A 3A0028 LD A,(2800H) ! Read data bit 17 RLA 78 LD A,B 1F RRA 0D DEC C 20F1 JR NZ,F1H ! End of bit-loop >>---> 47 LD B,A 3A0030 LD A,(3000H) 4F LD C,A 78 LD A,B 0637 LD B,37H 02 LD (BC),A ! Byte to command buffer 0C INC C 3A0028 LD A,(2800H) ! Check DSR E640 AND 40H 2801 JR Z,01H 0D DEC C 79 LD A,C 320030 LD (3000H),A 060A LD B,0AH ! Stop-bit delay 10FE DJNZ FEH F1 POP AF ! <---<< False start C1 POP BC FB EI C9 RET * Transmit byte in A / 2 stop bits - 0074H (RST1) * C5 PUSH BC 4F LD C,A 3E00 LD A,00 ! Start bit 320228 LD (2802H),A 0611 LD B,11H ! Start-bit delay 10FE DJNZ FEH 79 LD A,C 0E0A LD C,0AH ! Bit counter 0F RRA ! <---<< 47 LD B,A E680 AND 80H 320228 LD (2802H),A 78 LD A,B F680 OR 80H 00 NOP ! One-bit delay 00 NOP 060F LD B,0FH 10FE DJNZ FEH 0D DEC C 20ED JR NZ,EDH ! Bit-loop >>---> C1 POP BC C9 RET 00 NOP ! Spare * Byte from A/D converter to A - 0098H (RST3) * E5 PUSH HL F5 PUSH AF 014010 LD BC,1040H ! Waiting 16 times, Averaging 64 times 1600 LD D,00H 212000 LD HL,0020H ! Initial constant for averaging AF XOR A 320060 LD (6000H),A ! Start A/D conversion / Waiting D7 RST2 ! Command decode? 3A0028 LD A,(2800H) ! End of conversion? E601 AND 01H 20F8 JR NZ,F8H 10F2 DJNZ F2H AF XOR A ! <---<< 320060 LD (6000H),A ! Start A/D conversion / Averaging D7 RST2 ! Command decode? 3A0028 LD A,(2800H) ! End of conversion? E601 AND 01H 20F8 JR NZ,F8H 3A0060 LD A,(6000H) 5F LD E,A 19 ADD HL,DE ! Result in HL 0D DEC C 20EC JR NZ,ECH ! Averaging loop >>---> 29 ADD HL,HL ! Multiply HL by 4 29 ADD HL,HL F1 POP AF 7C LD A,H ! Result to A E1 POP HL C9 RET * Command decode - 00CAH (RST2) * 3A0130 LD A,(3001H) ! Check for new command bytes? 4F LD C,A 3A0030 LD A,(3000H) B9 CP C C8 RET Z 0637 LD B,37H ! New command byte 0A LD A,(BC) 47 LD B,A 0C INC C 79 LD A,C 320130 LD (3001H),A 3A0230 LD A,(3002H) ! Check command status (1st byte?) A7 AND A 200E JR NZ,0EH ! >>---> 00 NOP ! Spare 78 LD A,B ! Check for valid command byte? E6F8 AND F8H FE50 CP 50H 2801 JR Z,01H C7 RST0 ! Reset on error: invalid command! 78 LD A,B 320230 LD (3002H),A ! 1st byte to command status byte C9 RET 4F LD C,A ! Second byte: argument value <---<< AF XOR A 320230 LD (3002H),A ! Reset status 79 LD A,C FE51 CP 51H ! Command 51H: Set AZ value 200A JR NZ,0AH 3EFF LD A,FFH 320330 LD (3003H),A ! Set AZ flag 78 LD A,B 320430 LD (3004H),A ! Set AZ value C9 RET FE52 CP 52H ! Command 52H: Set EL value 200A JR NZ,0AH 3EFF LD A,FFH 320730 LD (3007H),A ! Set EL flag 78 LD A,B 320830 LD (3008H),A ! Set EL value C9 RET FE53 CP 53H ! Command 53H: AZ damping coefficient 2005 JR NZ,05H 78 LD A,B 320530 LD (3005H),A ! Set AZ damping coefficient C9 RET FE54 CP 54H ! Command 54H: EL damping coefficient 2005 JR NZ,05H 78 LD A,B 320930 LD (3009H),A ! Set EL damping coefficient C9 RET FE55 CP 55H ! Command 55H: AZ inertial coefficient 2005 JR NZ,05H 78 LD A,B 320630 LD (3006H),A ! Set AZ inertial coefficient C9 RET FE56 CP 56H ! Command 56H: EL inertial coefficient 2005 JR NZ,05H 78 LD A,B 320A30 LD (300AH),A ! Set EL inertial coefficient C9 RET FE57 CP 57H ! Command 57H: Set AUX outputs 2007 JR NZ,07H 78 LD A,B F6F0 OR F0H 320228 LD (2802H),A ! Set lower 4 bits of Port B C9 RET C7 RST0 ! Reset on error * Transmit status - 0142H (RST4) * 210028 LD HL,2800H ! Port A 7E LD A,(HL) CF RST1 23 INC HL 7E LD A,(HL) ! Port C CF RST1 23 INC HL 7E LD A,(HL) ! Port B CF RST1 210328 LD HL,2803H 3609 LD (HL),09H ! AZ voltage count DF RST3 CF RST1 3608 LD (HL),08H 360B LD (HL),0BH ! EL voltage count DF RST3 CF RST1 360A LD (HL),0AH 360D LD (HL),0DH ! VAUX1 voltage count DF RST3 CF RST1 360C LD (HL),0CH 360F LD (HL),0FH ! VAUX2 voltage count DF RST3 CF RST1 360E LD (HL),0EH C5 PUSH BC ! Memory bytes (3000H) to (300CH) 060D LD B,0DH 210030 LD HL,3000H 7E LD A,(HL) CF RST1 23 INC HL 10FB DJNZ FBH C1 POP BC 3E00 LD A,00H 320230 LD (3002H),A ! Reset status byte C9 RET * Azimuth control routine - 017AH (RST5) * 3E09 LD A,09H ! Get AZ count from A/D converter 320328 LD (2803H),A DF RST3 4F LD C,A 3E08 LD A,08H 320328 LD (2803H),A 3A0630 LD A,(3006H) ! AZ inertia 47 LD B,A 3A0B30 LD A,(300BH) ! AZ timer B8 CP B 3001 JR NC,01H ! Increment timer if timer < inertia 3C INC A 320B30 LD (300BH),A 3A0330 LD A,(3003H) ! Check AZ flag A7 AND A 200B JR NZ,0BH 3E00 LD A,00H 320328 LD (2803H),A ! Stop if AZ flag =00H! 3E02 LD A,02H 320328 LD (2803H),A C9 RET FEFF CP FFH ! New AZ command? 2031 JR NZ,31H ! No new command >>---> AF XOR A 320B30 LD (300BH),A ! Reset AZ timer on new command 3A0430 LD A,(3004H) 91 SUB C 2005 JR NZ,05H ! New AZ equal? AF XOR A 320330 LD (3003H),A ! Reset AZ flag to 00H C9 RET 3810 JR C,10H ! New AZ greater? 3E00 LD A,00H 320328 LD (2803H),A ! LEFT OFF 3E03 LD A,03H 320328 LD (2803H),A ! RIGHT ON 3EF0 LD A,F0H 320330 LD (3003H),A ! Set AZ flag to F0H C9 RET 3E02 LD A,02H ! New AZ smaller? 320328 LD (2803H),A ! RIGHT OFF 3E01 LD A,01H 320328 LD (2803H),A ! LEFT ON 3E0F LD A,0FH 320330 LD (3003H),A ! Set AZ flag to 0FH C9 RET FE3F CP 3F ! AZ difference to A <---<< 3A0430 LD A,(3004H) 47 LD B,A 3004 JR NC,04H 79 LD A,C 90 SUB B 1801 JR 01H 91 SUB C 3001 JR NC,01H ! Zero if over AF XOR A D5 PUSH DE ! Multiply AZ difference with damping coeff. E5 PUSH HL 0608 LD B,08H 1600 LD D,00H 5F LD E,A 3A0530 LD A,(3005H) 210000 LD HL,0000H 29 ADD HL,HL 07 RLCA 3001 JR NC,01H 19 ADD HL,DE 10F9 DJNZ F9H 7C LD A,H ! Product MSB to A 45 LD B,L ! Product LSB to B E1 POP HL D1 POP DE A7 AND A C0 RET NZ ! Return on large difference >255 3A0B30 LD A,(300BH) ! AZ timer B8 CP B D8 RET C ! Return if difference larger than timer AF XOR A 320330 LD (3003H),A ! Reset AZ flag to 00H C9 RET * Elevation control routine - 020EH (RTS6) * 3E0B LD A,0BH ! Get EL count from A/D converter 320328 LD (2803H),A DF RST3 4F LD C,A 3E0A LD A,0AH 320328 LD (2803H),A 3A0A30 LD A,(300AH) ! EL inertia 47 LD B,A 3A0C30 LD A,(300CH) ! EL timer B8 CP B 3001 JR NC,01H ! Increment timer if timer < inertia 3C INC A 320C30 LD (300CH),A 3A0730 LD A,(3007H) ! Check EL flag A7 AND A 200B JR NZ,0BH 3E04 LD A,04H 320328 LD (2803H),A ! Stop if EL flag =00H! 3E06 LD A,06H 320328 LD (2803H),A C9 RET FEFF CP FFH ! New EL command? 2031 JR NZ,31H ! No new command >>---> AF XOR A 320C30 LD (300CH),A ! Reset EL timer on new command 3A0830 LD A,(3008H) 91 SUB C 2005 JR NZ,05H ! New EL equal? AF XOR A 320730 LD (3007H),A C9 RET 3810 JR C,10H ! New EL greater? 3E04 LD A,04H 320328 LD (2803H),A ! DOWN OFF 3E07 LD A,07H 320328 LD (2803H),A ! UP ON 3EF0 LD A,F0H 320730 LD (3007H),A ! Set EL flag to F0H C9 RET 3E06 LD A,06H ! New EL smaller? 320328 LD (2803H),A ! UP OFF 3E05 LD A,05H 320328 LD (2803H),A ! DOWN ON 3E0F LD A,0FH 320730 LD (3007H),A ! Set EL flag to 0FH C9 RET FE3F CP 3F ! EL difference to A <---<< 3A0830 LD A,(3008H) 47 LD B,A 3004 JR NC,04H 79 LD A,C 90 SUB B 1801 JR 01H 91 SUB C 3001 JR NC,01H ! Zero if over AF XOR A D5 PUSH DE ! Multiply EL difference with damping coeff. E5 PUSH HL 0608 LD B,08H 1600 LD D,00H 5F LD E,A 3A0930 LD A,(3009H) 210000 LD HL,0000H 29 ADD HL,HL 07 RLCA 3001 JR NC,01H 19 ADD HL,DE 10F9 DJNZ F9H 7C LD A,H ! Product MSB to A 45 LD B,L ! Product LSB to B E1 POP HL D1 POP DE A7 AND A C0 RET NZ ! Return on large difference >255 3A0C30 LD A,(300CH) ! EL timer B8 CP B D8 RET C ! Return if difference larger than timer AF XOR A 320730 LD (3007H),A ! Reset EL flag to 00H C9 RET * Program initialisation - 02A2H (RST0) * 3E90 LD A,90H ! Initialisation of uPD71055 320328 LD (2803H),A 3EF0 LD A,F0H ! Port B: AUX outputs & RS-232 320228 LD (2802H),A 0610 LD B,10H ! Initialisation of RAM variables 210030 LD HL,3000 3600 LD (HL),00H 23 INC HL 10FB DJNZ FBH * Main program loop * FB EI ! Enable interrupts D7 RST2 ! Command decode? 3A0230 LD A,(3002H) ! Transmit status command? FE50 CP 50H 2001 JR NZ,01H E7 RST4 ! Transmit status EF RST5 ! Azimuth control routine F7 RST6 ! Elevation control routine 18F3 JR F3H *** Program end *** YT3A >