NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

#include "main.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Private typedef -----------------------------------------------------------*/
/* USER CODE BEGIN PTD */
int sayi[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
int i=0,milisaniye=0,saniye=0,sayac=0,kontrol=0,tarama=0,kontrol1=0;
int deger[4];
/* USER CODE END PTD */

/* Private define ------------------------------------------------------------*/
/* USER CODE BEGIN PD */
/* USER CODE END PD */

/* Private macro -------------------------------------------------------------*/
/* USER CODE BEGIN PM */

/* USER CODE END PM */

/* Private variables ---------------------------------------------------------*/
TIM_HandleTypeDef htim4;

/* USER CODE BEGIN PV */

/* USER CODE END PV */

/* Private function prototypes -----------------------------------------------*/
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static void MX_TIM4_Init(void);
/* USER CODE BEGIN PFP */

/* USER CODE END PFP */

/* Private user code ---------------------------------------------------------*/
/* USER CODE BEGIN 0 */
void baslangic()
{
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, sayi[0] & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1, sayi[0] >> 1 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2, sayi[0] >> 2 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3, sayi[0] >> 3 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, sayi[0] >> 4 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5, sayi[0] >> 5 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6, sayi[0] >> 6 & 0x01);
//////////////////////////////////////////////////////////////////////
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, 0);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 0);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, 0);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 0);
}
void basamakla()
{
deger[0] = sayi[saniye % 10];
deger[1] = sayi[(saniye % 100) / 10];
deger[2] = sayi[saniye / 10];
deger[3] = sayi[saniye/1000];
}
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {

if(kontrol1==0)++saniye;
++tarama;
}

void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
kontrol1=1;

}



while (1) {
/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_5) == 0)
HAL_TIM_Base_Start_IT(&htim4);
if (HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_7) == 0) {
if (kontrol1) {
kontrol1 = 0;
baslangic();
saniye = 0;
HAL_TIM_Base_Stop_IT(&htim4);
}
}
basamakla();

if (saniye == 9999)
saniye = 0;
if (tarama == 5) {
++sayac;
tarama = 0;

if (sayac == 4)
sayac = 0;
if (sayac == 0) {
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 0);

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0, sayi[saniye % 10] & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1,
sayi[saniye % 10] >> 1 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2,
sayi[saniye % 10] >> 2 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3,
sayi[saniye % 10] >> 3 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4,
sayi[saniye % 10] >> 4 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5,
sayi[saniye % 10] >> 5 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6,
sayi[saniye % 10] >> 6 & 0x01);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, 0);
}
if (sayac == 1) {
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, 0);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0,
sayi[(saniye % 100) / 10] & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1,
sayi[(saniye % 100) / 10] >> 1 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2,
sayi[(saniye % 100) / 10] >> 2 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3,
sayi[(saniye % 100) / 10] >> 3 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4,
sayi[(saniye % 100) / 10] >> 4 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5,
sayi[(saniye % 100) / 10] >> 5 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6,
sayi[(saniye % 100) / 10] >> 6 & 0x01);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, 0);
}
if (sayac == 2) {
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 0);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);

HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0,
sayi[(saniye % 1000) / 100] & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1,
sayi[(saniye % 1000) / 100] >> 1 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2,
sayi[(saniye % 1000) / 100] >> 2 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3,
sayi[(saniye % 1000) / 100] >> 3 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4,
sayi[(saniye % 1000) / 100] >> 4 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5,
sayi[(saniye % 1000) / 100] >> 5 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6,
sayi[(saniye % 100) / 100] >> 6 & 0x01);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, 0);
}
if (sayac == 3) {
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, 0);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_2, 1);
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_3, 1);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_0,
sayi[saniye / 1000] & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_1,
sayi[saniye / 1000] >> 1 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_2,
sayi[saniye / 1000] >> 2 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_3,
sayi[saniye / 1000] >> 3 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4,
sayi[saniye / 1000] >> 4 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_5,
sayi[saniye / 1000] >> 5 & 0x01);
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_6,
sayi[saniye / 1000] >> 6 & 0x01);
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, 1);
}
}

}
/* USER CODE END 3 */
}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.