J91 ARC50

ARC50

ARCbus 8025-AH BASIC CPU

User’s Manual

Section

  1. Introduction
  2. Circuit Description
  3. Links and Options
  4. Memory Map
  5. Using the ARC50
  6. EPROM Programming
  7. Attaching a Printer
  8. The Real-Time Clock
  9. Battery backing RAM
  10. ARCbus and Parallel I/O Interfaces

Appendix

  1. Connections
  2. Component List
  3. Specification
  4. Circuit Diagram

© Arcom Control Systems Ltd 1987


Scan of a board with RTC, battery and EPROM-programming components omitted.


1. Introduction

The ARC50 is a single board computer designed for use on the ARCbus or for stand-alone control purposes. The board is based around the Intel 8052 processor. This contains an 8k BASIC interpreter, including floating point and scientific arithmetic. The BASIC provides in-built commands to program EPROMs, and the board supports 8 or 16k byte EPROMs (2764 or 27128). This facility allows the user to develop and debug programs in RAM, and when satisfied to save the program by saving it in an EPROM. The EPROM can also be programmed so that on a reset the 8052 automatically executes the saved program.

For use in a control environment the board is provided with a battery-backed-up real-time clock chip (Motorola 146818), two 8-bit parallel I/O channels (one for input the other for output) and an ARCbus interface.

The real-time clock can be read and set from BASIC, and can generate interrupts at specified times. The two 8-bit parallel I/O ports and some I/O lines from the 8052 are brought out to a 50-way connector at the front of the board. This connector has a standardised pin configuration which is used on other I/O boards in the ARCbus and STEbus ranges, and fits the growing range of digital signal-conditioning boards which Arcom manufacture. The range Includes opto-isolator, Darlington driver and power control boards, and is expanding rapidly. The ARCbus interface allows access to Arcom’s extensive range of industrial I/O boards, including digital I/O, analogue I/O, IEEE interface and video boards.


2. Circuit Description

The 8052 is a member of the 8051 series of microcontrollers, which may either use their ports as address lines to access external memory, or fetch program instructions from internal memory and use these lines as input or output ports. The 8052 is a particularly clever application of this feature. The processor spends most of its time running a BASIC interpreter in its internal 8k ROM. The ports are used as external memory address pins to read the BASIC text. When programming an EPROM, these pins are used as ports, to latch the EPROM address and data while the 8052 switches the programming voltage and executes timing loops in internal ROM. Hence an EPROM may be programmed from the same socket in which it appears in the memory map.

IC14 controls the reset of the ARC50 and the ARCbus. During reset, IC14 disables the EPROM programming voltage, and turns off the opto-isolator IC15 to disable chip selects to battery-backed RAMs. Neither the EPROM or the programming power supply need be removed before switching on or off.

REG1 regulates the power for the socket containing IC6. REG1 normally provides 5V, but may be raised to 6V to allow the verification of fast-programmable EPROMs. REG2 provides the programming voltage, which is switched by TR2 and TR3.

The ARCbus is not accessed as a 32k block, but as pages of 256 bytes. ARCbus address lines and BRW (Bus Read/Write) are latched by IC19. Data lines are read in through IC20, and buffered onto the bus by IC20. IC7 controls the ARCbus signals and decodes chip selects of on-board memory and latches.

IC12 is the CPU, an 8052 as supplied. Its on-board serial interface lines are buffered to RS232 levels by IC9 and IC5.


3. Links and Options

In this section it is assumed that you are looking at the component side of the board with the Euro-connector to the right.

Note:
‘+’ indicates the standard jumpering, as supplied
‘*’ indicates a signal is active low.

Link positions

Link area 1. Fast/Normal Programming

+ LK1A FAST programming
  LK1B normal programming 

Link area 1.

o
A
o
B
o

Link area 2. Vpp control

The user should not need to modify this link unless it is necessary to change the EPROM programming voltage from 21 V or to test that 21 V really is available. Making LK2B enables the EPROM programming voltage. This should only be done on test and setting up. LK2A is the normal position, where the 8052 controls the VPP enable circuitry.

