Click here to Order!

CANPIC

 

CANPIC CAN232 - Binary Commands

Binary Commands allows an application to interface to the CANPIC CAN232 adapter using 8-bit binary commands. This can decrease the number of characters (or bytes) that are required to execute a particular command. The following table lists the available binary commands and the format in which to use them. The commands are further explained in individual sections that follows.

 

Read CAN Register - E0

This command reads one of the CAN registers. Register address is offset from 0xf00.

Format of command from host to CANPIC CAN232;

  1. Command(hex) E0
  2. Register xx

Data returned from CANPIC CAN232;

  1. Value of register xx (0 to 255)

Write Register - E1

This command writes one of the CAN registers. Register is offset from 0xf00.

Format of command from host to CANPIC CAN232;

  1. Command(hex) E1
  2. Register xx
  3. Value yy

Data returned from CANPIC CAN232;

  1. Value of register xx (0 to 255)

 

Read Message Data Byte - E2

This command reads one of the message objects data bytes.

Format of command from host to CANPIC CAN232;

  1. Command(hex) E2
  2. Message # (1 to 10) mn
  3. Data Byte (0 to 7) db

Data returned from CANPIC CAN232;

  1. Value of data byte (0 to 255)

Write Message Data Byte - E3

This command writes one of the message objects data bytes.

Format of command from host to CANPIC CAN232;

  1. Command(hex) E3
  2. Message # (1 to 10) mn
  3. Data Byte (0 to 7) db
  4. Value (0 to 7) val

Data returned from CANPIC CAN232;

  1. Value of data byte written (0 to 255)

Set Baud Rate - E7

This command sets the baud rate. See above table in ASCII command for setting baud rate for values.

Format of command from host to CANPIC CAN232;

  1. Command(hex) E7
  2. Baud Index (0 to 18) br

Data returned from CANPIC CAN232;

  1. Baud Index selected

Get Baud Rate - E8

This command gets the baud rate index. See above table in ASCII command for baud rate for values.

Format of command from host to CANPIC CAN232;

  1. Command(hex) E8

Data returned from CANPIC CAN232;

  1. Baud Index selected

 

Configure Message Object - E9

This command configures the message object.

Format of command from host to CANPIC CAN232;

  1. Command(hex) E9
  2. Message # (0 - 19) mn
  3. Direction di 1=receive, 2=transmit, 0=Not Valid
  4. Identifier Type it 0=standard 11bit, 1=extended 29 bit
  5. Message Length ml 0 to 8
  6. Message ID id0 most significant byte
  7. Message ID id1 upper middle significant byte
  8. Message ID id2 lower middle significant byte
  9. Message ID id3 least significant byte

Data returned from CANPIC CAN232;

  1. Command E9 is returned

 

Read Message Object - EA

This command reads the message configuration.

Format of command from host to CANPIC CAN232;

  1. Command(hex) EA
  2. Message # (0 - 19) mn

Data returned from CANPIC CAN232;

  1. Direction di 1=receive, 2=transmit, 0=Not Valid
  2. Identifier Type it 0=standard 11bit, 1=extended 29 bit
  3. Message Length ml 0 to 8
  4. Message ID id0 most significant byte
  5. Message ID id1 upper middle significant byte
  6. Message ID id2 lower middle significant byte
  7. Message ID id3 least significant byte

 

Set Message Send Time - EB

This command sets the message send time for a message object.

Format of command from host to CANPIC CAN232;

  1. Command(hex) EB
  2. Message # (0 to 19) mn
  3. Most significant byte of send time mt
  4. Least significant byte of send time lt

Data returned from CANPIC CAN232;

  1. 1 if ok, 0 if error (Message # greater than 19.


Read Message Send Time - EC

This command reads the message send time for a message object.

Format of command from host to CANPIC CAN232;

  1. Command(hex) EC
  2. Message # (0 to 19) mn

Data returned from CANPIC CAN232;

  1. Most significant byte of send time
  2. Least significant byte of send time

Send/Receive Message Send Time - C0 to D2

Once a message object is configured as either a trasnmit or receive type message, a single byte command (C0 to D2) will trigger it to transmit or return the latest received values.

For example, if message object 5 is configure as a transmit message, a C5 command will set the message to transmit. Conversely, if the message object 3 is a receive message, a C3 command will return the contents of the message.

Format of command from host to CANPIC CAN232;

1. Command(hex) C0 to D2

Data returned from CANPIC CAN232 will depend on the message configuration. An invalid message (one that is not configured) will return 0.

Transmit Message

1. Message type 1

Receive Message

1. Message Type: 2

2. Address ID Type: 0=11 bit, 1= 29 bit

  1. ID Msb
  2. ID Middle Upper
  3. ID Middle Lower
  4. ID Lsb
  5. Data Length
  6. 8..x Data bytes

 

 

 

 

 

 

   

Copyright © 2002 Embedded Micro Software  |   Site Map  |  Contact Us