All pastes #584273 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-22 17:58 UTC
rendered paste body
# include <stdio.h>
/* #include <m8c.h> 
#include "PSoCAPI.h" */

void main();
void display();

int H;
int M;
int S;
unsigned int count;



	void main()
	{
		Start1: 
			H=M=S=0;

		Start2: 
			display();
			S=S+1;
	
		sec:
			if (S>59)
			{
			S=0;
			M=M+1;
			goto min;
			}
			else 
			goto Start2;

		min: 
			if (M>59)
			{
			S=M=0;
			H=H+1;
			goto hour;
			}
			else
			goto Start2;

		hour: 
			if (H>23)
			goto Start1;
			else
			goto Start2;	
	}




	void display()
	{
		LCD_Start(); 						// Initialize the LCD display
		LCD_Control(0x01); 	 			        // Clear the display after the delay		
		LCD_Position(0,0); 					// Set the cursor at the 1st row, 1st column
		LCD_PrString(H":"M":"S); 				// Printout time at the cursor position
		for( count = 1; count < 47999999; count++); 		// delay for 1 sec
											
	}