+ LK2A	Vpp under 8052 control
  LK2B	Vpp enabled for test 

Link area 2.

o A o B o

Link areas 3 to 5. IC3 device type

+ LK5A IC3 pin 27 from 8052 WR* (for RAM)
  LK5B IC3 pin 27 from 5V (for EPROM)
+ LK4A IC3  CE from 8052 RD*
  LK4B IC3  CE from 8052 PSEN*
  LK3A IC3 CS2 from inverted PWM
+ LK3B IC3 CS2 from 5V rail

Link 3 selects the source of the active high chip select (CS2) of IC3, if IC3 is a RAM chip. LK3B ties CS2 to +5V so the chip can be selected normally. LK3A connects CS2 to the inverse of the 8052 PWM line. The 8052 PWM line is made an input on reset, so in this mode the 8052 is prevented on reset from overwriting the contents of IC3 (see Section 6 for more details).

Link 4 connects the OE* line of IC3 to RD* (LK4A) or PSEN* (LK4B) of the 8052. LK4B should only be made if machine code routines are being run in IC3.

Link 5 Selects the source of pin 27 of IC3 LK5A to the 8052 WR* line for RAM, LK5B (+5V) for EPROM.

Link 6. IC3 CS Pullup

Making this link allows the battery to pull up the CS line of IC3, necessary for battery backup operation.

Link area 7. IC3 power source

+ LK7A IC3 power from +5V supply 
  LK7B IC3 power from battery backed supply

Selects the power source of IC3:
LK7A =+5V,
LK7B =Battery.
LK7A should only be made if IC3 is a static RAM chip.

Link area 7.

o A o B o

Link area 8. INT0 source

INT0 from CTS line of IC5
c18 of Arcbus
a28 of 50 way I/O connector

Selects the source of the INT0 line to the 8052:
LK8A = CTS line of IC5,
LK8B = c18 on ARCbus,
LK8C = a28 on the 50 way I/O connector.

Link areas 3 to 5

o 5A o 5B o
o 4A o 4B o
o 3A o 3B o

LK8A
LK8B
LK8C

o A o B o
Link area 8.
    o
    C
o B o
    A
    o

 

 


4. Memory map

StartEndContents (external memory accessed by XBY)
00001FFF8K RAM
20003FFF8K RAM
40006BFFEmpty
6C006FFFInput port
70007CFFOutput port
740077FFRTC
78007BFFArcbus page latch
7C007FFFArcbus page data
8000BFFF8K or 16K EPROM
C000FFFFEcho of EPROM

5. Using the ARC50

To set up the ARC50, first provide power to the board (+5V, +12V, -12V). Use connector PL2 if using it in a stand-alone application, otherwise apply power via the ARCbus backplane. If you wish to program EPROMs then also supply +25 to +35V (unregulated) to connector PL4 (being sure to get the polarity right).

Connect the board to an RS232 terminal via connector PL3 (more details are given in Appendix A - Connectors); the terminal should be set for 8-bits, 1 stop bit, no parity, no handshake and have its baud rate set for 9600 or less.

The system is now ready to use. Switch on the power and hit the space bar a few times. The 8052 will then deduce the terminal baud rate and will type its sign-on message:

	*MCS51 (tm) BASIC V1 .0*
	READY

On booting up the 8052 sizes memory and clears it to all zeroes. To check all is well type:

	P.MTOP
	8191
	READY
	>

8191 is the answer for one 8k RAM present in IC11. You are now ready to try a few simple programs of your own.


6. EPROM Programming

The ARC-50 contains the necessary hardware to program 2764 and 27128 EPROMs located in IC socket 6. Resistors R5 and R22 are set to provide a programming voltage of 21 V. The 8052 provides the strobes necessary for programming. To do this it derives its timing from the crystal oscillator. Thus before programming the variable XTAL must be set to the correct value by the command:

	>XTAL=7372800

