mainlogo.jpg (16286 bytes)

AN302

Answer MAN

Controlling Answer MAN with the Domino 2

2/20/00

Introduction: This application note demonstrates how to control the Answer Man using the Domino micro-controller.
 

Background: Answer MAN communicates via serial ASCII protocol at speeds as high as 57.6 kbps. Answer MAN's simple Query or Set command language reduces costly programming. Making a remote keypad/LCD terminal as simple as connecting the LCD and keypad to an Answer MAN.

 

How it works: By connecting the Answer MAN to the Domino via RS-485 they can communicate by sending ASCII commands and replies to each other. Below is Basic-52 code for a Domino connected to an Answer MAN with LCD/keypad interface. The Answer MAN’s configuration should be set to 2000H and have a name of MAN0. Please refer to the Answer MAN data sheet for connecting the LCD and keypad to the Answer MAN.

 

Program Listing:

10 REM *** This program demonstrates the Answer Man

20 REM *** controlled by the Domino 2.

30 MTOP=12288

35 REM *** Answer MANs response will be 14 characters so add 2

36 REM *** for the total bytes expr

40 STRING 16,14

50 REM *** Transmit Disable Assembly Routine

60 XBY(32000)=0C2H

70 XBY(32001)=0B4H

80 XBY(32002)=022H

90 REM *** Transmit Enable Assembly Routine

100 XBY(32003)=0D2H

110 XBY(32004)=0B4H

120 XBY(32005)=022H

130 REM *** Set up the Co-processor

140 R=30H : DT=0H

150 GOSUB 11000

160 CALL 32003

170 REM *** Have the Answer MAN print to the LCD

180 ?"! MAN0 S=**Micromints Alarm**"

190 ?"! MAN0 S=*****Enter your*****"

200 ?"! MAN0 S=**four digit pin #.*"

210 REM *** Read pin 22 of the Domino 2 for an intruder.

220 R=48H

230 GOSUB 10030

240 REM *** The switch is open, sound the alarm.

250 IF DT=1 THEN GOTO 690

260 REM *** Delay to be able to enter a code.

270 FOR X=0 TO 1000 : NEXT X

280 REM *** Enable the transmitter

290 CALL 32003

300 REM *** Ask Answer MAN to scan the Keypad.

310 ?"! MAN0 Q"

320 REM *** Disable the transmitter.

330 CALL 32000

340 REM *** Storing the Answer MAN response in a string.

350 INPUT $(0)

360 REM *** Taking the 4 digit pin number from the Answer MAN

370 REM *** response and storing them in variables A-D. In this

380 REM *** example the pin # is 1234. Since the Answer MAN

390 REM *** responds with the format $ MAN0 00 1234, we have to

400 REM *** store the response in a string and select what part of

410 REM *** the strings information we need by selecting it out of

420 REM *** memory. The mathematical equation for figuring out where

430 REM *** the string is stored in memory is(MTOP)-(total byte expr)

440 REM *** In this example. 12288-16=12272. We now have to add 10

450 REM *** because the Answer MAN inserts 10 bytes before the pin#

455 REM *** ($_MAN0_00_XXXX).Where X is the pin#. So we need to look

460 REM *** at memory location 12282 to 12285.

465 REM *** The following four lines do this.

470 A=XBY(12282)

480 B=XBY(12283)

490 C=XBY(12284)

500 D=XBY(12285)

510 REM *** The Answer MAN responds with ASCII characters.

520 REM *** Therefore a 1 is represented as 49 in ASCII.

530 IF (A=13.AND.B=0.AND.C=0.AND.D=0) THEN GOTO 220

540 IF (A<>49.OR.B<>50.OR.C<>51.OR.D<>52) THEN GOTO 690

550 REM *** Enable Transmitter

560 CALL 32003

570 REM *** Have the Answer MAN print to the LCD.

580 ?"! MAN0 S=\e[2J" :REM Clear the LCD display.

590 ?"! MAN0 S=You may enter."

600 REM *** Turn off the alarm.

610 R=50H : DT=0H

620 GOSUB 11000

630 REM *** Delay to allow entry into the secure area.

640 FOR X=0 TO 2000 : NEXT X

650 ?"! MAN0 S=\e[2J"

660 REM *** Start the process over.

670 GOTO 60

680 REM *** Enable the transmit

690 CALL 32003

710 ?"! MAN0 S=\e[2J"

720 ?"! MAN0 S=INTRUDER"

730 REM *** Delay to allow INTRUDER to flash on the LCD.

740 FOR X=0 TO 200 : NEXT X

750 ?"! MAN0 S=\e[2J"

760 REM *** Turn the alarm's buzzer on.

770 R=50H : DT=1H

780 GOSUB 11000

790 REM *** Start the process over.

800 GOTO 60

10000 REM ******************************************************

10010 REM Coprocessor Read Routine

10020 REM

10030 PUSH 2000H + R

10040 CALL 0F12Ch

10050 POP DT

10060 IF DT>255 THEN ?"Communicates error!!!"

10070 RETURN

10080 REM

10997 REM ***************************************************

10998 REM Coprocessor Write Routine

10999 REM

11000 PUSH 2000H+R,DT

11010 CALL 0F128H

11020 POP DT

11030 IF DT>255 THEN PRINT "Communications error !!!"

11040 RETURN

11050 REM

11060 REM ***************************************************