본문 바로가기

전체 글842

DNS, 보조 DNS, DDNS, nslookup DNS DNS 는 'www.naver.com'과 같은 도메인 주소를 컴퓨터가 인식할 수 있는 '223.130.200.107' 과 같은 IP주소로 변환해주는 시스템이며 이 DNS를 운영하는 서버를 네임 서버라고 한다. 주 DNS가 있고 보조 DNS가 있는데, 통상적으로 주 DNS로 쿼리하다가 주 DNS에 문제가 생기면 그때 보조 DNS가 쿼리를 한다고 알려져 있지만 일부 장비에서는 주 DNS랑 보조 DNS는 의미없고 다 동시에 작동하는데 가장 빠르게 IP정보를 가져온 곳을 채택한다고 한다. DNS서버는 보통 공유기에 등록되어 있어 일반적으로 DHCP 주소를 할당 받을 때 자동으로 DNS 서버 주소도 같이 할당 받게 된다. 통신사별 DNS 서버 주소 기본 보조 KT olleh 168.126.63.1 168... 2023. 3. 19.
MDIO(Management Data Input/Output) MII MII(Media Independent Interface)는 100Mbit/s 이더넷에서의 상위 계층인 MAC에서 하위 계층인 PHY 간 표준 인터페이스이다. 4 bit 단위로 데이터를 송수신(TXD[3-0], RXD[3-0])하므로 100Mbit/s 처리량을 달성하기 위해 25MHz클럭이 필요하다. MII와 MDIO MII에는 두가지 인터페이스가 있다. 이더넷 프레임 데이터 송수신을 위한 데이터 인터페이스 PHY를 관리하기 위한 인터페이스인 MDIO. 작동전 PHY를 설정하고, 작동중에 Link Status를 모니터링하기 위해 PHY의 control, status 레지스터 등을 읽고 쓰기 위한 인터페이스이다. MDIO MDIO는 SMI(Serial Management Interface) 또는 M.. 2023. 3. 12.
TMS320F28388D ] phy 레지스터 읽어 link status 감지하기 lwiplib.c 파일에서 bmsr을검색하면 link status를 감지하는 방법을 알 수있다. 먼저 이더넷 initialization 를 하면 Ethernet_getHandle() 함수 안에서 phy 설정을 하고 있긴한데, 그렇게 그냥 써도 이더넷통신은 되지만 phy 칩을 직접 다루려면 바깥에서 올바른 설정값으로 다시 설정해줄 필요가 있다. #define EPHY_BMSR 0x00000001 // Ethernet PHY Basic Mode Status#define EPHY_BMSR_LINKSTAT 0x00000004 // Link Status//MDIO ConfigurationsEthernet_configureMDIO(Ethernet_device_struct.bas.. 2023. 3. 12.
헬리콥터의 Main Gearbox (MGB) In helicopters, power transfer function from the engine to Main Rotor, Tail Rotor and other necessary accessories is performed by the Main Gearbox, typically known as Transmission as well. The main purpose of a helicopter main gearbox or transmission is to reduce output rpm of the engine to most suitable level for driving the main rotors and tail rotors of a helicopter. For example, a helicopter.. 2023. 3. 10.
변수를 특정 메모리 영역(섹션 또는 주소)에 배치하기 [공개] 특정 영역에 배치하기 MEMORY { // ... CPU1TOCPU2RAM : origin = 0x03A000, length = 0x000800 CPU2TOCPU1RAM : origin = 0x03B000, length = 0x000800 // ... } SECTIONS { // ... MSGRAM_CPU1_TO_CPU2 : > CPU1TOCPU2RAM, type=NOINIT MSGRAM_CPU2_TO_CPU1 : > CPU2TOCPU1RAM, type=NOINIT // ... } #pragma DATA_SECTION(readData, "MSGRAM_CPU1_TO_CPU2") typedef struct { uint32_t u16; float f; } test_t; test_t readData; 특정 주소.. 2023. 2. 28.
PlatformIO 사용방법 VS Code extension에서 PlatformIO IDE 검색후 인스톨 인스톨 후 VS Code 재실행 왼쪽 PlatformIO 아이콘 클릭 후 PIO Home - Open New Project 프로젝트명과 보드, 프레임워크, 프로젝트 위치 설정 하단에 PIO Home, Build, Upload, Serial Monitor 등의 아이콘이 있다. 시리얼 모니터 보레이트 설정방법 디폴트는 9600이고 platformio.ini 파일에 다음과 같이 추가해 변경가능하다. 라이브러리 다운로드 방법 설정방법 PIO Home - Libraries - Search libraries - Add to Project 그러면 platformio.ini 파일에 library dependency(lib_deps =)가 추가.. 2023. 2. 27.
UML State Machine State 란? Represents a distinct satge of an object's lifecycle. Different scenarios that an applcation object life cycle pasees through. A state is denoted by a round-cornered rectangle with the name of the state written inside it. 예시. The door can be in one of three states: "Opened", "Closed" or "Locked". It can respond to the events "Open", "Close", "Lock" and "Unlock". Types of states in UML 1.. 2023. 2. 27.
C#, WinForms ] 계산기 구현 STATE에 따라 버튼 이벤트가 다르게 동작해야 하기 때문에 어떻게 할까 고민하다 아래 4가지로 정의해서 구현해봄 IDLE COMPLETE_FIRST_NUMBER OPERATOR_INSERTED COMPLETE_SECONDE_NUMBER 지금 C#문법 배우는 중이고 일단 돌아가는거 보자 하고 막 만들어서 컨트롤 이름도 안바꿈.. namespace cal { public partial class Form1 : Form { enum state_t { IDLE, COMPLETE_FIRST_NUMBER, OPERATOR_INSERTED, COMPLETE_SECOND_NUMBER } state_t currentState = state_t.COMPLETE_FIRST_NUMBER; public Form1() { In.. 2023. 2. 25.
C#, WinForms ] label의 너비를 초과하는 글자 자르기 Graphics 객체를 사용해 사이즈를 구하고, 레이블 너비를 초과한 경우 Substring 메서드 사용해서 마지막 글자 지워버림 Substring 첫번째 매개변수는 추출할 문자열의 시작 인덱스, 두번째 매개변수는 추출할 문자열의 길이임. 초과되지 않게 주의 Graphics g = this.label1.CreateGraphics(); SizeF textSize = g.MeasureString(this.label1.Text, this.label1.Font); if(this.label1.Width < textSize.Width) { this.label1.Text = this.label1.Text.Substring(0, this.label1.Text.Length - 1); } 2023. 2. 25.
C# ] decimal 과 double 의 차이 C#에서 실수를 저장할 수 있는 변수로 double과 decimal이 자주 사용됨. double은 부동소수점 방식을 이용하고, decimal은 고정소수점 방식을 이용함 - double은 64비트(8바이트)크기에, 약 15~16 자리의 유효숫자를 가진다. decimal에 비해 연산이 빠르기에 대부분의 경우 사용됨. - decimal은 128비트(16바이트)크기에 28~29 자리의 유효숫자를 가진다. 정밀한 계산이 필요한 금융, 세금, 과학 등의 분야에서 사용됨. double d = 1.1 + 2.2; // d = 3.3000000000000003 decimal m = 1.1M + 2.2M; // m = 3.3 double의 경우 비교연산을 사용하면 예상 결과 나오지 않는다. 이는 double 은 이진수로 .. 2023. 2. 25.
C#, WinForms ] MessageBox 속성 private void button2_Click(object sender, EventArgs e) { MessageBox.Show("Do you want to delete?", "DELETE", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1); } 2023. 2. 25.
C#, WinForms ] textBox 크기에 맞춰서 Font Size 조절하기, resize the font to fit in the texBox Graphics g = textBox1.CreateGraphics(); SizeF textSize = g.MeasureString(textBox1.Text, textBox1.Font); float scale = Math.Min(textBox1.Width / textSize.Width, textBox1.Height / textSize.Height); float fontSize = textBox1.Font.Size * scale; textBox1.Font = new Font(textBox1.Font.FontFamily, fontSize, textBox1.Font.Style); textBox 컨트롤의 Graphics object를 구함 text와 font를 매개변수로 넣고 sizeF 구조체로 너비와 높이 구함.. 2023. 2. 25.
C#, WinForms ] 천 단위로 콤마 넣기, separate Numbers with commas string.Format("{0:#,##0}", num); 사용 예시. label의 textChanged Event처리 함수 "."으로 끝나는지, 소숫점을 포함하는지, 정수인지 구분하여 처리. string의 Replace()와 Split() 메서드 사용 if(this.label1.Text.EndsWith(".")) { string numStr = this.label1.Text.Replace(",", "").Replace(".", ""); if (decimal.TryParse(numStr, out decimal num)) { string formattedStr = string.Format("{0:#,##0}", num); this.label1.Text = formattedStr + "."; } } else.. 2023. 2. 25.
C#, WinForms ] 정수인지 실수인지 확인하기, Integer / Real number 구분 Math.Floor() 함수를 사용하면된다. 내림한게 원래 값과 같으면 정수, 아니면 실수이다. double result = first + second; if(Math.Floor(result) == result) { this.label1.Text = string.Format("{0:#,##0}", result); } else { this.label1.Text = string.Format("{0:#,##0.########################}", result); } 2023. 2. 25.
C# ] 문자 또는 문자열 집합 중 하나라도 포함하고 있는지 확인하기 Contains 또는 IndexOfAny 사용 가능 Contains() 는 특정 문자열 또는 문자열 배열중 하나가 문자열 내에 존재하는 존재하는지 여부를 검사하여 bool을 반환. string str = "Hello, World!"; string[] keywords = {"World", "Universe"}; if (str.Contains(keywords[0])) { Console.WriteLine("The string contains the keyword: " + keywords[0]); } if (!str.Contains(keywords[1])) { Console.WriteLine("The string does not contain the keyword: " + keywords[1]); } Index.. 2023. 2. 25.
C#, WinForms ] 버튼 속성. 테두리색 및 굵기, 클릭시 배경색 변경하기 FlatStyle - Flat 설정 FlatAppearance - BorderColor 로 테두리색 변경 FlatAppearance - BorderSize 로 테두리 굵기 변경. 0으로 하면 테두리 없앰 FlatAppearance - MouseDownBackColor 로 클릭시 버튼 배경색 변경 FlatAppearance - MouseOverBackColor 로 마우스가 올라왔을 때 배경색 변경 2023. 2. 25.
Interrupt Nesting & SW Priorization [공개] 관련문서 https://software-dl.ti.com/C2000/docs/c28x_interrupt_nesting/html/index.html C28x Interrupt Nesting In most cases a system will only require one or two interrupts to be nested. This is easily handled by the example shown previously. There is, however, an example provided by which covers possibilities for every single interrupt in the group. This example software-dl.ti.com PIE 그룹과 채널 디폴트 우선순.. 2023. 2. 25.
CANFD (MCAN) [공개] 메시지램 통해 CPU1에서 사용가능 CPU2에선 불가. MCAN이 사용하는 메시지램은 CPU1_TO_CM, CM_TO_CPU1 MSGRAM 과는 별개 송신 수신 FIFO사용해 수신시 Loss 없음 2023. 2. 25.
EMIF로 SDRAM 사용 [공개] EMIF(External Memory Interface)는 어플리케이션이 on-chip 메모리보다 더 많은 memory storage를 필요로 할 때, Flash나 SDRAM 같은 외부메모리에 access 할 수 있도록 인터페이스 수단을 제공한다. SDRAM은 CS0(Chip Select)사용하고 링커커맨드 파일을 확인하면 CS0은 시작주소 0x80000000 부터 씀 데이터시트 분석 후 파라미터 설정하고 테스트 128MB SDRAM이 마지막 주소 0x83FFFFFF 까지 잘 써진것을 확인 memcpy_fast_far(), memcpy() 함수 사용 가능. 일반 참조연산으로 대입하고 확인해봐도 됨 Recommended Use of Far Memory https://www.ti.com/lit/an/spra.. 2023. 2. 25.
CAN [공개] Bit Timing 계산 : http://www.bittiming.can-wiki.info/ CAN Bit Time Calculation The following calculation sheet is mostly useful for classic CAN as defined in ISO-11898 before 2015. For the new CAN FD as defined in ISO-11898:2015 work is in Progress. CiA provides the document CiA 601-3 CAN FD bit-timing recommendations. By providing t www.bittiming.can-wiki.info Receive/Transmit Priority, Frame Ide.. 2023. 2. 25.
lwIP UDP 예제 [공개] CPU1 예제 위치 CM 예제위치 sys_check_timeouts() : LwIP function is called to handle certain LwIP internal periodic tasks (protocol timers, retransmission of TCP packets...). 2023. 2. 25.
배치파일 관리자 권한으로 실행되게끔 하기 원본 배치파일의 바로가기를 만든다. 바로가기 파일 우클릭 - 속성 - 고급 관리자 권한으로 실행 체크 후 확인 이러고 원본은 숨겨두면 된다. 혹은 bat to exe converter를 사용하는 방법도 있다. 2023. 2. 22.
C#, WinForms ] OpenFileDialog, 이미지 pictureBox에 로드하기 private void button1_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Image Files (*.bmp;*.jpg;*.jpeg;*.png)|*.BMP;*.JPG;*.JPEG,*.PNG"; dialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); if(dialog.ShowDialog() == DialogResult.OK) { textBox1.Text = dialog.FileName; pictureBox1.SizeMode = PictureBoxSizeMode.S.. 2023. 2. 22.
TMS320F28388D ] getTick 구현 ISR에서 사용할 volatile msTick변수와 getTick함수는 모든 HW드라이버파일이 사용할 수 있는 헤더 extern 해둠 volatile uint32_t msTick; uint32_t getTick(void) { return msTick; } main.c 사용 예 timerOpen(TIMER_CH1, 1000, &timer0ISR); //... for(;;) { if(getTick()-timeBefore > 1000) { timeBefore = getTick(); print("\r\nHello World!"); } } timerOpen함수는 함수포인터로 받아서 콜백함수 등록 __interrupt void timer0ISR(void) { msTick++; // Acknowledge this i.. 2023. 2. 21.
C#, WinForms ] textBox박스의 focus 없애기/주기 focus 없애는 방법 Properties - TabStop False로 설정 또는 Form Load 시 this.ActiveControl = null; focus 주는 방법 Form Load 시 this.ActiveControl = textBox1; 또는 textBox1.Focus(); 2023. 2. 21.
C#, WinForms ] 문자열 앞에 (심벌)@사용 @ 심벌을 문자열 앞에 사용하면, 해당 문자열 안의 Escape 문자를 무시하고 문자 그대로 인식하도록 한다. 예를 들어, Backslash를 한번 지정하면 이는 Escape문자로 인식되기 때문에 2개의 Backslash를 사용하게 되는데, @ 심벌을 문자열 시작 부호전에 사용하면, Backslash를 그대로 Backslash로 인식하게 한다. 예시1. string filename = "C:\\Temp\\1.txt"; string filename = @"C:\Temp\1.txt"; 예시2. this.textBox1.Text = duration.ToString(@"hh\:mm\:ss\.fff"); this.textBox1.Text = duration.ToString("hh\\:mm\\:ss\\.fff");.. 2023. 2. 21.
DateTime 문자열 서식지정자 주의 : 날짜 및 시간 형식은 Locale 설정에 따라 달라질 수 있다. https://learn.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings Custom date and time format strings Learn to use custom date and time format strings to convert DateTime or DateTimeOffset values into text representations, or to parse strings for dates & times. learn.microsoft.com Format specifier Description Examples "d" Th.. 2023. 2. 21.
C#, WinForms ] 스탑워치, Stopwatch 클래스, DateTime 구조체, Timer 활용 using System.Diagnostics; //... private Stopwatch stopwatch = new Stopwatch(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { // textBox 초기값 this.textBox2.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); this.textBox2.Text = ""; } private void button1_Click(object sender, EventArgs e) { // Stopwatch, Timer 스타트 stopwatch.Start(); this.timer1.St.. 2023. 2. 20.
Visual Studio ] method prototype 확인법 괄호(Parenthesis)에 커서를 두고 Ctrl + Shift + Space 누르면 툴팁이 나옴 이 상태에서 Shift + ↑/↓ 를 누르면 method의 overload 이동하면서 확인할 수 있음 https://stackoverflow.com/questions/9891656/visual-studio-how-to-show-overloads-in-intellisense Visual Studio: How to show Overloads in IntelliSense? Once code has been written, the only way I know of to view the overloads for a method is to actually edit the method by deleting the Pa.. 2023. 2. 20.
터미널 제어문자 ANSI escape code / 터미널에 글자색 배경색 입히기 터미널 제어 문자는 컴퓨터 터미널 화면의 커서 위치 및 색상 등을 제어하는 용도로 사용되는 특수한 문자들로 이에 대한 표준은 ANSI escape code이다. 1970년대 최초로 이러한 터미널 제어기능을 지원하는 VT100이라는 터미널 에뮬레이터가 등장하였고, 이후에 나온 터미널들도 VT100과 호환성을 가질 수 있도록 기존 제어 문자에 확장된 기능을 추가하여 ANSI escape code가 ANSI 표준으로 제정되게 되었다. 사용 예시 print("\033[31;43mHello, World!\033[0m\r\n") 여기서 \033 은 터미널 제어를 위한 ANSI 이스케이프 시퀀스(컨트롤 문자인 ESC(escape)의 ASCII 코드값)로 "\033" 뒤에 명령인수가 온다. [31m은 텍스트를 빨간색으.. 2023. 2. 20.