Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Myfun.h"
- extern volatile uint32_t tick2,lcdvalue;
- extern volatile uint8_t stan;
- int main(void)
- {
- SysTick_Config(4000000 / 1000);
- Led_Conf();
- Joy_Conf();
- LCD7seg_conf();
- while(1)
- {
- if(stan == 0){
- if(Joy_Read() == Up) tick2++;
- if(Joy_Read() == Down && tick2 > 0) tick2--;
- delay_ms(100);
- }
- if(Joy_Read() == Center) stan = 1;
- }
- }
- ///////////////// Myfun.c
- volatile uint32_t tick = 0,tick2 = 500;
- volatile uint32_t lcdvalue;
- volatile uint8_t stan = 0;
- void SysTick_Handler(void) //przrwanie od systick
- {
- tick++;
- lcdvalue = tick2;
- if(stan == 1){
- tick2--;
- if(tick2 <= 0){
- Led_OnOff(8,LedOn);
- stan = 0;
- tick2 = 0;
- }
- }
- Lcd7seg_WriteNumber();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement