#include <m8c.h> // part specific constants and macros #include «PSoCAPI.h» // PSoC API definitions for all User Modules #include «stdlib.h»
double dResult; char* buf; char n;
unsigned Delay (unsigned int value)// задержка { unsigned int i=0; for (i=0;i<value;i++); }
void main(void) {
UART_Start(UART_PARITY_NONE); M8C_EnableGInt ; // Uncomment this line to enable Global Interrupts dResult = 0; while(1) // главный цикл прошивки { n = UART_cGetChar(); if (n==’1′) { dResult = dResult+1; buf = ftoa (dResult,0); UART_PutString(buf); UART_PutChar(‘\n’); } if (n==’0′) { UART_CPutString(«ok»); UART_PutChar(‘\n’); } Delay(50000);