Difference between revisions of "83Plus:Ports:10"
m (Fixed a link) |
|||
Line 18: | Line 18: | ||
=== Write Values === | === Write Values === | ||
− | Writing this port sends a command to the LCD. Once you send a command, wait until bit 7 reads 0 before sending another. You need a minimum delay of 10 microseconds (60 cycles of whatever else on the 6MHz TI-83+, or ~150 on a TI-83+ Silver or any TI-84+ when running in [83Plus:Ports:20|fast mode]]). | + | Writing this port sends a command to the LCD. Once you send a command, wait until bit 7 reads 0 before sending another. You need a minimum delay of 10 microseconds (60 cycles of whatever else on the 6MHz TI-83+, or ~150 on a TI-83+ Silver or any TI-84+ when running in [[83Plus:Ports:20|fast mode]]). |
* 00 : Switch to 6-bit mode. ([[83Plus:Ports:11|Port 11]] transfers 6-bits at a time.) | * 00 : Switch to 6-bit mode. ([[83Plus:Ports:11|Port 11]] transfers 6-bits at a time.) |
Revision as of 05:08, 4 April 2005
Synopsis
Port Number: 10h
Function: LCD Command and Status Port
This port is used to check the status of and send commands to the TI-83+'s LCD Driver.
Read Values
The state of the LCD can be determined by reading this port.
- Bit 0: Set if auto-increment mode (commands 05 and 07) is selected, reset if auto-decrement mode (commands 04 and 06) is selected.
- Bit 1: Set if auto-increment or auto-decrement will affect the current column, or reset if auto-increment/decrement will affect the current row.
- Bit 2, 3: Not used.
- Bit 4: Set if in reset state, reset if in operating state. (Whatever that means.)
- Bit 5: Set if the display is enabled. Reset if disabled. (Note: LCD is completely turned off via Port 03h.)
- Bit 6: Set if the LCD will transfer 8 bits at a time through Port 11. Reset if the LCD will only trasfer 6 bits at a time.
- Bit 7: Set if the LCD is busy. Reset if a command can be accepted.
Write Values
Writing this port sends a command to the LCD. Once you send a command, wait until bit 7 reads 0 before sending another. You need a minimum delay of 10 microseconds (60 cycles of whatever else on the 6MHz TI-83+, or ~150 on a TI-83+ Silver or any TI-84+ when running in fast mode).
- 00 : Switch to 6-bit mode. (Port 11 transfers 6-bits at a time.)
- 01 : Switch to 8-bit mode. (Port 11 transfers 8-bits at a time.)
- 02 : Disable the screen. This blanks the screen and disconnects the LCD RAM from the physical screen, thus allowing you to use the LCD RAM as extra saferam. (But accessing it is so horribly slow that you should only do this if the usual saferam areas aren't enough and you don't need to display anything.)
- 03 : Enable the screen. This resumes displaying the LCD's RAM contents to the physical screen. (So any garbage you put into LCD RAM while it was off will show up, so B_CALL ClrLCDFull before this!)
- 04 : Set X auto-decrement mode. Every read or write operation from the data port will cause the LCD's internal pointer to move up one row.
- 05 : Set X auto-increment mode. Every read or write operation from the data port will cause the LCD's internal pointer to move down one row. The TI-83+ expects the LCD to be in this mode for most display routines.
- 06 : Set Y auto-decrement mode. Every read or write operation from the data port will cause the LCD's internal pointer to move left one column.
- 07 : Set Y auto-increment mode. Every read or write operation from the data port will cause the LCD's internal pointer to move right one column.
- [08~0B]: Set power supply enhancement. You'd be well advised to just leave this alone.
- [10~13]: Set power supply level. You'd be well advised to just leave this alone.
- [14~17]: Undefined.
- [18]: Cancel test mode (see Comments).
- [19~1B]: Undefined.
- [1C~1F]: Enter test mode (see Comments).
- [20~2E]: Set column when in 8-bit mode (command 01).
- [20~33]: Set column when in 6-bit mode (command 00).
- [34~3F]: Undefined.
- [40~7F]: "Z addressing" (It just changed what phyiscal row the top row of RAM is displayed on. The LCD will wrap the bottom of it's RAM to the top of the screen as needed.)
- [80~BF]: Set row.
- [C0~FF]: Set contrast. (C0 is lowest. Note that there is a System RAM area (contrast) for this which will need to be updated if you want 2nd+Up/2nd+Down to change the contast as expected (instead of causing a sudden jump...).)
Comments
As mentioned, a 10 microsecond delay is required after sending the command. TI provides a routine at 000B (use normal CALL, not BCALL) that will delay the required amount of time. In addition, this code sequence should also provide sufficent delay while also being non-destructive.
push hl ;15 push de ;30 pop de ;44 pop hl ;58 nop ;62
But I would advise you actually make use of these waste cycles somehow (process a buffer or something).
Test mode This is a very dangerous mode. The first test mode command (1C~1F) causes the screen to receive an unusually high amount of energy. The result is that the screen seems to go blank, save for a single blue(!) line. Each subsequent command adds more blue lines. After you've had your fill of blueness, exit test mode by sending a exit test mode command (18), which also sets the contrast to it's highest. Now why is it dangerous? Sure it looks cool to make a supposedly black and white LCD to display BLUE, but you are pumping so much energy through the LCD to get this effect that leaving it in this mode for too long can cause long-term damage. Ever left your monitor on for a day or two and forget to set a screen saver? Remember how when you turned it off a burnt image of your screen remained? Well that's what can happen if you leave test mode on for too long. Other possible side effects include "dead pixels" (pixels that stay off no matter what you do).
So don't use text mode okay? Just pretend you didn't hear about it...
Example
Turn the LCD "off" and back "on".
ld a, 02h out (10h), a push hl ;Or do something else that takes ~60 TStates. push de pop de pop hl nop inc a out (10h), a