Using the built-in AD converter and 15-pin IF I have constructed a
device for loading/unloading
recharchable batteries or Li-ion's.
The Sharp PC watches the voltage over AD and via pin of the 15-pin connector sends a signal to turn off the loading process.
Current is settable and trigger voltage is programmable.
While loading and unloading it watches the time and calculates capacity.
Basic instruction for reading analog input is simply: V=AIN. We get a digital level from 0 to 255.
Input voltage should be <= 2.5 V, otherwise we have to use a voltage divider.
Basic instruction for setting 15-pin port pins: OUTSTAT "COM1:",2 sets for instance RTS low(0) and DTR high(1).
Measured high(1) voltage: 6V, low(0) voltage: -8V
OUTSTAT port settings: ( from Operational manual )
0: RTS=1, DTR=1 (default)
1: RTS=1, DTR=0
2: RTS=0, DTR=1
3: RTS=0, DTR=0.
There is also a basic instructionINSTAT "COM1:", which returns the state of DTR, RTS, CTS, CD, DSR, CI
as a byte, where the bits from lowest digit position - DTR to highest digit position - CI indicate high/low settings of pins.