'C' language
MC68HC908MR32
1 decimal counter output PORTB
#include "Register_mr32.h"

#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;

#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG = 0x01;    // COPD=1 (cop disabled)
DDRB   = 0xFF;
PORTB  = 0x00;
 	  	  
	for (;;)
	{
	
	iCounter = 60000;			// delay time
	while(iCounter > 0) iCounter--;
	
	iCounter = 60000;			// delay time
	while(iCounter > 0) iCounter--;
	
	PORTB++;
	if(PORTB == 10) PORTB = 0;
	
 	}/* end loop*/
}

/****************** end main *************************/
download the complete C-sourcefiles
flashing lights left
#include "Register_mr32.h"


#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;


#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG = 0x01;    // COPD=1 (cop disabled)
DDRB   = 0xFF;
PORTB  = 0x01;
 	  	  
	for (;;)
	{
	iCounter = 40000;
	while(iCounter > 0) iCounter--;
	
	PORTB = PORTB << 1;	  // shift left
	if(PORTB == 0) PORTB = 1;
	
 	}/* end loop*/
}

/****************** end main *************************/
download the complete C-sourcefiles
flashing lights right
#include "Register_mr32.h"


#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;


#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG = 0x01;    // COPD=1 (cop disabled)
DDRB   = 0xFF;
PORTB  = 0x80;
 	  	  
	for (;;)
	{
	iCounter = 0;
	while(iCounter < 40000) iCounter++;
	PORTB = PORTB >> 1;
	if(PORTB == 0) PORTB = 0x80;
 	}/* end for;; loop*/
}

/****************** end main *************************/
download the complete C-sourcefiles
flashing lights runs from left to right and back
#include "Register_mr32.h"


#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;
int direction;

#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG = 0x01;    // COPD=1 (cop disabled)
DDRB   = 0xFF;
PORTB  = 0x01;
direction = 1; 	  	  
 	  	  
	for (;;)
	{
	iCounter = 0;
	while(iCounter < 40000) iCounter++;
	
	if(direction == 0) 
	  { PORTB = PORTB << 1;
	    if(PORTB == 0 ) {direction = 1; PORTB= 0x80;  }
	  }
	  else
	  { PORTB = PORTB >> 1;
	    if(PORTB == 0 ) {direction = 0; PORTB= 0x01;  }
	  }
	
 	}/* end for;; loop*/
}

/****************** end main *************************/
download the complete C-sourcefiles
PWM single output
#include "Register_mr32.h"


#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;


#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG =  0x91;    // EDGE=1, INDEP=1,COPD=1 (cop disabled)
PMODH  =  0x01;    // Highbyte 0x01 =>  256 decimal
PMODL  =  0;       // Lowbyte
PVAL1H =  0;
PVAL1L =  0x20;
  	  	  
PCTL2  = 0;
PCTL1  = 3;
PCTL1  |= 0x02;
PWMOUT = 0x3F;
 	  	  
	for (;;)
	{
 	}/* end for;; loop*/
}

/****************** end main *************************/
download the complete C-sourcefiles
PWM six outputs
#include "Register_mr32.h"


#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;


#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG =  0x91;    // EDGE=1, INDEP=1,COPD=1 (cop disabled)
PMODH  =  0x01;    // Highbyte 0x01 =>  256 decimal
PMODL  =  0;       // Lowbyte

PVAL1H =  0;
PVAL1L =  0;

PVAL2H =  0;
PVAL2L =  43;

PVAL3H =  0;
PVAL3L =  85;

PVAL4H =  0;
PVAL4L =  128;

PVAL5H =  0;
PVAL5L =  171;

PVAL6H =  0;
PVAL6L =  213;
  	  	  
PCTL2  = 0;
PCTL1  = 3;
PCTL1  |= 0x02;
PWMOUT = 0x3F;
 	  	  
	for (;;)
	{
	PVAL1L++;
	PVAL2L++;
	PVAL3L++;
	PVAL4L++;
	PVAL5L++;
	PVAL6L++;
	
	PCTL1  |= 0x02;
	
	iCounter= 1500;
	while(iCounter > 0) iCounter--;
	
 	}/* end  loop*/
}

/****************** end main *************************/
download the complete C-sourcefiles
Read analog channel
#include "Register_mr32.h"


#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;
unsigned int ADC_CH0;

#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG = 0x91;    // COPD=1 (cop disabled)
DDRA   = 0xFF;    // all outputs
DDRB   = 0;
DDRE   = 0xFF;

ADCLK  = 0x70;    // 8 Bit Version
 	  	  
	for (;;)
	{
	ADSCR = 0;
	
	iCounter = 0;
	while(iCounter < 8000) iCounter++;
	
	ADC_CH0   = ADRH;
	PORTA     = (char) ADC_CH0;
	
	PORTE ^= 0xFF;    // PORTE blinking
 	}/* end for;; loop*/
}

/****************** end main ***********************/
download the complete C-sourcefiles
Read analog and send byte over RS232
#include "Register_mr32.h"


#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;
unsigned int ADC_CH0;

#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG = 0x91;    // COPD=1 (cop disabled)
DDRA   = 0xFF;    // all outputs
DDRB   = 0;
DDRE   = 0xFF;

SCBR   = 0x02;   // Baudrate 9600
SCC1   = 0x40;
SCC2   = 0x0C;   // RX + TX enabled

ADCLK  = 0x70;    // 8 Bit Version
 	  	  
	for (;;)
	{
	ADSCR = 0;
	
	iCounter = 0;
	while(iCounter < 4000) iCounter++;
	
	ADC_CH0   = ADRH;
	PORTA     = (char) ADC_CH0;
	
	SCS1  = SCS1;     // read first status register
	SCDR  = PORTA;
	
	PORTE ^= 0xFF;    // PORTE blinking
	
 	}/* end  loop*/
}

/****************** end main ***********************/
download the complete C-sourcefiles
#include "Register_mr32.h"

void DELAY(void);

#pragma DATA_SEG SHORT _DATA_ZEROPAGE
unsigned int iCounter;
char *PTR1;

#pragma INTO_ROM
char SINTAB[16]=
{128,177,217,245,255,245,217,177,128,
 79,39,11,1,11,39,79};
                
                
#pragma DATA_SEG DEFAULT

/****************     M A I N      *****************/
void main(void) 
{
CONFIG = 0x91;    // COPD=1 (cop disabled)
PORTA  = 0;
DDRA   = 0xFF;    // all outputs

PTR1 = &SINTAB[0];

SCBR   = 0x02;   // Baudrate 9600
SCC1   = 0x40;
SCC2   = 0x0C;   // RX + TX enabled
 	  	  
	for (;;)
	{
	
	PORTA = *PTR1++;
	if(PTR1 >= &SINTAB[16])	
		PTR1 = &SINTAB[0];
	
	
	SCS1  = SCS1;     // read first status register
	SCDR  = PORTA;
	
	DELAY();
	
 	}/* end  loop*/
}

void DELAY(void)
{
iCounter = 60000;
while(iCounter > 0) iCounter--;
}
/****************** end main ***********************/
download the complete C-sourcefiles
Read SINUS-TABLE and send byte over RS232