66
CY3274 Cypress High Voltage Programmable PLC Development Kit Guide, Doc. # 001-53598 Rev. *G
Code Examples
2. Set the I
2
C address in the PLT Configuration window. Note that all the other parameters are set
by the Host.
Figure 5-14. PLT Configuration
3. Copy the sample code below for “FSK Modem + Network Stack + I
2
C Bridge”.
#include
<m8c.h>
// part specific constants and macros
#include "PSoCAPI.h"
// PSoC API definitions for all user modules
void
main(
void
)
{
PLT_Start();
//Initialize the PLT module
do
{
PLT_Check_I2C_Activity();
//Act on any I2C activity
PLT_Poll();
// Run the network protocol
}
while
(
1
);
}
4. 3 x LED UM (The corresponding LEDs are already hardwired to the respective pins on the
Cypress PLC Development Kits CY3274)
a. Name = “BIU_LED”, Port = “Port_2”, Pin = “Port_2_1”, Drive = “Active High”
b. Name = “RX_LED”, Port = “Port_2”, Pin = “Port_2_3”, Drive = “Active High”
c. Name = “TX_LED”, Port = “Port_2”, Pin = “Port_2_5”, Drive = “Active High”
5. Update the BIU, TX and RX ISR code snippets in PLT_1INT.asm from Appendix A - BIU, TX, RX
Interrupt Service Routines (Section of PLT_1INT.asm). Each ISR enables the appropriate LED
when the status is active (for example, turn on TX_LED when transmitting) or disable the appro-
priate LED when the status is complete.
a. PLT_BIU_Active_ISR: This ISR is called when the Band In Use is active
b. PLT_BIU_Complete_ISR: This ISR is called when the Band In Use is no longer set
c. PLT_TX_Active_ISR: This ISR is called when the Transmitter is actively sending a message
d. PLT_TX_Complete_ISR: This ISR is called when the Transmitter has completed sending the
message
e. PLT_RX_Active_ISR: This ISR is called when the Receiver is in process of receiving a packet
f. PLT_RX_Complete_ISR: This ISR is called when the Receiver is no longer receiving a packet