Jonathan A Titus Microcomputer Pioneer
Mark-8 Design Microcomputer According to Titus Microcontroller Project Postscriptum Lessons Home

Lesson 9: Pico Input/Output

The Pico is designed as a gaming device, so the I/O pins are assigned to devices that receive simple inputs from a user and to output primitive graphics and sounds to a television. Some of the remaining pins are mapped to an array of LEDs (or 7-segment display) to help with debugging the system. More specifically, the input device is a standard ATARI controller, and the outputs are to the yellow and white components of an RCA jack.

Port Configuration
The Pico's SX-28 Processor is equipped with x pins that are configurable for either input or output. To configure the ports, you must specify what they initialize to and their direction, input or output. As an example, the video and audio (RC) register is initialized below at the start of your code:
mov rc, #%00000000 ;Port C output zero
mov !rc,#%00000000 ;Port C all output

They should be initialized at the start of the code so that their behavior is predictable when the system is reset.

Controller Input
The one main source of input that the Pico has is an ATARI joystick. The joystick is directly connected with the RB register of the SX-28. Up, down, left, right, and fire are mapped to the first five bits of the RB register. The last 3 bits of RB are unused by the controller so may be used in other ways such as storage or additional I/O devices. Controller Button SX-28 Register
Controller Button SX-28 Register
Up RB.0
Down RB.1
Left RB.2
Right RB.3
Fire RB.4

LED Output
The four LEDS are mapped to first four bits of the RA register. The upper 4 bits of the register do not have pins mapped to them and can only be used for storage purposes. An expansion upon the LEDs in the Pico 2.0 Expansion is a 7-segment display which displays the numerical equivalent of the contents of the lower 4 bits of the RA register within the constraints of the display.

Audio/Video Output
The RC registers are mapped to audio and video output. The lower 4 bits are used for video and the upper 4 are used for video. Video output is based on which television standard is being output to since the timings for and number of scan lines differ between standards.
NTSC Standard PAL Standard
Lines/Fields 525/60 625/50
Horizontal Frequency 15.734 kHz 15.625 kHz
Vertical Frequency 60 Hz 50 Hz
Color Subcarrier Frequency 3.579545 MHz 4.433618 MHz

A program written to display the same thing on both television standards would have to take into account the number of scan lines and vertical frequency for displaying along the Y axis as well as the horizontal frequency for the X axis. The Pico ships with two oscillators, an 80 Mhz as well as an 78.750 Mhz one. 78.750 is roughly 22 times the NTSC color subcarrier frequency and is designed to make it more simple to output in color. With either oscillator, you will most likely be making liberal use of the nop instruction to synchronize your program with the frequencies of your respective television standard.

Copywrite Florida Gulf Coast University 2007
Validate CSS Validate XHTML