50
CY8CKIT-017 CAN/LIN Expansion Board Kit Guide, Doc. # 001-57814 Rev. *D
Code Examples
5.2
Code Example 2: CAN_Example_2
The CAN_Example_2 project is programmed into the second CY8CKIT-009 PSoC 3 processor mod-
ule making it a CAN node that can communicate with the CAN node created by programming
CAN_Example_1 into the first CY8CKIT-009 PSoC 3 processor module. Because CAN communica-
tion requires two CAN nodes, two projects are provided.
CAN_Example_2 has a CAN transmit message ID of 0x3FF and a receive message ID of 0x2FF.
The only difference between the two projects is the difference in their transmit and receive IDs. All
sections describing the CAN_Example_1 project also apply to the CAN_Example_2 project except
and
where the transmit message ID and receive
message ID are interchanged.
5.3
Code Example 3: LIN_Example
In the LIN_Example project, LIN Slave component is configured with a baud rate of 19200 and two
unconditional frames of eight bytes length. One frame is of type Subscribe for data reception and the
other frame is of type Publish for data transmission. The "InFrame" is of unconditional type with
Frame ID 0x10, eight bytes long and direction set to Subscribe. The "OutFrame" is of unconditional
type with Frame ID 0x11, eight bytes long and direction set to Publish.
It receives unconditional frame having eight bytes of data (Byte 1 is of scalar signal of 7-bit length
and Byte 2 to 8 has a byte array signal of 7-byte length) with Frame ID equal to 0x11. The same is
written to another unconditional frame. LIN master can read back the data by sending Frame ID
0x11.
LCD is used to display the user interface messages, and received and transmitted frames. The timer
is set to a period of 6 seconds and interrupt is generated on the Terminal Count (TC). This will be
used to change the user interface messages on LCD display.