STC15W408AS library 0.10.0
Loading...
Searching...
No Matches
Macros | Functions
counter0_mode1_example.c File Reference
#include <counter0_mode1.h>
#include <uart.h>
#include <delay.h>
#include <stdio.h>
Include dependency graph for counter0_mode1_example.c:

Macros

#define COUNTER0_INITIAL_VALUE   65530
 Counter0 initial value. Counts is 65535 - initial value.
 
#define LED_PIN   P10
 LED pin.
 
#define LED_OFF   1
 LED state OFF.
 
#define LED_ON   0
 LED state ON.
 

Functions

void counter0ISR () __interrupt(1)
 Counter0 interrupt service routine.
 
void main ()
 main function
 

Detailed Description

How to use counter0 in mode1.

Program counts from 65530 to 65535 (5 times). Counter is drived by T0 pin change state in a main function. On T0 pin change from 1 to 0 counter is incremented. On each T0 pin change LED is toggled.

LED is blinking 5 times and counter is stopped. On each T0 pin change counter value printed to UART.

Author
Mike Golovanov