All pastes #586051 Raw Edit

Something

public c v1 · immutable
#586051 ·published 2007-06-23 16:40 UTC
rendered paste body
//----------------------------------------------------------------------------// C main line//---------------------------------------------------------------------------- #include  <M8C.h> 				#include  "TIMER8.h"				#include  "PSoCAPI.h"int H;int M;int S;void display();void Setup1sPulse();	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;		}char Hc[]="";char Mc[]="";char Sc[]="";	void display()	{		sprintf(Hc, "%d", H);		sprintf(Mc, "%d", M);		sprintf(Sc, "%d", S);		LCD_1_Start(); 						// Initialize the LCD display		LCD_1_Control(0x01); 	 			        // Clear the display after the delay				LCD_1_Position(0,0); 					// Set the cursor at the 1st row, 1st column		LCD_1_PrString(Hc); 				// Printout time at the cursor position		Setup1sPulse (); 		// delay for 1 sec												}	void Setup1sPulse()			/* Divide by eight function */    	{  			    TIMER8_Start();					/* start the counter! */    	    TIMER8_WritePeriod(99999);			/* set period to 100000 clocks */    	    M8C_EnableGInt; 					/* enable the global interrupts */           TIMER8_EnableInt();				/* ensure interrupt is enabled */    	}