//------------------------------------------------------------------------
// C main line
//------------------------------------------------------------------------
#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
void main()
{
PLT_Start(); // Start the Powerline Transceiver
// Set the local logical address to 2
PLT_Memory_Array[Local_LA_LSB] = 0x02;
PLT_Memory_Array[PLC_Mode] |= (TX_Enable | RX_Enable | RX_Override);
// Enable the transmitter and receiver. Enable RX Overwrite.
// Use Acknowledgment Service Type
PLT_Memory_Array[TX_Config] |= TX_Service_Type;
// Set the destination address to 1
PLT_Memory_Array[TX_DA] = 0x01;
// Use the Send Message command for sending normal data
PLT_Memory_Array[TX_CommandID] = CMD_SENDMSG;
// Set the first byte of data to 0xAA
PLT_Memory_Array[TX_Data] = 0xAA;
// Set the second byte of data to 0xBB
PLT_Memory_Array[TX_Data + 1] = 0xBB;
// Set the message length to 2
PLT_Memory_Array[TX_Message_Length] = 0x02;
// Prepare the message to be transmitted
PLT_SendMsg();
do
{
PLT_Poll(); // Run the network protocol to send the message
// Check if the message was sent successfully
if (PLT_Memory_Array[INT_Status] & Status_TX_Data_Sent)
{ // If so, ...
// Clear the INT_Status register
PLT_Memory_Array[INT_Enable] &= ~INT_Clear;
break;
}
} while (1);
}