#include <m8c.h> // part specific constants and macros
#include "PSoCAPI.h" // PSoC API definitions for all User Modules
#include <stdlib.h>
int CountValue1;
int b;
int c;
char str[15];
BYTE oldvalue;
displayvalue(a)
{
b=a;
if(b>0)
{
LCD_Start();
itoa(str, b, 10);
LCD_Position(1,0); // Place LCD cursor at row 1, col 0.
LCD_PrCString("freq:"); // Print "PSoC LCD" on the LDC
LCD_Delay50uTimes(5);
LCD_Position(1,6); // Place LCD cursor at row 0, col 5.
LCD_PrString(str); // Print "PSoC LCD" on the LDC
}
}
void main(void)
{
// Uncomment this line to enable Global Interrupts
// Insert your main routine code here.
LCD_Start();
LCD_Position(0,0); // Place LCD cursor at row 1, col 0.
LCD_PrCString("freq:null"); // Print "PSoC LCD" on the LDC
Timer8_Start();
Timer8_EnableInt();
Timer8_WritePeriod(0x64);
Timer8_WriteCompareValue(0x63);
M8C_EnableGInt;
Counter16_Start(); /* start the counter */
for( ; ; )
{
int cou=000000;
oldvalue=PRT1DR&0x80;
if((oldvalue==0x80)&&((PRT1DR&0x80)==0x00))
{
for(c=1 ; c<10000; c++)
{
cou=13456;
cou=cou+1;
displayvalue(cou);
}
}
else
{
cou=000000;
}
}
} |