3. Control command for decoder chip

Important: This chapter describes low level command for scanner control function. If you already USI to do scanner programming, you don’t need to care about this chapter. In general, it is not suggested to use level command to control scanner, because there are timing issue on serial communication programming , and it is always need communication expert to do that and it is hard to explain it on document.

When Host prepare to send a command to hamster, it must first check CTS, if CTS is high, then Host must set the RTS to high then clear RTS to low to wake up the Hamster.

Special Command for control

command

Format

Comment

Control

Esc,80H+SOH(01H)

Let Hamster enter slaving status. At this status Hamster just

 

 

receives commands and executes it until it receives Release

 

 

command or timeout (about 10s). Otherwise, the timeout is

 

 

about 1s as the interval of commands.

Release

Esc,80H+EOT(04H)

Let Hamster exit from slaving status.

Execute/

Esc,80H+ENQ(05H)

Let Hamster execute the previous saved command and check

Enquiry

 

hamster if there is a result of previous executed command to

 

 

send to Host. If previous saved command have already

 

 

executed and no result to send, hamster do not reply until

 

 

there is a result. If Host receive a result but the BCC is wrong,

 

 

it can re-send ENQ to re-send result again.

ACK

Esc,80H+ACK(06H)

It is from Hamster to Host. If Hamster receive a command and

 

 

this command do not need send message back, Hamster reply

 

 

the ACK.

NAK

Esc,80H+NAK(15H)

It is from Hamster to Host. Hamster require the Host to re-send

 

 

command again, normally when received a wrong BCC, it can

 

 

send the NAK. The Hamster sends back NAK whenever it

 

 

receives a no sense command.

COMMAND FROM HOST TO HMASTER

Command format:Esc,Lh,Ll,n,m,S1,...,Si,BCC Here: Esc is Escape code(H'1B)

Lh/Ll is command's length when the Lh.b7 is 0, Lh is high byte, Ll is low byte, count from n to BCC. When Lh.b7=1 it is a two bytes special command.

n is command ID

m is operation: Normally for setting commands the 0 means setting, 1 default, 2 read current setting, 3 special operation. When m=1 or 2, the S1 should be 0 for bits or one character setting. If the setting is a string, like pre_amble, the read or default command should not contain any Si byte. The special meaning in a command please refers the command definition.

Si is setting/read data.

BCC: it equals to XOR of all the bytes before the BCC.

Conventions: S1.bj means the number j bit of byte S1.

The expression 1~64:2 means that the number is between 1 and 64, the default is 2.

Notice: Any interval in a command transmit can not exceed 1 second.

Command

Format

Comment

Initial/ Warm

Esc,0,2,0,BCC

Hamster initializes the ports and flags according to the setting

start

 

in RAM.

Default

Esc,0,2,1,BCC

Reset setting in RAM and initialize

Mpu_idle

Esc,0,4,2,m,S1,BCC

S1 is 0~3:0 is sleep mode,1 is watch mode,

-

Page 16
Image 16
Unitech PA500 manual Special Command for control, Control command for decoder chip