StarMicronics TCP Series Card Reader is driver to communicate with Card Reader model such as TCP300/310 and etc of Star Micronics Co., Ltd.(Japan).
<Figure 1> is read setting example of StarMicronics TCP Series Card Reader driver.
<Figure 1> Read setting example of StarMicronics TCP Series Card Reader driver |
Device part of <Figure 1> input Com Port(COM1), Baud Rate(9600), Parity Bit(0), Data Bit(8), Stop Bit(1) respectively, according to device.
Also, you can set reading cycle of Status value(mSec unit, Default = 5000 (5 sec)), TCP Series model(0 : TCP300, 1 : TCP310, Default = 0) number and whether to use reading track data when cyclic reading(0 : Not use, 1 : Use, Default = 1) by classifying as comma( , ), at Option part.
Importance) StarMicronics TCP Series Card Reader communication driver is structured as sending Card Reading Command( 21(in case of TCP310 model), 22, 23(in case of TCP310 model)) automatically, in case of that Card wasn't inserted, by reading status value(no.59 command), by using the set status value reading cycle.
Device on characteristic, there is command which takes max 7 second after controlling command, therefore set the Read time out and Write time out as 8 sec.
StarMicronics TCP Series Card Reader communication driver's read schedule
1) STATION : Don't care. ( Set as 0 )
2) Command Type : Don't care. ( Set as blank )
3) Read Start Address : Don't care. ( Set as 0 )
4) Save Start Address for Communication Server : Saving start address of Communication Server.
Save addr + 0 : Status value which is read from the first track,
Save addr + 1 : Card current value which is read from the first track,
Save addr + 2 : Status value which is read from the second track,
Save addr + 3 : Card current value which is read from the second track,
Save addr + 4 : Status value which is read from the third track,
Save addr + 5 : Card current value which is read from the third track.
Save addr + 6 : Status value,
Save addr + 7 : Status value.
Save addr + 8 : Status value.
5) Read Size : Don't care. (Fixed to 1)
Reference) In case of TCP300 model, only the second track exists. Therefore the read value of card is saved at only memory save address + 2 ~ 3.
Read schedule example)
READ, , , 0, 10, 1,
Notice) You just write StarMicronics TCP Series Card Reader communication driver's read schedule as single line. (More than second line is ignored)
Also, read value is saved to same address position of WORD/FLOAT/DWORD memory, and save value is different according to memory type.
If you click the icon img width=23 height=21 src="./SM_TCP300.files/image003.jpg" v:shapes="_x0000_i1026"> in protocol option part at <Figure 1>, you can see the dialog box such as <Figure 2>. You can also set read schedule by using this part.
<Figure 2> Main command used from StarMicronics TCP Series Card Reader |
Also, you can set reading cycle of status value, TCP Series model number and whether to use reading track data when cyclic reading at 'Status Read Period', 'TCP Model is 310' and 'Read Track Data' area of <Figure 2>.
Write the value which is set directly to recorder, regardless of read settings.
Digital Write
Digital write and analog write have the same setting parameters except output value(0 or 1).
Analog Write
You can read/write and print etc the current value of card by using analog writing.
Analog write setting parameters are as follows :
1) PORT Connected communication port number. (Not COM number)
2) STATION Select whether to read the additional needed command parameter(Decide whether to use according to command, refer to <Table 1>) from file.
255 : Read command parameter from WorkDirectory\SCAN\comm%03d.ini file(%03d : PORT number ). ( Refer to <Table 3> for command writing method )
0, Etc : Use Extra1 contents as command parameter.
3) ADDRESS Command number of hexadecimal number unit. ( Refer to <Table 1> ~ <Table 3> )
4) Extra1 Enter the additional command parameter. (Decide whether to use according to command, Refer to <Table 1> and <Table 3>)
5) Extra2 Status value and read value, of each command(There is case that the read value area not exists according to command, Refer to <Table 1>).
Notice) Read value of StarMicronics TCP Series Card Reader communication driver is saved at same position of WORD/FLOAT/DWORD memory, and the saved value is different according to memory type.
<Table 1> is write command type and contents used at StarMicronics TCP Series Card Reader communication driver, and <Table 2> is description for the status value and contents, read from Card Reader.
Also, <Table 3> is description for input method of additional command parameter.
Command (Hexadecimal) |
Contents | Whether additional command | Type | Remarks |
21 ~ 23 | 1 ~ 3 Track Read | X | Magnetic
Stripe (Card contents setting) command |
Save the read value to position which is set at reading |
25 ~ 27 | 1 ~ 3 Track Read(Status with No Card) | |||
29 ~ 2B | 1 ~ 3 Track Buffer Read | |||
38 ~ 3A | 7 Bit 1 ~ 3 Track Data Setting | O Refer to <Table 3> (Except character) |
Extra2 + 0 : Status value
( Refer to <Table 2> ) |
|
3B ~ 3D | 1 ~ 3 Track Data Setting | |||
31 | Magnetic Strip Write | O (Number) |
||
32 | Magnetic Strip Write(No Card) | |||
40 | Print Buffer Clear | X | Print, Delete command | |
41 | Print Data Setting | O Refer to <Table 3> (Except character) |
||
42 | Internal Image Data 1 Expand | |||
43 | External Image Data Expand | |||
44 | Two-Byte External Character Font Register | |||
45 | single-Byte External Character Font Register | |||
46 | Delete + Print | O (Number) |
||
47 | ||||
48 | Delete | |||
49 | Image Buffer Clear | X | ||
4A | Embedded Image Data 2 Expand | O Refer to <Table 3> (Except character) |
||
4B | BMP File Register Internal Image 2 | |||
4D | External Data Expand | |||
50 | Card Discharge | O (Number) |
Card command | |
51 | Card Back Idle | X | ||
53 | Card Front Idle | |||
54 | Card Insertion Wait Status Cancel | |||
55 | Card Removal Wait Status Cancel | |||
5C | Card Ticketing | |||
58 | ROM Version Request | Information display command | Extra2 + 0 : Status value, Extra2 + 1 : Information for ROM version (Save to String memory only) |
|
59 | Status Request | Save the read value to position which is set at reading |
||
5A | LED, Buzzer Control | O Refer to <Table 3> (Except character) |
Extra2 + 0 : Status value ( Refer to <Table 2> ) |
|
5B | Cleaning Buffer Enable/Disable | O (Number) |
||
95 | Card Transport Count Request | X | Extra2 + 0 : Status value, Extra2 + 1 : Value of the number of read |
|
96 | Print Count Request | |||
52 | Cleaning Command | Cleaning command | Extra2 + 0 : Status value
( Refer to <Table 2> ) |
|
5F | Reset Command | |||
90 | Communication Setting | O Refer to <Table 3> (Except character) |
Etc command | |
91 | Model Setting | |||
9B | Media Setting | |||
<Table 1> Writing command type and contents used at StarMicronics TCP Series Card Reader communication driver |
Status Value |
Contents |
20h |
Normal |
22h |
No Target Card |
23h |
No Magnetic Strip or Other Error |
31h |
Parity Error |
32h |
No Start Code/End Code |
33h |
LRC Error |
34h |
Erroneous Character |
37h |
Magnetic Stripe Writing Error |
38h |
Card Jam |
40h |
Cover Open |
41h |
Invalid Command |
42h |
|
43h |
Erase Head Temperature Error |
45h |
EEPROM Error |
4Ch |
Non-Compatible BMP File Data |
51h |
Expand Buffer Overflow |
<Table 2> StarMicronics TCP Series Card Reader communication driver's status value and contents |
Character |
Description |
Remarks |
\x?? |
Sentence for inputting various control letter, ?? : Inputting hexadecimal between 00 and FF |
station = 255 : WorkDirectory\SCAN\comm%03d.ini command (%03d : PORT number, delete the file after reading ) station = 0 or Etc : Enter the command to Extra1
But, Enter command to single line. (In case of station = 255, first line of file) |
\n |
LF Character ( Same as 0A, \x0A ) |
|
\r |
CR Character ( Same as 0D, \x0D ) |
|
\t |
TAB Character ( Same as 09, \x09 ) |
|
Number(0 ~ 9), English(a ~ z, A ~ Z), Hangul, special letters etc |
Enter the letter |
|
<Table 3> Description for StarMicronics TCP Series Card Reader communication driver's input method of additional command parameter |
Write example 1)
Station:0 Address:0022, Extra1: Blank, Extra2:50
If you set as above and write analog value, you can save Card Reader device's Second Track current value to no.51 address and the read status value is saved at no.50 address connected with current communication port.
But, status value is saved only, when error occur.
Write example 2)
Station:0 Address:0039, Extra1:12345678, Extra2:100
If you set as above and write analog value, it saves data setting status(in case of 20h, normal setting) to no.100 address after setting Second Track data of Card Reader device connected with current communication port as 12345678.
Write example 3)
Station:0 Address:0031, Extra1:2, Extra2:110
If you set as above and write analog value, it saves writing status(in case of 20h, normal setting) to no.110 address after writing data which is set at Second Track of Card Reader device connected with current communication port.
Notice) If you want to output specified data to Card, 2 commands such as ex2) and ex3) have to be executed, in order. In other words, no.39 command and no.31 command have to be executed. (In case of Second Track)
Write example 4)
Station:0 Address:0041, Extra1:2\x2C0\x2C23\x2C Test letter 123, Extra2:120
If you set as above and write analog value, it saves data setting status(in case of 20h, normal setting) to no.120 address and set the printer letter of Card Reader device connected with current communication port as 2, 0, 23, test letter 123.
2, 0, 23 means position of vertical 0, 23 and sentence posterior last comma(,) is letter to print.
Write example 5)
Station:0 Address:0046, Extra1:1, Extra2:130
If you set as above and write analog value, it saves output status(in case of 20h, normal setting) to no.130 address after writing printer letter which is set at Card Reader device connected with current communication port, to Card.
When Extra1 value is 1, in case of that command is 46, Card return after normal printing.
Notice) If you want to print specified letter to Card, 2 commands such as ex4) and ex5) have to be executed, in order. In other words, no.41 command and no.46 command have to be executed. (Possible to set no.41 several times)
Write example 6)
Station:0 Address:0050, Extra1: Blank, Extra2:140
If you set as above and write analog value, it saves return result(in case of 20h, normal setting) to no.140 address after executing return command to Card which is inserted at Card Reader device connected with current communication port.
Connect basic power with communication cable of TCP300/310 device, as follows.
Communication cable connection
Connect general RS-232C(or USB) communication cable to RS-232C terminal(or USB terminal) of <Figure 3>.
<Figure 3> Appearance of connecting communication cable, basic power and etc to TCP300 device |
Basic power connection
Connect 220V AC power to power input part.
<Figure 4> is appearance of TCP300 card Reader device.
<Figure 4> TCP300 card Reader |
Because StarMicronics TCP Series Card Reader communication driver is method for reading and writing the value, etc which are input at Card, just by using writing command, it needs the script as follows.
Reference) AutoBase9 Project Example using TCP300 device : SM_TCP300.files\StarMicronics_TCP_Series_Example.zip
Reading card current value
To read Card current value, you can use by writing following script to Script Button.
$set_data22= 1; // Executing the Card data reading command, no.22 command(Reading Second Track data)
for(i = 0; i < 10000; i = i+1)
{
@TagCheckLoop();
if($status_22h != 0)
{ // Confirm that status value isn't 0.
i = 10000;
}
}
if($status_22h != 32)
{ // Confirm that status value isn't 32(20h)
@MessageBox("Card reading failure.\n Status value isn't 32(20h)", "Setting Error", MB_OK);
return;
}
Writing card value
To read Card current value, you can use by writing following script to Script Button.
@sprintf($set_data39.extra1, "%s", $EditBox_WT); // Save the sentence which is entered at EditBoxTemp editor box, as print data
$set_data39 = 1; // Executing the Card writing data setting command, no.39 command(Setting Second Track data)
for(i = 0; i < 10000; i = i+1)
{
@TagCheckLoop();
if($status_39h != 0)
{ // Confirm that status value isn't 0.
i = 10000;
}
}
if($status_39h != 32)
{ // Confirm that status value isn't 32(20h)
@MessageBox("Card writing data setting failure.\n Status value isn't 32(20h)", "Setting Error", MB_OK);
return;
}
$set_data31= 1; // Executing Card writing data command, no.31 command(Setting Second Track data)
for(i = 0; i < 10000; i = i+1)
{
@TagCheckLoop();
if($status_31h != 0)
{ // Confirm that status value isn't 0.
i = 10000;
}
}
if($status_31h != 32)
{ // Confirm that status value isn't 32(20h)
@MessageBox("Card writing data failure.\n Status value isn't 32(20h)", "Setting Error", MB_OK);
return;
}
Print to card
@sprintf($set_data41.extra1,"%s%s",$PrintDataString,$EditBox_PrintData);
$set_data41 = 1; // Executing printing data command, no.41 command
for(i = 0; i < 10000; i = i+1)
{
@TagCheckLoop();
if($status_41h != 0)
{ // Confirm that status value isn't 0.
i = 10000;
}
}
if($status_41h != 32)
{ // Confirm that status value isn't 32(20h)
@MessageBox("Card printing data setting failure.\n Status value isn't 32(20h)", "Setting Error", MB_OK);
return;
}
$set_data47= 1; // Executing printing command, no.47 command
for(i = 0; i < 10000; i = i+1)
{
@TagCheckLoop();
if($status_47h != 0)
{ // Confirm that status value isn't 0.
i = 10000;
}
}
if($status_47h != 32)
{ // Confirm that status value isn't 32(20h)
@MessageBox("Card printing failure.\n Status value is 32(20h)", "Printing Error", MB_OK);
return;
}