HP Forums
Battery check through IL? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: General Forum (/forum-4.html)
+--- Thread: Battery check through IL? (/thread-22474.html)



Battery check through IL? - born2laser - 10-09-2024 11:41 PM

I was assuming there would be one bit of the status byte you can request from HP-IL devices that would reflect the low battery status, after all there is an LED on the front panel that indicates that, and it is useful information to have.
But I found it is not listed in the translation of the status byte for neither the 82162A printer nor the 82161A cassette drive.
Am I missing it somehow?
Does anybody know of a way for the controller to know if a device in the loop is running out of juice?

Thanks,

Juan


RE: Battery check through IL? - rprosperi - 10-10-2024 01:46 AM

The 71B can get this data using the SPOLL (Serial Poll command, see pp. 189-192 of the 71B HP-IL Interface Module Owner's Manual, where it explains how to interpret the status byte, which includes low battery status. I don't know if the 41C can access this, but if it can, it's most likely possible using the Extended I/O Module.

The 71B HP-IL manual is here: https://literature.hpcalc.org/items/492


RE: Battery check through IL? - born2laser - 10-10-2024 04:40 AM

Hi Bob, thanks for the pointer, I think that is it and I can do it on the 41 with the INSTAT function in the basic IL module. The manual is not very helpful, it just says go find the meaning of those bits in the device manual, and the device manual does not give the meaning of the system status prescribed by the interface definition.
Low battery is Bit 0, so I guess they thought it important enough!

Juan


RE: Battery check through IL? - J-F Garnier - 10-10-2024 07:12 AM

(10-09-2024 11:41 PM)born2laser Wrote:  But I found it is not listed in the translation of the status byte for neither the 82162A printer nor the 82161A cassette drive.
Am I missing it somehow?

The 82161 and 82162 manuals both list the meaning of the status byte(s), but strangely there is no status state (for the 82161) or status bit (for the 82162) that reflects a low battery condition.

The 9114 disc drive is using almost the same status states than the 82161, but adds or changes some of them, and status state = 21 now means low battery.

J-F


RE: Battery check through IL? - rprosperi - 10-10-2024 12:28 PM

(10-10-2024 04:40 AM)born2laser Wrote:  Hi Bob, thanks for the pointer, I think that is it and I can do it on the 41 with the INSTAT function in the basic IL module. The manual is not very helpful, it just says go find the meaning of those bits in the device manual, and the device manual does not give the meaning of the system status prescribed by the interface definition.
Low battery is Bit 0, so I guess they thought it important enough!

Juan

Very good Juan, I have no memory at all of what the INSTAT function does. I've found HP-IL on the 41C to be quite slow and frustrating, so I really have not explored it in decades, and never in-depth. Having learned to use HP-IL first on the 71B, using it on a 41 is incredibly slow and limited, so I've never dug into anything but simple user-level features like copying tapes, program listings, etc.


RE: Battery check through IL? - Sylvain Cote - 10-11-2024 03:44 AM

Each HP-IL peripheral defined what it wants to publish and how to do it.
The HP-IL module function INSTAT (input status) is only able to get the first byte of the peripheral status byte array.
The HP-IL Extended-I/O module function STAT (read device status) is able to get the peripheral status byte array of up to 23 bytes long.

HP-IL loop test setup
Code:
Addr  Device
  0   HP-41
      PIL-Box-1 (pyILPER - IL Scope #1 - tracing outbound frames)
  1   82162A Thermal Printer
  2   82161A Cassette Drive
      PIL-Box-2 (pyILPER - IL Scope #2 - tracing inbound frames)
  0   HP-41

Example #1: the 82161A Cassette Drive publish a 1-byte status that contains the following ...
Code:
Status  Binary    Condition            Definition
  0-15  0000----  Idle Condition       No error and not executing a previous command.
    16  00010000                       Not used.
    17  00010001  End Of Tape Error    Unexpectedly reached end of tape.
    18  00010010  Stall Error          Tape has stalled.
    19  00010011  End/Stall Error      End Of Tape and Stall conditions.
    20  00010100  No Tape Error        No tape is installed in drive.
    21  00010101  Device Error         Device possibly requires service.
    22  00010110  Device Error         Device possibly requires service.
    23  00010111  New Tape Error       A new tape has been inserted but not positioned.
    24  00011000  Time Out Error       No data detected on tape.
    25  00011001  Record Number Error  Retrieved record number not as expected.
    26  00011010  Checksum Error       Computed checksum differs from expected.
    27  00011011                       Not used.                          
    28  00011100  Size Error           Specified track number greater than 1.
    29  00011101                       Not used.
    30  00011110                       Not used.
    31  00011111                       Not used.
 32-63  001-----  Busy Condition       Device is executing a previous command. (This is not an error.)

82161A Cassette Drive Status (1 byte) [no tape in drive]
Code:
2            ; 82161A Cassette Drive address
SELECT       ; make peripheral primary
INSTAT       ; HP-IL  / X=20   / 0x14 / 41 flags: 76543210 → 00010100 / No Tape Error 
STAT         ; Ext-IO / A="S " / status bytes encoded as string
ALENGIO      ; Ext-IO / X=2    / characters in ALPHA
0
ATOXX        ; Ext-IO / X=83   / "S" status identifier from STAT
1
ATOXX        ; Ext-IO / X=20   / 0x14 / 00010100 / peripheral status / No Tape Error

HP-IL messages tracing extract
Code:
IL Scope #1     IL Scope #2
ctrl → loop     loop → ctrl
------------    ------------
TAD 02 (442)    tad 02 (442)
RFC    (500)    rfc    (500)
SST    (561)    dab 14 (014)
DAB 14 (014)    eto    (540)
UNT    (45F)    unt    (45f)
RFC    (500)    rfc    (500)

Example #2: the 82162A Thermal Printer publish a 2-bytes status that contains the following ...
Code:
Status   __MSB___:__LSB___  Name  Definition
         76543210:76543210
  0:  1  00000000:00000001   LC   Lowercase, Set if printer is in Eight-Bit mode and set to lowercase mode.
  0:  2  00000000:00000010   CO   Column mode, Set if printer set to column mode.
  0:  4  00000000:00000100   DW   Double wide. Set if printer set to double wide mode.
  0:  8  00000000:00001000   RJ   Right justify. Set if printer set to right-justify mode.
  0: 16  00000000:00010000   EB   Eight bit. Set if printer is in Eight-Bit mode.
  0: 32  00000000:00100000   BE   Buffer empty. Set if no information is accumulated in print buffer.
  0: 64  00000000:01000000   ID   Idle. Set if printer is not printing.
  0:128  00000000:10000000   EL   End line. Set if carriage return was last byte received.
  1:  0  00000001:00000000   LA   Long advance.
  2:  0  00000010:00000000   PR   Print. Set while PRINT key is down.
  4:  0  00000100:00000000   PA   Paper advance. Set while PAPER ADVANCE key is down.
  8:  0  00001000:00000000   ER   Error condition. Set for out-of-paper or carriage jam.
 16:  0  00010000:00000000   MA   Print mode/jam. [MB:MA Description] [0:1 Trace] [0:0 Manual] 
 32:  0  00100000:00000000   MB   Print mode/jam. [MB:MA Description] [1:1 Jam]   [1:0 Normal] 
 64:  0  01000000:00000000   SR   Service request.
128:  0  10000000:00000000   --   Always zero.

82162A Thermal Printer Status (2 bytes)
Code:
1            ; 82162A Thermal Printer address
SELECT       ; make peripheral primary
INSTAT       ; HP-IL  / X=0     / 0x00 / 41 flags: 76543210 → 00000000 / we are loosing the status LSB value here
STAT         ; Ext-IO / A="S  " / status bytes encoded as string
ALENGIO      ; Ext-IO / X=3     / characters in ALPHA
0
ATOXX        ; Ext-IO / X=83    / "S" status identifier from STAT
1
ATOXX        ; Ext-IO / X=00    / 0x00 / 00000000 / peripheral status MSB / 
2
ATOXX        ; Ext-IO / X=96    / 0x60 / 01100000 / peripheral status LSB / ID and BE set

HP-IL messages tracing extract
Code:
IL Scope #1     IL Scope #2
ctrl → loop     loop → ctrl
------------    ------------
TAD 01 (441)    tad 01 (441)
RFC    (500)    rfc    (500)
SST    (561)    dab 00 (000) 
DAB 00 (000)    dab 60 (060)
DAB 60 (060)    eto    (540)
UNT    (45F)    unt    (45f)
RFC    (500)    rfc    (500)

edit: typos


RE: Battery check through IL? - born2laser - 10-11-2024 06:16 AM

Thanks Sylvain, your summary is what I had found from reading the manuals (as also pointed out by J-F) and motivated my initial post . There is no indication that either the printer or the tape drive report a low battery condition.
As I confirmed today (after working the tape to reduce the battery charge) the first byte returned (and checked with INSTAT) is always the device dependent status byte, as indicated in the manuals, bit 7 is always 0.
What had given me hope was this blurb in the manual for the HP71B HP-IL module

The first status byte sent by a device has special significance. If that byte is expressed as an eight-bit binary number, the bits have the following meanings:
* Bit 7 indicates the type of status represented by that byte.
“0” Device status.
“1” System status.
* Bits 6 through 0 indicate the condition of the device.
The state of bit 7 (the most significant bit) defines two ranges of status bytes:
o System status, which can have values from 128 through 255. The conditions indicated by bits 6 through 0 have been defined by HP-IL conventions.
o Device status, which can have values from 0 through 127. The conditions indicated by bits 6 through 0 are not defined in general—they’re defined differently for each device.

That made me think the first status byte (device) would be replaced in the right conditions by the system status referred to in the 71 manual, which I now come to realize was wishful thinking.
My only possible interpretation then is the choice of what to send as the first status byte is left to the device manufacturer, they can choose to send the "System" status, in which case they have to conform to the bit definition table set in the standard or send a custom defined byte, which is what HP did for all these.
Bottom line, there is no way to check for battery condition through HP-IL for my two devices, regardless if using a 41 or a 71.

Thanks for playing!

Juan


RE: Battery check through IL? - brouhaha - 10-11-2024 07:04 AM

The 82161A and 82162A, being the first shipped HP-IL peripheral products, were based on the then-relatively-cheap MK3870-series microcontrollers that had little program memory (probably 2KiB) and very little RAM (128.bytes, so the tape drive actually needed a separate 2114 (or equivalent) 1Kx4 RAM chip for the buffers). It is quite likely that the ROM was full before they got all of the features they wanted into these products, so some things had to be left out. These products were in development before the HP-IL specification was completed, so the battery state reporting in the system status byte may not have been defined by the time of the firmware freeze. There might not yet have been a defined system status byte at all.

When these started development, more advanced and capable single-chip microcontrollers such as the Intel 8051 and Motorola MC68HC11 families had not yet been introduced.

The 9114 floppy drive is an example of a later HP-IL peripheral with a much more complete and standard-compliant HP-IL implementation. In order to achieve that, they had to use a general-purpose microprocessor (Motorola MC6809) with separate RAM and EPROM, rather than a single-chip microcontroller.


RE: Battery check through IL? - rprosperi - 10-11-2024 12:10 PM

(10-11-2024 03:44 AM)Sylvain Cote Wrote:  Each HP-IL peripheral defined what it wants to publish and how to do it.
The HP-IL module function INSTAT (input status) is only able to get the first byte of the peripheral status byte array.
The HP-IL Extended-I/O module function STAT (read device status) is able to get the peripheral status byte array of up to 23 bytes long.

I'm glad that's the case as it means my gut instinct (aka ever weakening memory) was right about using the Ext-I/O to get the more detailed status. This implies I did this at some time in the 80's but have no recall what for, though almost certainly with my then-new 41CX and 82161A drive, just to what the status bits were...


RE: Battery check through IL? - born2laser - 10-11-2024 06:29 PM

(10-11-2024 12:10 PM)rprosperi Wrote:  I'm glad that's the case as it means my gut instinct (aka ever weakening memory) was right about using the Ext-I/O to get the more detailed status. This implies I did this at some time in the 80's but have no recall what for, though almost certainly with my then-new 41CX and 82161A drive, just to what the status bits were...

Bob, you were indeed correct and I thank you for trying to help. Turns out that the advantage of using the Ext-I/O module is being able to see more of the device response, instead of just the first byte, which for the case of the tape drive -the one I was most interested in- makes no difference whatsoever because it only returns one byte.

Juan