To save a program into EPROM (2764 or 27128) issue the command:

	>PROG
	1
	READY

The ‘1’ indicates that this is the first program saved in EPROM. An alternative to PROG is FPROG which uses an intelligent programming algorithm. In order to use this Link 1 must be set to the ‘A’ side.

To select a program stored in EPROM type (for example)

	>ROM 1

This makes program number 1 in the EPROM the executable program.

If you want to return to the RAM program type:

	>RAM

Whilst in the ROM mode it is NOT possible to edit the program. To enable the program to be edited copy the program from EPROM to RAM using the following command:

>XFER

This will copy the executable program (the one selected with a ROM command).

Note that this command overwrites the present program stored in RAM, so do not use it unless you have already saved your present program.

There are two useful variations on the (F)PROG command: (F)PROG1 and (F)PROG2.

(F)PROG1 saves the baud rate information in the EPROM. Hence on reset it is unnecessary to hit the space bar to boot the 8052. Note that (F)PROG1 saves only the baud rate information and not the present program.

(F)PROG2 does the same as (F)PROG1, but in addition after a reset it executes the first program stored in EPROM (i.e. it acts as though ROM1, RUN has been typed). This facility means that a target system does not require a terminal to start up.


7. Attaching a printer

The 8052 provides a second serial channel for a line printer output. To use this first assign the correct value to the variable XTAL (this value should be the crystal oscillator frequency in Hertz):

	>XTAL=7372800

Then enter the desired printer baud rate:

	>BAUD 1200

Note that if this command is omitted the baud rate is about one (!!) baud. Output can now be sent to the printer by using the LIST# and PRINT# commands.

NOTE: the 8052 chip does not provide a printer handshake. The CTS line is provided to allow users to write their own machine code routine to implement one if they so desire.


8. The Real-time Clock

The on-board real-time clock chip is based on the Motorola 146818 chip, and is battery-backed-up. Its base address is 7400H. The chip contains 14 registers to control the clock and 50 bytes of static RAM (from address 7C0EH to 7C3FH) which can be used to save important data on power down. The following program sets the clock at 11:29:00 AM and then prints out the time:

	10 B=7400H ;REM base address 
	20 XBY(B+4)=11 
	30 XBY(B+2)=20 
	40 XBY(B)=0 ;REM time=11:29:00 
	50 XBY(B+0AH)20H ;REM 32 kHz crystal 
	60 XBY(B+0BH)04H ;REM decimal mode 
	70 PRINT XBY(B+4),XBY(B+2),XBY(B) ;REM print present time 
	80 GOTO 70 

The XBY instruction performs PEEK and POKE operations to external data memory, line 50 sets the real time clock for a 32.768kHz crystal, line 60 indicates that the data is in binary (rather than BCD) form.

The following program shows how a BASIC program can handle interrupts from the real-time clock on the INT1 pin:

	 10 B=7400H ;REM base address of RTC 
	 20 XBY(B+0AH)=20H ;REM 32 kHz crystal 
	 30 XBY(B+0BH)=84H ;REM disable clock, select decimal mode 
	 40 XBY(B+4)=10 
	 50 XBY(B+2)=30 
	 60 XBY(B)=0 ;REM time=10:30:00 
	 70 XBY(B+5)=10 
	 80 XBY(B+3)30 
	 90 XBY(B+1)=30 ;REM alarm=10:30:30 
	100 XBY(B+0BH)=24H ;REM enable clock and alarm INT 
	110 ONEX1 500 ;REM interrupt routine 
	120 PRINT "SLEEPING"; 
	130 GOTO 130 
	500 PRINT "WAKE UP"; 
	510 X=XBY(B+0CH) ;REM read reg C to clear INT. 
	520 RETI

For further details on how to use the 146818, including generating waveforms and setting day/month/years see the Motorola data sheet. Some of the information from this data sheet is given in Appendix E.


9. Battery backing RAM

