58
CY3274 Cypress High Voltage Programmable PLC Development Kit Guide, Doc. # 001-53598 Rev. *G
Code Examples
iii. Set P0[1] according to the settings shown below. A switch connected to this pin will be used
to start, halt, resume or restart transmission if the kit is selected to be in transmitter mode (by
P0[7]) or to reset the received packet count if the kit is selected to be in receiver mode.
7. Open the PSoCGPIOInt.asm file and TickTimerINT.asm file located in the Workspace explorer
under the folder lib->Library Source Files.
Add the instruction “ljmp _Trigger_Int” between the custom user code banners present under the
label “PSoC_GPIO_ISR:” in PSoCGPIOInt.asm file.
Similarly, add the instruction “ljmp _TickTimer_Int” between the custom user code banners
present under the label “_TickTimer_ISR:” in TickTimerINT.asm file.
8. The main.c code from the attached code example should be copied into this project’s main.c.
Also, create 2 new files “PLC_Demo.c” and “PLC_Demo.h” in the project (by clicking on menu
File >> New File). The contents of the files “PLC_Demo.c” and “PLC_Demo.h” from the attached
code example (CY3274_PLC_Demo) should be copied and pasted into these files. A high-level
description of the code is as follows:
a. The PLT and LCD User Modules are initialized. The global interrupts are enabled. The PLT
UM is configured.
b. The state of the MODE_Select Pin is checked, and based on this the mode of the device is
assigned as either Transmitter or Receiver.
c. The state of the ADD_Select Pin is checked, and based on this a logical address of the node
is chosen.
d. When the pin “Trigger” transitions from '1' to '0' in a kit that is in “Transmitter mode”, the
Powerline Transceiver (PLT) transmits data to the other node, or halts transmission if it had
previously been transmitting, or resumes transmission if it had previously been halted.
e. When the pin “Trigger” transitions from '1' to '0' in a kit that is in “Receiver mode”, the
Received packet count is reset.
f. The statistics and instructions are displayed on the LCD.
Name
MODE_Select
Port
P0[7]
Port
StdCPU
Drive
Pull Up
Interrupt
DisableInt
Initial Value
1
Name
Trigger
Port
P0[1]
Port
StdCPU
Drive
Pull Down
Interrupt
Falling Edge
Initial Value
0