본문 바로가기

Study501

OddOccurrencesInArray 1. OddOccurrencesInArrayFind value that occurs in odd number of elements.Task descriptionA non-empty zero-indexed array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired.For example, in array A such that: A[0] = 9 A[1] = 3 A[2] = .. 2016. 7. 12.
CyclicRotation 1. CyclicRotationRotate an array to the right by a given number of steps.Task descriptionA zero-indexed array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is also moved to the first place.For example, the rotation of array A = [3, 8, 9, 7, 6] is [6, 3, 8, 9, 7]. The goal is to rotate array A K .. 2016. 7. 12.
BinaryGap Task descriptionA binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps: one of length 4 and one of length 3. The number .. 2016. 7. 12.
FFT(고속 푸리에 변환) 고속 푸리에 변환을 할 일이 생겼는데, 라이브러리나 소스코드를 참조하기 전에 변환 값이 옳은 것인지 잘 못된 것인지 확인해 보기 위해 찾은 괜찮은 사이트~ http://sooeet.com/math/online-fft-calculator.php 검색해보니 FFT는 음향쪽에 많이 사용되는 듯 하네요. 일단 1초에 499개의 값을 얻어서 calculator로 돌려봤습니다. UART를 통해 가져온 DEBUG Message 입니다. 데이터 사이는 공백으로 바꿔서 메모장으로 복사 메모장 값을 calculator에 넣으면 위와 같이 그래프가 나타 납니다. 젤 위의 값이 메모장에서 복사해 넣은 값들입니다. 저는 499개 정도~ 바로 밑은 샘플링율인데 잘 모르겠습니다 ㅠ 일단 60Hz로~ 샘플링 갯수는 2의 자승으로 증.. 2016. 7. 7.
UART baudrate 변경하기 78M6610 설정프로그램 78M6610+PSU 16pin은 UART 기본 설정이 4800bps입니다. 고속으로 값을 가져오기 위해 baudrate를 변경할 수 있습니다. 저는 115200bps으로 변경해 보겠습니다. 데이터 시트를 보시면 Input Register가 나옵니다. UART 설정에 관한 레지스터 주소는 0xD2입니다. 설정방법은 GUI 프로그램을 통해서 가능한데, 프로그램은 2가지가 있습니다. 첫번째는 구버전입니다. 이 프로그램은 38400bps 이상은 접속이 안되니 주의하셔야 합니다. GUI 프로그램을 이용하여 설정을 해줍니다. Read/Write Registers 탭에서 위와 같이 주소를 적어주고, 속도는 HEX 값으로 넣어준 후 Write하세요. 마지막으로 왼쪽 밑의 Update Fla.. 2016. 7. 6.
MAX78630 SSI ID, Total Watt MAX78630은 3상(3 phase)용 전력 측정칩입니다. 패킷의 구조입니다. 패킷 구조는 78M6610과 비슷합니다. 그리고 이건 응답용 패킷의 구조!! 역시 78M6613과 같습니다. 이건 Command payload 예제입니다.별도의 MCU를 이용하여 DATA를 가져오기 위해서는 Device Selection이 되어야 합니다. 위 예제를 보고 SSI ID를 0xCF를 보냈더니 통신이 안됩니다 ;;; PPA 찍어보니 0xC4입니다. 10xAA, 0x04, 0xC4, 0x8Ecs 그냥 사용예제인가 봅니다 ㅠ 그리고 전력값을 가져오는데 3상이라 총 합을 가져오기로 합니다. WATT_T가 Total값이긴 하지만 3으로 나눈 값( 즉 평균값입니다.) Word address는 0x68, Byte Addres.. 2016. 7. 5.

인기글