In certain applications (particularly in an industrial environment) it is desirable to save memory contents during a reset or power-down sequence. Unfortunately the first thing the 8052 chip does on reset is to determine how much memory it has - it does this by DESTRUCTIVELY scanning memory, which is zeroed. To overcome this problem the ARC-50 allows the user to jumper the power line of IC3 (RAM at 4000H-5FFFH) to the battery (Link 7), and to connect (via Link 3A) the chip-select (CS2) line through an inverter in IC8 to the 8052 PWM line. Jumpering the power to the battery should not be done if IC3 is an EPROM; this will result in excessive battery drain on power down. The PWM line is set to +5V on reset, hence the CS2 line is held low and the 8052 is unable to access IC3 - it thus only finds 16k of RAM and does NOT corrupt the contents of IC3. To enable the RAM to be accessed the user must switch the PWM line:

	> PORT1=0FBH

is the command to do this. Be careful to get this correct or you will affect other lines of Port 1 (e.g. EPROM programming) and may crash the processor. The contents of the RAM can now be read/modified by the user’s program (Note that the 8052 still believes it has only 16k of space for BASIC programs - type

	> P.MTOP

to verify this).


10. ARCbus and Parallel I/O Interfaces

The ARC52 provides two 8-bit parallel I/O channels for user interfaces. These are accessed by the XBY operator. The output channel is at address 7000H, this is a write-only LS374 chip capable of sinking 24mA and sourcing 2.6mA. The input read-only channel is at address 6C00H and is an LS245 buffer. The I/O lines of these two chips are taken out to the 50 way connector PL5 (see Appendix A -Connectors).

The ARCbus interface consists of ICs 19 and 20. Address line A15 on the ARCbus is held high, so ARCbus peripherals must reside in the top half of ARCbus memory (this is compatible with ARCbus memory maps on the ARCOM Z8 series boards).

To access the ARCbus two XBY instructions are needed. The first is a write to IC19 (at address 7800H) with address bits A8-14 and whether the access will be a read (D7=HI) or a write (D7=LO). The actual access is then made by an XBY operation to addresses 7000H-7CFFH, the lower 8 bits of this address also being the lower 8 bits on the ARCbus. For example the following program writes 52 to the ARCbus address 9733H and then reads address 0C382H.

	10 XBY(7800H)=97H—80H :REM write so D7 low 
	20 XBY(7C33H)=52 
	30 XBY(7800H)=0C3H :REM read so D7 high 
	40 PRINT XBY(7C82H) 

The following two subroutines read and write to address A (>8000H) on the ARCbus:

	100 REM write data contained in X to address A (>8000H)
	110 C=INT(A/256)-80H :REM get high byte (D7=0)
	120 XBY(7800H)=C
	130 C=C+80H
	140 D=A-(256*C) :REM get low byte
	150 XBY(7C00H+D)=X :REM write to ARCbus
	160 RETURN
	200 REM read data from address A (>8000H) into X
	210 C=INT(A/256) :REM get high byte, leave D7=1
	220 XBY(7800H)=C :REM write to ARC-page latch
	230 D=A-(256*C) :REM get low byte
	240 X=XBY(7C00H+D) :REM read ARCbus
	250 RETURN

A. Connectors

PL1. ARCbus 64-way a/c DIN41612

(for suitable backplanes refer to current catalogue).


B. Component List

IC1		74LS04
IC2,10,20	74LS245
IC3		RAM
IC4		MC146818 RTC
IC5		RS232 buffer
IC6		EPROM (not supplied)
IC7		PAL16L8A
IC8		PAL10L8
IC9		RS232 buffer
IC11,18		RAM	
IC12		8052-AH-BASIC
IC13,17,19	74LS374	
IC14		TL7705
IC15		PC829
IC16		74LS74

REG1		for 5V/6V from 12V rail
REG2		for 21V VPP from 25-35V input
TR1,2,4		NPN
TR3		PNP

C. MC146818 RTC Information

See MC146818 RTC datasheet.


D. Circuit Diagram