Three versions are shown here, and
each of them can be used with
no software modifications. The first one, which contains resistors
only, is good enough for experimenting, but the third one, with
emitter-follower drivers, will give the best results. It is
recommended to add some 5V HCT or LS buffers for horizontal and
vertical sync (HC will not satisfy Vih level for 3.3V PIC MCU
signals). If you use hardware version 2, with 74HCT32 drivers,
note that it would not be possible to use neither 74HC32 (for the
same reason), nor 74LS32, as it would not satisfy the output
current characteristic for high logic level (Ioh).
The special care should be taken for the port pins selection.
Colour signal outputs (RGB foreground and RGB background) can use
the low portion of any output port, but the bit positions must
remain the same as it is shown on the schematics diagrams: bit 0,
1, 2 for Red, Green and Blue foreground and 4, 5 and
6 for Red,
Green and Blue background, respectively. Bits 3 and
7 of the same
port byte should not be used as outputs, as the routine will reset
them to low level during video signal generation, but may be used
as general-purpose inputs, special-purpose outputs (e.g. OC or
UART), or left unused. The high portion
(bits 8-15) of the same port may be used with no restrictions, as video
routine writes only to the low byte of that port.
At the
beginning of the source file, there is the line
which contains symbol named "rgb_port" and defines which
port will be used for RGB outputs. For instance, if you wish to
use the low portion of output port B, you should put:
.equiv rgb_port,LATB ; define RGB output port
here
The two following lines
in the source file (video.s) define which port and which bit
in that
port will be used for vertical sync output, and the next three
lines define the PS/2 keyboard inputs in the similar way. Be careful when deciding which input ports you shall use for those
inputs, as they
must be 5V tolerant. At the pinout drawings on the new
versions of data
sheets, Microchip marked those 5V tolerant pins
as gray, which makes the selection easier. It is also recommended
to select
pins which have internal pull-ups and to activate those pull-ups.
Find the line in the source file which contains symbol name
"CNPU2", as this is the place in which you have to
activate the pull-ups that you need. Another option is to use two
external pull-up resistors, about 4K7-10K each.
The selection of horizontal sync output is a little more
complicated. This signal is not generated by software, but by the
Output Compare 1 register. Some PICs have the ability to select
the output pin for that peripheral, but some do not. You have to
check the Data Sheet Manual for your microcontroller and see if it
has the Peripheral Pin Select (PPS) capability for output signals.
There is a simple way to check this - just look at the pinout
drawing and if you find the pin named OC1, that microcontroller
can not redirect peripheral outputs to some other pin and you must
use that (or some other OCx) pin for horizontal sync.
If your microcontroller has the Peripheral Pin Select option
for outputs, you can open the source file in this project and
find the line which contains register named "RPOR7" and
to employ it with the correct setting for your PPS option.
Although
it is possible to run the unit with the internal RC oscillator (FRC 7.37
MHz), it is strongly suggested to use external crystal
or ceramic resonator. The unit was tested with internal FRC and
it worked, but some TFT monitors could not keep good track with
the signal and had a hardly noticeable jitter at some pixels (the program lines for
FRC
initialization in the source file are kept, but commented out).
You can use any crystal or ceramic resonator between 3 and
10 MHz
in XT mode, and adjust PLL to obtain full speed of 80 MHz
(40 MIPS).
Generally, all you have to do is to write the new value in PLLFBD,
which you can calculate from the formula
320/Fq, where Fq is the crystal
or ceramic resonator resonant frequency in MHz.. In the source file, it is adjusted for
4 MHZ oscillator (320/4=80).
Note
1: External components for oscillator are not shown on the
simplified schematics diagrams.
Note
2: Vcc for all 24H PICs and dsPICs is +3.0 to
+3.6V. The recommended
way is to use some low-drop voltage regulator (BA033 or similar,
with +3.3V output) and to supply the whole unit with +5V DC. Ceramic and tantalum capacitors for proper Vdd
and Vddcore decoupling must also
be used. This is not shown on the simplified schematics diagrams.
|