86:Ports:01

From WikiTI
Jump to: navigation, search

Synopsis

Port Number: 01h

Function: Keyboard Port

This port reads key presses from the keypad. The keypad is divided into a series of groups.

See also TI-83 Plus Port 01, which is identical apart from the key labels & the lack of battery level detection.

Read Values

  • Bits are set according whether corresponding keys from selected groups are pressed. Groups are selected through writing to the port. A pressed key reads a 0 bit. An unpressed key reads a 1 bit.
  • Bit 0 will also read as 0 if groups 0-2 are all selected & the battery level is low.

Write Values

  • FFh : Reset the keypad. This unselects all groups and resets the keypad state.
  • F8h : Check battery level. This also selects keypad groups 0-2 for monitoring.
  • Anything else : Any 0 bit adds the corresponding group to the list of monitored groups. When a key in a monitored group is pressed, the corresponding key bit reads 0, otherwise it reads 1 (active-low).

Key Map

The key map is laid out as follows:

Group Bit 0 1 2 3 4 5 6 7
Group Mask FE FD FB F7 EF DF BF 7F
Key Bit (Mask)
0 (FE) DOWN ENTER (-) . 0 F5
1 (FD) LEFT + 3 2 1 STO F4
2 (FB) RIGHT - 6 5 4 , F3
3 (F7) UP * 9 8 7 x2 F2
4 (EF) / ) ( EE LN F1
5 (DF) ^ TAN COS SIN LOG 2nd
6 (BF) CLEAR CUSTOM PRGM TABLE GRAPH EXIT
7 (7F) DEL x-VAR ALPHA MORE
  • Note: Group FB Key FE is NEGATE, not to be confused with SUBTRACT.
  • Note: Group DF Key FE would be ON, but the ON key is tested through Port 03, bit 3.

Comments

  • The OS delays about 1400 cycles (100 iterations of a tight DJNZ loop) when checking the battery level at startup, which is much longer than used to test if keys are pressed.
  • Bit 0 will be 0 when testing the battery level if the warning message would appear. However, because it is still also wired to the keypad, holding any of DOWN, ENTER, or (-) when turning the calculator on will also cause the warning message to appear.