83Plus:Ports:3A
This port only exists as a distinct port on the TI-83 Plus Silver Edition, the TI-84 Plus, and the TI-84 Plus Silver Edition. On the standard TI-83 Plus, it acts as a shadow of port 02. |
Contents
Synopsis
Port Number: 3Ah
Function: GPIO Read/Write
This port appears to be for GPIO reading/writing. It's used for USB stuff, battery voltage testing, and on the TI-84+CSE, controlling the backlight. Port 39h appears to be the GPIO setup register. More work is needed to figure out what hardware these GPIO pins interface with. This port does not exist on the TI-83+SE, which does not have any GPIO.
On known hardware revisions for all TI-84+/C/SE, the upper four bits are wired for output and the lower four bits are for input. So, write F0 to port 39 for correct GPIO operation. Attempting to repurpose bits is unlikely to have a useful effect unless you modify the hardware. (And the OS likes to write F0 to 39 on a regular basis, so your changes won't stick long-term.)
TI-84+/SE Old hardware
Read Values
- Bits 0-2 - Used for USB related stuff
- Bit 3 - Set
- Bits 4-7 - Unknown
Write Values
- Bits 0-2 - Used for USB related stuff
- Bit 3 - No effect
- Bit 4 - Set after using port 04 to check batteries but then reset
- Bits 5-6 - Unknown
- Bit 7 - Set before using port 04 to check batteries
TI-84+/SE New Hardware
Read Values
- Bits 0-3 - Reset
- Bits 4-7 - No significance
Write Values
- Bits 0-3 - Unchangeable
- Bits 4-7 - Quirky (no effect)
TI-84+CSE
Bit | Input/Output? | Description |
0 | I | Unknown, possibly USB (Vbus?) related |
1 | I | Unknown, possibly USB (Vbus?) related |
2 | I | Unknown, possibly USB (Vbus?) related |
3 | I | Unknown, possibly USB (Vbus?) related |
4 | O | Unknown |
5 | O | Controls backlight; see below. |
6 | O | Unknown |
7 | O | Unknown, set when testing battery level, then reset. |
The TI-84+CSE backlight level is controlled by bit 5. To turn the backlight off, reset bit 5 and leave it off. To turn the backlight on, set bit 5 and leave it on. As long as you want the backlight on, you should keep bit 5 set, except when you want to change the backlight level. When you turn the backlight on, it will reset to the brightest level. To reset the backlight to the brightest level, reset this bit for at least 3 ms (2 seems to work, but 3 is probably safer). To dim the backlight one level, reset this bit for a few hundred clock cycles. Each pulse will dim the backlight one level. There are 32 levels, from full brightness to off.
Comments
The purpose of the lower 3 bits is unknown. Someone with a model (none) or A calculator will have to do some testing. If the old USB hardware is present, most of the USB ports work differently.
On the old hardware, port 39h also seems to be tied to the functions of this port.
Another way to check for the old USB revision is to check port 15h for the value 44h.
The correct way to toggle an output bit is to first read from port 3A, then do a bitmasking operation, and then write the new value. This way you won't accidentally change the value of any other outputs. For example,
PulseBacklight: ; Reset bit 5 in a, (3Ah) and 0DFh out (3Ah), a ; Wait a while ld b, 80h djnz $ ; Set bit 5 again in a, (3Ah) or 20h out (3Ah), a ret