Date : Thu, 22 Jun 1995 16:15:41 +0100 (BST)
From : Mike Borcherds <borchrds.teaching@...>
Subject: no subject (file transmission)
The Analogue Port Connector
==========================
Sheila Addresses &C0 to &C2
The analogue to digital converter (ADC) chip provided in
the BBC microcomputer is a 10 bit integrating converter.
It has four input channels which can be selected under
software control. By applying a voltage of between 0 volts
and Vref to the channel inputs, a 10 bit binary number will
be generated which is directly proportional to the applied
voltage. Vref/2 would produce a 10 bit value of approximately
511. Vref itself corresponds to about 1023.
The analogue to digital conversion is initiated by writing
to the Data Latch/AD start register at Sheila &C0. Bits D1
and D0 together define which one of the four input channels
is selected. Bit D3 defines whether an 8 bit resolution or
a 10 bit resolution should occur. If set to 0 an 8 bit
conversion occurs, if set to 1 a 10 bit conversion occurs.
8 bit conversions typically take 4ms to complete whereas
10 bit conversions typically take 10ms to complete. Unless
high resolution is required, it is often better to use the
fast 8 bit conversion. If enabled, an interrupt will be
generated when the conversion is complete. This indicates
that valid data can be read from the ADC.
Bit 1 Bit 0 Channel number Designation
in MOS and BASIC
Master Joystick
0 0 1 left/right (low=right)
0 1 2 up/down (low=down)
Secondary Joystick
1 0 3 left/right (low=right)
1 1 4 up/down (low=down)
Relevant OSBYTEs which write to the ADC are &10, &11 and &BD
Writing to the ADC
There is one register in the analogue to digital converter
that can be written to.
Data latch and conversion start - Sheila &C0 Write only
Writing to this register will select the current input
channel and select an 8 or 10 bit conversion. The operation
of writing to this register automatically initiates a
conversion.
Bits 0,1 Define the input channel
Bit 2 Flag input, normally set to 0
Bit 3 8 bit mode = 0, 10 bit mode = 1
Bits 4-7 Not used
Reading from the ADC
There are 3 registers in the ADC which can be read directly,
the status register and two data registers.
Status register - Sheila &C0 Read only
Bits 0,1 Define the currently selected input channel
Bit 2 Not used
Bit 3 8 bit mode = 0, 10 bit mode = 1
Bit 4 2nd most significant bit (MSB) of conversion
Bit 5 MSB of conversion
Bit 6 0 = busy, 1 = not busy
Bit 7 0 = conversion completed, 1 = not completed
High data byte - Sheila &C1 Read only
This byte contains the 8 most significant bits of the
analogue to digital conversion.
Low data byte - Sheila &C2 Read only
Bit 7 to bit 4 define the four low order bits of a 12 bit
conversion. In 8 bit only mode, all four bits are inaccurate.
In 10 bit mode bits 7 and 6 are accurate. Bits 5 and 4 are
likely to be inaccurate but this will depend upon the
particular qualities of individual 7002 chips. Bits 3-0
are always low.
OSBYTEs &80, &BC and &BE are relevant when reading from the ADC
Hardware Connections for a Joystick
8 7 6 5 4 3 2 1
__________________________
\ o o o o o o o o /
\ o o o o o o o /
\____________________/
15 13 11 9
(view into analogue port connector)
Pin Function in dual joystick setup
Pin 1 +5V (unused)
Pin 2 0V (unused)
Pin 3 0V (Connects via fire button 2 to pin 10)
Pin 4 CH3 (Connects via Pot to pin 11)
Pin 5 Analogue ground (Connects via Pot to pin 11)
Pin 6 0V (Connects via fire button 1 to pin 13)
Pin 7 CH1 (Connects via Pot to pin 14)
Pin 8 Analogue ground (Connects via Pot to pin 14)
Pin 9 LPSTB (unused)
Pin 10 PB1 (fire button 2)
Pin 11 Vref
Pin 12 CH2 (Connects via Pot to pin 11)
Pin 13 PB0 (fire button 1)
Pin 14 Vref
Pin 15 CH0 (Connects via Pot to pin 14)
CB1 Input to system VIA
bit 4 of interrupt flag register, ?&FE4D
This is the end of conversion signal (EOC) from the 7002
The Fire Buttons
These can be read from bits 4 and 5 of port B on the
System VIA (ie bits 4 and 5 of ?&FE40).
These bits are normally at logic 1 with no button pressed
and change to 0 when a button is pressed.
OSBYTE &80 can also be used to read their status.