All pastes #584712 Raw Edit

Untitled

public c v1 · immutable
·published 2007-06-22 22:05 UTC
rendered paste body
//----------------------------------------------------------------------------// C main line//----------------------------------------------------------------------------#include  <M8C.h> 				#include  "TIMER8.h"				#include "PSoCAPI.h"int H;int M;int S;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()	{		char Hc = H;		char Mc = M;		char Sc = 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":"Mc":"Sc'); 				// Printout time at the cursor position		Setup1sPulse (); 		// delay for 1 sec												} 	void Setup1sPulse()			/* Divide by eight function */    	{  	    	    TIMER8_1_WritePeriod(99999);			/* set period to 100000 clocks */    	    TIMER8_1_EnableInt();				/* ensure interrupt is enabled */    	    M8C_EnableGInt; 					/* enable the global interrupts */   	    TIMER8_1_Start();					/* start the counter! */    	}