Thanks, I have done two project successfuly, JS I think I have found another bug in the PC software
I have modified the Hello example to output the UART on the PA.7 port, so after starting easypdkprog, it should capture the UART data, it can not get the UART data for now, But I have connected an external UART Bridge(FT230x) to it and it's putting data on the line,

here is the Modified code for PFS173.
// "Hello, world!" for the Padauk PFS154, to be compiled with SDCC.
// Repeatedly outputs the string "Hello, World!" at 9600 baud on pin 0 of Port A.
// Written by Philipp Klaus Krause in 2019.
// Source code under CC0 1.0.
// Output on PA0 at 1200 baud.
#include <stdbool.h>
#include <stdio.h>
volatile unsigned char sendcounter;
volatile unsigned int senddata;
volatile bool sending;
//PFS173 SFR's
__sfr __at(0x00) flag;
__sfr __at(0x02) sp;
__sfr __at(0x03) clkmd;
__sfr __at(0x04) inten;
__sfr __at(0x05) intrq;
__sfr __at(0x06) t16m;
__sfr __at(0x0a) eoscr;
__sfr __at(0x0b) ihrcr;
__sfr __at(0x0c) integs;
__sfr __at(0x0d) padier;
__sfr __at(0x0e) pbdier;
__sfr __at(0x0f) pcdier;
__sfr __at(0x10) pa;
__sfr __at(0x11) pac;
__sfr __at(0x12) paph;
__sfr __at(0x13) pb;
__sfr __at(0x14) pbc;
__sfr __at(0x15) pbph;
__sfr __at(0x16) pc;
__sfr __at(0x17) pcc;
__sfr __at(0x18) pcph;
__sfr __at(0x19) pbpl;
__sfr __at(0x1a) pcpl;
__sfr __at(0x20) adcc;
__sfr __at(0x21) adcm;
__sfr __at(0x22) adcr;
__sfr __at(0x24) adcrgc;
__sfr __at(0x26) misc;
__sfr __at(0x2b) gpcc;
__sfr __at(0x2c) gpcs;
__sfr __at(0x30) tm2c;
__sfr __at(0x31) tm2ct;
__sfr __at(0x32) tm2s;
__sfr __at(0x33) tm2b;
__sfr __at(0x34) tm3c;
__sfr __at(0x35) tm3ct;
__sfr __at(0x36) tm3s;
__sfr __at(0x37) tm3b;
__sfr __at(0x40) pwmg0c;
__sfr __at(0x41) pwmgclk;
__sfr __at(0x42) pwmg0dth;
__sfr __at(0x43) pwmg0dtl;
__sfr __at(0x44) pwmgcubh;
__sfr __at(0x45) pwmgcubl;
__sfr __at(0x46) pwmg1c;
__sfr __at(0x48) pwmg1dth;
__sfr __at(0x49) pwmg1dtl;
__sfr __at(0x4c) pwmg2c;
__sfr __at(0x4e) pwmg2dth;
__sfr __at(0x4f) pwmg2dtl;
void send_bit(void) __interrupt(0)
{
// Reset interrupt request, proceed only if we had a timer interrupt.
if(!(intrq & 0x40))
{
intrq = 0x00;
return;
}
intrq = 0x00;
if(!sending)
return;
if(senddata & 1)
pa = 0x80;
else
pa = 0x00;
senddata >>= 1;
if(!--sendcounter)
{
sending = false;
inten &= ~0x40;
}
}
int putchar(int c)
{
while(sending);
senddata = (c << 1) | 0x200;
sendcounter = 10;
tm2ct = 0;
sending = true;
inten |= 0x40;
return (c);
}
unsigned char _sdcc_external_startup(void)
{
#ifdef __SDCC_pdk15
ihrcr = *((const unsigned char*)(0x8bed)); // Use PFS173 factory calibration value for IHRC at 16 Mhz.
#else
ihrcr = *((const unsigned char*)(0x87ed)); // Use PFS154 factory calibration value for IHRC at 16 Mhz.
#endif
clkmd = 0x34; // Use IHRC / 2 = 8 Mhz for system clock, disable watchdog.
clkmd = 0x30; // Disable ILRC
return 0; // perform normal initialization
}
void main(void)
{
// Set timer 2 for interrupt for 1200 baud.
tm2c = 0x10; // Use CLK (8 Mhz)
tm2s = 0x06; // Divide by 6 + 1 ~> 1142857 Hz
tm2b = 118; // Divide by 118 + 1 ~> 9604 Hz
inten = 0x40;
__asm
engint
__endasm;
pac = 0x81;
for(;;)
{
printf("ASiDesigner!\r\n");
for(unsigned long int i = 0; i < 150000; i++); // Wait approx. 3s.
}
}
Also I have another question, is it possible to run the device @ 16MHz, I have changed the clkmd =0x54; and it's certainly running @ 8MHz.
