Casio CFX-9950G Communications Protocol: Erik Grindheim, August October 2001
Casio CFX-9950G Communications Protocol: Erik Grindheim, August October 2001
This document describes the communication process for transferring individual values to
or from the graphic Casio calculators. Everything in this document is based on
experiments carried out with the CFX-9950G. Still the information should be valid for all
the compatible units that go into the so-called CFX-9850G series of Power Graphic
calculators from Casio.
The communication is initiated by the Casio when the Send( or Receive( command is
run. This transfers an individual value to or from one of the “Alpha Memory” variables.
These commands can also transfer Matrix data, List data and Picture data, but none of
these subjects are covered in this document.
Electrical:
The Casio-plug is a standard 2.5mm stereo jack with the following pin-designations:
Sleeve Ground
Ring Data to Casio
Tip Data from Casio
Baud-rate: 9600 bps
Parity: none
Byte-size: 8 bits
Stop-bits: from Casio: 2 bits
to Casio: 1 bit
This section describes the data blocks transferred when using the Send( function to send a
variable from the Casio to the outer world.
When the command is issued the Casio sends an “attention request”, one byte: 0x15. Then
the external device must reply with a “device present”, one byte: 0x13. If the Casio doesn’t
receive this byte (0x13) within 0.5 ~ 1 second there will be a timeout and the Casio displays
the Com ERROR message.
When the first handshaking-procedure (0x15 and 0x13) is over the Casio starts to send the
Variable-description packet, which consists of 50 bytes.
The external device receives this and confirms with one byte: 0x06.
Then the Casio sends its Value packet, consisting of either 16 or 26 bytes. Packet length
depends on whether the variable also contains an imaginary part or not. If the variable has
never been assigned a value since the last reset of “Alpha Memory” this packet will not be
sent at all.
The external device also receives this packet and confirms with 0x06.
(If an empty variable is sent, then there is no Value packet, and this byte is not sent either.)
To close the communication cycle the Casio sends an End packet of 50 bytes. The end packet
is always the same; none of the bytes change their value.
The diagram at the next page clarifies how the process is carried out:
0x15
0x13
Variable-
description
packet
0x06
Value
packet
0x06
End
packet
This section describes the data blocks transferred when using the Receive( function to read a
variable from the outer world into the Casio.
When the command is issued the Casio sends an “attention request”, one byte: 0x15. Then
the external device must reply with a “device present”, one byte: 0x13. If the Casio doesn’t
receive this byte (0x13) within 0.5 ~ 1 second there will be a timeout and the Casio displays
the Com ERROR message.
When the first handshaking-procedure (0x15 and 0x13) is over the Casio starts to send the
Request packet, which consist of 50 bytes.
The external device receives this and confirms with one byte: 0x06.
The Casio confirms (that it’s ready for a Variable-description packet) with one byte: 0x06.
Then the external device sends a Variable-description packet (consisting of 50 bytes). Byte
12 in this packet (variable name) seems to be totally ignored by the Casio, as the variable is
stored under the name indicated in the Request packet anyway. Still it’s recommended to
send back the same name/byte as received in the Request packet byte 12.
Again the Casio confirms that it’s ready (for a Value packet or an End packet, depending on
byte 9 and 11 in the previous packet) with one byte: 0x06.
A Value packet is then sent from the external device. It is still consisting of either 16 or 26
bytes, depending on whether the variable also contains an imaginary part or not. If the
variable is empty this packet is not sent at all (length: 0 bytes). This means that the actual
“Alpha Memory” variable in the Casio is deleted. This will free 10 (real) or 20 (complex)
bytes of memory in the Casio. In calculations the deleted variable’s value equals zero (0).
If a Value packet was sent then the Casio confirms (as usual) with a 0x06.
(If the variable is empty there is no Value packet, and this byte is not sent either.)
To close the communication cycle the external device sends an End packet of 50 bytes. The
end packet is always the same; none of the bytes change their value.
The diagram at the next page clarifies how the process is carried out:
0x15
0x13
Request
packet
0x06
0x06
Variable-
description
packet
0x06
Value
packet
0x06
End
packet
There are four different types of data packets in use to transfer variables, in addition to the
single-byte packets. This section describes the structure of these packets in detail:
Request packet:
Variable-description packet:
15 Exponent, 00-99
Exp.: Byte:
+99 99 \
+01 01 -} byte 14 bit 0 = 1 (High) **
00 00 /
-01 99 \
-02 98 -} byte 14 bit 0 = 0 (Low)
-99 01 /
16 Checksum
= 01+not((sum bytes 1-15)-3A)
-99
The smallest value the Casio accepts is ± 1.00000000000000 × 10
+99
The greatest number the Casio accepts is ± 9.99999999999999 × 10
+00
Zero is stored as + 0.00000000000000 × 10
+EE
Or, at a general form: ± I.decimals × 10 .
In the Value packet, byte no. 6 is containing the integer part I, always from 0x01 to 0x09
(except if the variable value is exactly 0,0…). Bytes no. 7 to 13 contain the 14 decimals
represented as BCD data. The exponent EE is represented in byte no. 15 and bit 0 of the
SignInfoByte (byte no. 14). The sign indicating whether the value is negative or positive is
held in bits 6 and 4 of the SignInfoByte.
26 Checksum
= 01+not((sum bytes 1-25)-3A)
End packet:
Checksum calculation:
As an example I’ll show how the checksum of the End packet is calculated. This value will
always remain the same since nothing in this packet changes from time to time; everything is
constant. First we add all the previous 49 bytes. This gives us a sum of 0xE4 (the excess
carry digits are thrown away). Then we subtract 0x3A and the result is 0xAA. We invert it
(=0x55) and add 0x01. The result is 0x56, which is the correct checksum-byte; byte no. 50.
The only way for an external device to initiate communication with the Casio is if the
calculator is already in LINK-mode and F2 is pressed (F2: Receive). Then the external device
must start the communication by sending a 0x16. This is not covered further in this
document.
If the Casio receives an incorrect packet (something is wrong or un-logical; for instance a
value packet of 26 bytes, complex number, is transferred when the Casio expects a real value
with packet length of 16 bytes) then the Casio immediately transmits a 0x22 to inform that
the communication is aborted. It also displays the Com ERROR message. Whenever an
error occurs in the communication process the Casio shows this message and transmits a
0x22 byte.
It is possible to release memory by sending empty/un-used variables (no value packet, and
bytes 9 & 11 with value 0x00) into the Casio. An un-used variable takes 0 byte, a real value
takes 10 bytes and a complex value takes 20 bytes of memory.
Byte 12 in the Variable-description packet is totally ignored by the Casio, as the transferred
value is stored in the variable first indicated by byte 12 in the Request packet anyway. It is
not possible to change any other variables than the one indicated by the Casio in the Request
packet.
This document:
Revision: 1.2
Date: 07 October 2001
Author: Erik Grindheim
You can contact me by e-mail if you have any suggestions, comments or additional
information regarding the Casio calculators’ communications protocol that you want to share
with me and the rest of the world.
________________
Erik Grindheim
[email protected]