본문 바로가기

Harman83

[Harman 세미콘 아카데미] 30일차 - STM32(LED_Extern, Switch_Extern, UART) [LED_Extern] LD1 : 통신에 관련된 LED LD3 : 전원이 연결되면 해당 LED On(Red) [Switch_Extern] while (1) { /* USER CODE END WHILE */ /* USER CODE BEGIN 3 */ int i = HAL_GPIO_ReadPin(B1_GPIO_Port, B1_Pin); int j = HAL_GPIO_ReadPin(Switch_Extern_GPIO_Port, Switch_Extern_Pin); if((i == 0) || (j == 1)) { // Extern LED Green HAL_GPIO_WritePin(LED_Extern_Green_GPIO_Port, LED_Extern_Green_Pin, 1); HAL_Delay(200); HAL_GP.. 2023. 7. 28.
[Harman 세미콘 아카데미] 29일차 - STM32(Initial setting, Pin assign, LED_On/Off) [STM32] Initial Setting 1. 개발환경 구축 STM32는 자체적인 OS가 없기 때문에 공급사에서 지원하는 Tool들을 활용하여 개발환경을 구축해야 한다. 개발환경을 구축하기 위해 먼저 ST Micro사에서 공식적으로 제공하는 무료 개발 IDE인 STM32CubeIDE 설치할 것이다. https://www.st.com/content/st_com/en/stm32cubeide.html STM32CubeIDE: Multi-OS development tool - STMicroelectronics - STMicroelectronics STM32CubeIDE is an all-in-one multi-OS development tool, which is part of the STM32Cube soft.. 2023. 7. 27.
[Harman 세미콘 아카데미] 28일차 - ATmega128 과제(UART와 LED활용) [UART + LED] 과제 UART를 활용하여 입력된 신호에 따라서 LED bar를 작동시켜라 - R 입력 시, 오른쪽 방향으로 LED bar On(순차적으로) - L 입력 시, 왼쪽 방향으로 LED bar On(순차적으로) - B 입력 시, Blink(점멸) Code // LED_BAR.h // #ifndef LED_BAR_H_ #define LED_BAR_H_ #define F_CPU 16000000UL #include #include #include #include #define LED_BAR_PORTPORTA // LED_BAR를 PORTA에 연결 #define LED_BAR_DDRDDRA // 입/출력 방향 #define LED_COUNT8 // LED_BAR는 총 8칸 typedef stru.. 2023. 7. 27.
[Harman 세미콘 아카데미] 22일차 - ATmega128(FND 활용) [FND 활용] 0~9까지 카운팅(No interrupt) #define F_CPU 16000000UL #include #include #include // Segment 배열 선언 // uint8_t seg_arr[] ={ 0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x27, 0x7f, 0x67 }; int main() { int count = 0; DDRA = 0xff; while(1) { PORTA = seg_arr[count]; count = (count+1)%10; // 10으로 나눴을 때 나머지는 0~9이므로 _delay_ms(500); } } 0~9999까지 Count(No interrupt) #define F_CPU 16000000UL #include #in.. 2023. 7. 18.