Honorable Mention ($250.00) - Terry Hitt (Shiremanstown, Pennsylvania)
Notes from the judges:
- More information on how the code works would have been helpful considering the complexity of the timing issues.
- Really neat - Parallax should be selling these to their customers.
- Good use of SX resources and reduction of component count. Nice to see code for SX/ASM and SX/B as well as the BS2.
Downloads for this project:
All files and information © 2005 Terry Hitt.
This project uses the Ubicom SX processor running at 50MHz to generate NTSC video signals creating a character display on a TV or monitor. The program receives serial data to create the video display. This hardware is available for sale from the creator at the SX Video Module web site along with additional documentation and support.
The video module creates a display of 6 lines each consisting of 16 characters. Each character is 8 pixels wide and 8 pixels high. Since the 6 lines of 8 pixels high is only 48 video lines each line is repeated 4 times for a total of 192 active video lines.
NTSC video output is a fairly simple format, much like serial data, only much faster. NTSC uses 3 different voltage levels for black and white output, instead of two like serial data. The required levels are 0volts (sync), 0.3volts (black) and 1.0volts (white). The official specs for NTSC are quite rigid, but I have found that strict adherence to the spec is not needed. Here is the timing used by this design.
Vertical Sync = sync level for 393uSeconds Horizontal Sync = sync level for 5uSeconds Video Line = 65.6uSeconds including horizontal sync Lines per Frame = 262 lines per frame (non-interlaced)
In order to create a stable video display the hsync pulses must start at EXACTLY the same time in each line. To accomplish this, each line is generated by an interrupt routine. Actually the interrupt routine takes a majority of the processor’s time. The main program runs during the vertical sync and black top and bottom lines.
Serial input is sampled at the beginning of each video interrupt (which occurs every 65.6uSeconds). The sampled data is processed at the end of each video line, just before the interrupt ends. You NEVER have to wait for the module to process serial data, even the “clear screen” and “invert screen” commands are fast enough that data will not be lost.
The interrupt handles processing the serial input, reading the character values from the vline arrays, looking up the character pattern in the data block, toggling the pins to generate the video signal, and toggling the audio output pin is a “bell” is active.
The serial data is received at a baud rate of 4800 8N1. Received data values from 16 to 127 and 144 to 255 are simply display characters. Values from 0 to 15 and 128 to 143 are commands, some commands require extra data that is send immediately following the command. For example GotoXY command must be followed by the X value then the Y value. Commands for values from 0 to 15 are the same as the DEBUG commands, and the constants for DEBUG can be used.
The Null (128) value is useful to send at startup just in case a multi-byte command (like GotoXY) was send without the parameters, the next value sent will be interpreted as the parameters instead of the command intended. The Null value is ignored.
Video output must be connected to a RCA connector that is plugged into any video input (TV, VCR, DVD). Video inputs have an impedance of about 75 ohms, this is needed to get the correct voltage from the module.
Audio output has a resistor so the pin will not be damaged if the audio pin is accidentally shorted. Because of the resistor the audio output pin can be connected directly to a speaker.
Also eight of the unused SX pins are brought out and there is a serial command to set the output states. This gives you eight additional output that can be used for other purposes. These really come in handy if the module is receiving data from a wireless receiver.
Specs: Power: 5VDC 95mA Display: 6 lines by 16 characters Graphics: 32 horizontal, 12 vertical (1/4 block characters) Characters: 224 including upper & lower case and inverse
Special Features: Invert Screen 8 Digital Outputs.