> I haven't seen any code examples that read from a binary input, but is it safe to assume
> I just read instead of writing to get input from the same address?
Your source code should have the VIA addresses something like:
Code:
VIA: EQU $6000 ; VIA base addr (Depends on your hardware)
PB: EQU VIA+0 ; port B I/O
PA: EQU VIA+1 ; port A I/O
DDRB: EQU VIA+2 ; data direction register for port B
DDRA: EQU VIA+3 ; data direction register for port A
T1CL: EQU VIA+4 ; timer 1 counter low byte
T1CH: ; etc etc
T1LL:
T1LH:
...
To write to port B's output bits, just write to PB (which will be address 6000 in the case above). Input bits will remain unaffected by the write as long as they're left in input mode. To read port B (all 8 bits, whether input or output), just read PB (same address). Same goes for port A. There are several ways to deal with what you read, including (but not limited to) the following. To look at only certain bits after reading the port, you can AND-out the ones you don't want, or use the TSB or TRB instructions. You can shift or rotate and then branch on the carry flag, or (less likely) use the bit pattern as an index in a jump address table.
> whats the best way to get a 1 digit LED display to show a number, and
> if I later wanted to add a character LED how would that work?
Hardwarewise, the LCD is actually easier. LEDs will take a lot more output bits, and if you have very many digits, you'll want to multiplex it which will require constant strobing. For just one digit, you'll connect the common to ground (if common cathode) or to +5V (if common anode) and then connect each segment's pin through a resistor of say 470 ohms to an output pin of the VIA. If you get a lot of digits and you're not multiplexing the display, you'll do the least wiring work and the lowest bus loading if you use the VIA's shift register to feed a chain of 74HC595's. You could use 74HC164's too, but they don't have output latches, so all shifting is reflected at the outputs during actual shifting. With the shift register chain, you only use 2-3 pins of the VIA, and the software only pays attention to it when you're giving the display new information. That way it does not require the constant strobing. Maxim
www.maxim-ic.com does have a variety of LED driver ICs you might want to look into too. They have a serial input, all the current limiters, and take care of the strobing in multiplexed LED arrays too so you don't have to worry about that. They will have onboard character-gerator ROM too so your software doesn't have to look up which segments to light up.
> Guess I really need to start getting these parts and experimenting.
Beginners tend to do everything the hard way. Keep coming back to the forum and you should be able to save yourself some headaches. I "paid my dues" in the mid 80's. My first computer had an 8-digit non-multiplexed LED display. The wiring with the 8 shift registers and 64 current-limiting resistors (7 segments plus decimal point for each digit) was sure impressive, but the display was big, power-hungry, and not nearly as versatile and useful as a simple 16-character by 1-line LCD module. 7-segment displays can do either upper- or lower-case of most of the characters, but it's sure not user-friendly when you have to do things like make W to be an up-side-down A or figure out how to differentiate K from X.