Introduction: 65xx Technology- W65C02SXB Binary Counter LED Project
The binary number system plays a central role in how information of all kinds is stored on computers. Understanding binary can lift a lot of the mystery from computers, because at a fundamental level they’re really just machines for flipping binary digits on and off. To test and evaluate these circuits we will need to present digital bit patterns as inputs. In this project we build a circuit and write an 6502 Assembly program that generates and displays the binary value between (i.e. 0000 through 1111).
To provide a practical application of your knowledge of the binary number system and its relationship to Machine Language programming.To develop and implement a 6502 Xxcelr8r Assembly program to generate binary bit patterns and to build a simple circuit to display them. In this workshop you are tasked to implement and work with 6502 Assembly source code.
Things you will need :
Step 1: Making the Circuit
The schematic shows the physical layout of the circuit and its connection to the W65C02SXB board. In this version of the circuit we use pins on the peripheral I/O W65C22 VIA port B brought to the breadboard using a 8-wire connection. The positive side of four LEDs (longer leads) are attached to pins 24-17 as shown. The negative sides of these LEDs are connected through 330Ω resistors (we use a resistor array here) to ground. There is a vertical bar on the resistor array indicating the common lead. One end of each of the 330Ω resistors in this array are attached to this lead. Each of the other leads of the resistor array are connected to the other ends of the individual resistors.
To help with your own understanding and reference of the pins be sure to keep a copy of the datasheet handy.
Step 2: Binary Counter Program
The binary counter program will apply 5V (HIGH) and 0V (LOW) levels to four of the eight LEDs to generate all 16 possible bit patterns for the binary values between 0000 and 1111. In this sequence the least significant bit (LSB) is represented by the rightmost LED and is connected to pin 17. Each successive bit moving from right to left has a place value that is twice the previous bit (i.e. 1, 2, 4, 8) so that the bit pattern for the integer value 13 is 1101( 8x 1 + 4x 1 + 2×0 + 1×1 = 8 + 4 + 0 + 1 = 13).
Step 0: Before we start working with the code we need a good idea of the program approach. This program will use an integer array to hold the W65C02SXB pin numbers being used and will make use of for-loops where possible to reduce code size and complexity. Since the process of setting the pin output levels for a given binary value is a clearly defined sequence of operations we will encode this process in its own method to be called from the main program loop.
WDC GitHub Program: https://github.com/WesternDesignCenter/8LED_ASCII_VIA