DSERIAL.G1A Version 2.04

The program is intended to send a sequence of impulses via the serial output connector of a CASIO fx-9860G/GII/GII-2 calculator. F. i. the program can be used to trigger the shutter of a CANON EOS camera repeatedly.
The program allows to set the width of one trigger-event in ms, the count of trigger-events, the duration between individual trigger-events (in s).

Since version 2.03 it is possible to count contact closures (transitions from high to low) at the serial input connector and to start the impulse-sequence by contact closure (transitions from high to low) at the serial input connector.
Since version 2.04 the external alarm detection loop can be configurered to rearm automatically. 
Additionally a time in ms can be defined to delay every impulse.

Important hint: applying electrical voltages, which do not comply with the MPU's specifications, to the calculator's external connectors, may damage the calculator.

The source included is for reference only. It should demonstrate, how to access the external serial contacts.

The 2.5 mm cable, which comes with the CASIO fx-calculators cannot be used with a CANON EOS, because tip and ring are wired cross-over. With a CANOS EOS it is necessary to use a cable with tip and ring connected straight through.

The user interface:

D-Serial main
F1: start
  starts the impulse-sequence. The program sends a number of trigger-events according to the setup (see F2: setup).
  Specified by the the setup-autooff-setting the calculator powers off after a certain time.
  This time is independent of the system auto power off time.

F2: setup
  stat: idle state 0="low" / 1="high" (for CANON EOS the idle state should be "high")
  width: impulse-width in ms.
  delay: duration between individual trigger-events in s.
  count: count of trigger-events to send.
  autooff: time in minutes until power off after a trigger sequence. Inactive if set to -1. 
           The external arlarm detection loop is rearmed automatically if autooff is set to -2.
  delay2: time in ms. Delay between trigger and impulse. 
          Only active if an impulse-sequence has been triggered by an external event (see F4).

  Examples:
    stat:1; width:30; delay:5; count:20; autooff:1
    The output idle state is high. Every 5 seconds the calculator sends a low-impulse of 30 ms width.
    After 20 impulses have been sent, the calculator waits 1 minute before turning power off.

    stat:1; width:30; delay:5; count:20; autooff:-1
    The output idle state is high. Every 5 seconds the calculator sends a low-impulse of 30 ms width.
    After 20 impulses have been sent, the calculator waits for a key to be hit and enters the main idle loop again.

    stat:1; width:30; delay:5; count:20; autooff:-2
    The output idle state is high. Every 5 seconds the calculator sends a low-impulse of 30 ms width.
    After 20 impulses have been sent, the calculator enters the idle loop again.
    If the sequence has been triggered by an alarm, the alarm detection loop (see F4) restarts.

F3: count
  counts high-to-low transitions at the serial input connector.
  (F. i. when using the 2.5 mm cable, which comes with the CASIO fx-calculators, 
   contact closure between tip and base would increase the counter)

F4: arm alarm
  starts the external alarm detection loop, which waits for a contact closure at the serial input connector. 
  If the contact closure is detected, the impulse-sequence is automatically triggered (see F1:start).
  If autooff is set to -2, the alarm is automatically rearmed after one impulse-sequence has been completed.

F6: debug
  when entering this function, the idle state is set to "high".
  F1: toggle idle state between "low" (<0.8V) and "high" (>2V).
  EXE: send a single impulse, the direction of which depends on the initial state, which can be toggled with F1. 
    If idle state is "high", then a "low"-impulse will be sent (the appropriate signal for the CANON EOS).
    If idle state is "low", then a "high"-impulse will be sent.
  Using UP/DOWN the impulse-width can be changed in 1 ms-steps.
  Using RIGHT/LEFT the impulse-width can be changed in 10 ms-steps.
  If autooff is set to -3 and delay2 is not zero, a 1 ms pre-impulse will be inserted to check for delay2 to work properly.

  The program saves the settings in the Main Memory.

If the D-Serial main dialog is active, the detected MPU-type is displayed in the upper right corner.
SH-7337=fx-9860G; SH-7355=fx-9860GII; SH-7305=fx-9860GII-2.

It is possible that the calculator's RTC (Real Time Clock) is not initialized, t. i. the RTC-registers contain some random values (f. i. after battery replacement). The timer-procedures of the program rely on a properly running RTC. If the program detects such a situation, the RTC is initialized to 01.12.2012 01:00:00 and some message is displayed.

