Bellow is presented simple, tested and working example usng polling communication.
The PC uses com3 set for 9600bps. The channel can be found in the DeviceManager->Ports(COM & LPT), serch for OSBDM/OSJTAG

I have used hyperterminal for communication on the PC side. What you use is up to you.
//==============================================================================
// very simple polling mode is used
//==============================================================================
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
#include <stdio.h>
//==============================================================================
char str[255];
unsigned char SCI1_RxChar;
unsigned char SCI1_TxChar;
unsigned char SCI1_scisr1;
//==============================================================================
void diodes(void);
void SetPEEmodeBUSCLK(byte _synr, byte _refdv, byte _postdiv);
void SCI0_Init(void);
void SCI1_sendChar(char c);
void SCI0_sendText(char *str);
//==============================================================================
void SCI1_sendText(char *str)
{
unsigned char i=0;
while(str[i]!='\0')
{
SCI1_sendChar(str[i++]);
}
}
//==============================================================================
void SCI1_sendChar(char c)
{
while(!SCI1SR1_TC); // wait for free buf
SCI1DRL = c;
}
//==============================================================================
void diodes(void)
{
PTP_PTP3 = 1; PTP_PTP4 = 1; PTP_PTP6 = 1; // switch off
DDRP_DDRP3 = 1; // R connect
DDRP_DDRP4 = 1; // G connect
DDRP_DDRP6 = 1; // B connect
}
//==============================================================================
void SetPEEmodeBUSCLK(byte _synr, byte _refdv, byte _postdiv)
{
CPMUSYNR = _synr;
CPMUREFDIV = _refdv;
CPMUPOSTDIV = _postdiv;
CPMUOSC_OSCE = 1; //enable external oscillator OSCE
while(!CPMUFLG_UPOSC)
{// you can check for timeot here with error message report
};
while(!CPMUFLG_LOCK)
{// you can check for timeot here with error message report
};
//--- select clocks --------------------
CPMUCLKS = 0B10000011; // bus=fPLL/2; COP is clocked from OSCCLK
if(CPMUCLKS != 0B10000011) // After writing CPMUCLKS register, it is strongly recommended to read
{ // back CPMUCLKS register to make sure that write of PLLSEL,
asm nop; // RTIOSCSEL, COPOSCSEL0 and COPOSCSEL1 was successful.
}
//--------------------------------------
}
//==============================================================================
void SCI1_Init(void)
{
//----- BR = BUSCLK / (16*Baud rate)-------
//------------------------------------------------------
// prescaller value (depends on module clock frequency)
//SCI1BD = 0x34; // 9600 Bd at 8 MHz bus clock
//SCI1BD = 0x68; // 9600 Bd at 16 MHz bus clock
SCI1BD = 0x9C; // 9600 Bd at 24 MHz bus clock
//------------------------------------------------------
SCI1CR1 = 0x44; // Loops sciswai rsrc m wake ilt pe pt
// 0-LOOPS=RSRC=0 => 1 Single-wire mode with Rx input connected to TXD
// 1-SCI0 dis. in wait mode
// 0-if RSRC=1-RxTx intern. connected if loops=1
// 0-start+8 data+1 stop bit
// 0-IDLE mark wake up
// 1-idle char. bit count begins after stop bit
// 0-parity fction disabled
// 0-odd parity
//------------------------------------------------------
SCI1CR2 = 0x0C; // tie tcie rie ilie te re rwu sbk
// 0-Tx empty intr disabled
// 0-Tx complete intr disabled
// 1-Rx full + OverRun interrupts
// 0-idle line intr disabled
// 1-transmitter enabled
// 1-receiver enabled
// 0-receiver normal operation
// 0-no break characters
}
//==============================================================================
void main(void)
{
//------------------------------------
//SetPEEmodeBUSCLK(0x58, 0x07, 0x00); // 25MHz BUSCLK from 8 MHZ oscclk, PEE mode
//SetPEEmodeBUSCLK(0x01, 0x80, 0x00); // 16MHz BUSCLK from 8 MHZ oscclk, PEE mode
//SetPEEmodeBUSCLK(0x01, 0x80, 0x07); // 2MHz BUSCLK from 8 MHZ oscclk, PEE mode
SetPEEmodeBUSCLK(0x02, 0x80, 0x00); // 24MHz BUSCLK from 8 MHZ oscclk, PEE mode
//------------------------------------
SCI1_Init();
//------------------------------------
(void) sprintf(str,"\n\r\n\rI am alive\n\r\n\r");
//------------------------------------
SCI1_sendText(str);
SCI1_sendText(str);
SCI1_sendText(str);
//------------------------------------
while(1)
{
if((SCI1SR1 & (SCI1SR1_OR_MASK | SCI1SR1_RDRF_MASK))) // check whether char was received
{
if(SCI1SR1 & SCI1SR1_OR_MASK) // if overrun error do nothing/something
{
(void)SCI1DRL; // clear interrupt flag
// do something to process error
}
else
{
SCI1_TxChar = SCI1_RxChar = SCI1DRL; // read received character + clear interrupt flag
SCI1_sendChar(SCI1_TxChar); // echo received character
}
}
// PTP_PTP3 = 0; PTP_PTP3 = 1; // R
// PTP_PTP4 = 0; PTP_PTP4 = 1; // G
// PTP_PTP6 = 0; PTP_PTP6 = 1; // B
}
//------------------------------------
}
Best regards,
Ladislav