'잡동사니'에 해당되는 글 13453건

  1. 2022.03.17 gcc / 문자열 선언
  2. 2022.03.17 LSE PLC Write
  3. 2022.03.17 LSE PLC XG5000 / 주소
  4. 2022.03.16 AC 전원 N/L/
  5. 2022.03.15 python interactive mode
  6. 2022.03.15 외근, 구매
  7. 2022.03.14 python3 opencv2 checker board
  8. 2022.03.14 cv2.imshow cv2.waitKey
  9. 2022.03.14 pdb
  10. 2022.03.14 iperf udp 테스트
프로그램 사용/gcc2022. 3. 17. 12:05

weston 소스를 보는데 희한한(?) 문자열 선언이 보여서 확인

static const char * const connector_type_names[] = {
[DRM_MODE_CONNECTOR_Unknown]     = "Unknown",
[DRM_MODE_CONNECTOR_VGA]         = "VGA",
[DRM_MODE_CONNECTOR_DVII]        = "DVI-I",
[DRM_MODE_CONNECTOR_DVID]        = "DVI-D",
[DRM_MODE_CONNECTOR_DVIA]        = "DVI-A",
[DRM_MODE_CONNECTOR_Composite]   = "Composite",
[DRM_MODE_CONNECTOR_SVIDEO]      = "SVIDEO",
[DRM_MODE_CONNECTOR_LVDS]        = "LVDS",
[DRM_MODE_CONNECTOR_Component]   = "Component",
[DRM_MODE_CONNECTOR_9PinDIN]     = "DIN",
[DRM_MODE_CONNECTOR_DisplayPort] = "DP",
[DRM_MODE_CONNECTOR_HDMIA]       = "HDMI-A",
[DRM_MODE_CONNECTOR_HDMIB]       = "HDMI-B",
[DRM_MODE_CONNECTOR_TV]          = "TV",
[DRM_MODE_CONNECTOR_eDP]         = "eDP",
[DRM_MODE_CONNECTOR_VIRTUAL]     = "Virtual",
[DRM_MODE_CONNECTOR_DSI]         = "DSI",
[DRM_MODE_CONNECTOR_DPI]         = "DPI",
};

 

느낌은 알겠는데.. 도대체 어디서 정의된 문법이냐...

$ cat str.c
#include <stdio.h>

static const char * const connector_type_names[] = {
        [0]     = "Unknown",
        [1]         = "VGA",
        [2]        = "DVI-I",
        [3]        = "DVI-D",
        [4]        = "DVI-A",
        [5]   = "Composite",
        [6]      = "SVIDEO",
        [7]        = "LVDS",
        [8]   = "Component",
        [9]     = "DIN",
        [10] = "DP",
        [11]       = "HDMI-A",
        [12]       = "HDMI-B",
        [13]          = "TV",
        [14]         = "eDP",
        [15]     = "Virtual",
        [16]         = "DSI",
        [17]         = "DPI",
};

void main()
{
        for(int i = 0; i < 10; i++)
                printf("%s\n",connector_type_names[i]);
}

$ gcc str.c
$ ./a.out
Unknown
VGA
DVI-I
DVI-D
DVI-A
Composite
SVIDEO
LVDS
Component
DIN

 

 

$ cat str.c
#include <stdio.h>

static const char * const connector_type_names[] = {
        [2]     = "Unknown",
        [1]         = "VGA",
        [0]        = "DVI-I",
        [3]        = "DVI-D",
        [4]        = "DVI-A",
        [5]   = "Composite",
        [6]      = "SVIDEO",
        [7]        = "LVDS",
        [8]   = "Component",
        [9]     = "DIN",
        [10] = "DP",
        [11]       = "HDMI-A",
        [12]       = "HDMI-B",
        [13]          = "TV",
        [14]         = "eDP",
        [15]     = "Virtual",
        [16]         = "DSI",
        [17]         = "DPI",
};

void main()
{
        for(int i = 0; i < 10; i++)
                printf("%s\n",connector_type_names[i]);
}

$ gcc str.c
$ ./a.out
DVI-I
VGA
Unknown
DVI-D
DVI-A
Composite
SVIDEO
LVDS
Component
DIN

 

 

+

ISO C99, GNU C90 에서 지원하는 듯.

In ISO C99 you can give the elements in any order, specifying the array indices or structure field names they apply to, and GNU C allows this as an extension in C90 mode as well. This extension is not implemented in GNU C++.
To specify an array index, write ‘[index] =’ before the element value. For example,

int a[6] = { [4] = 29, [2] = 15 };

[링크 : https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html]

 

$ gcc -std=c89 str.c
str.c: In function ‘main’:
str.c:26:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
  for(int i = 0; i < 10; i++)
  ^~~
str.c:26:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

$ gcc -std=c90 str.c
str.c: In function ‘main’:
str.c:26:2: error: ‘for’ loop initial declarations are only allowed in C99 or C11 mode
  for(int i = 0; i < 10; i++)
  ^~~
str.c:26:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code

$ gcc -std=c99 str.c

'프로그램 사용 > gcc' 카테고리의 다른 글

gcc fstack-protector-strong  (0) 2022.12.06
gcc vectorization 실패  (0) 2022.06.02
static link  (0) 2022.02.07
구조체 타입과 변수명은 구분된다?  (0) 2021.11.18
gcc unsigned to signed upcast 테스트  (0) 2021.07.08
Posted by 구차니
하드웨어/PLC (LSE)2022. 3. 17. 10:40

어제 시도해서 왜 껐다키면 날아가나 했떠니 Write를 안해서 그랬던 듯.

 

 

RUN 모드로는 쓸수 없어서 STOP으로 바뀌고 쓰는 듯.

 

write 하고 나니 알아서 run 하겠냐고 물어본다.

 

project - open from plc를 통해 장치에서 설정을 읽어 오면

 

일단 cpue 라는 가장 싼 모델이라 usb로만 읽도록 되어있으니 아래와 같이 설정

'하드웨어 > PLC (LSE)' 카테고리의 다른 글

lse xgk-cpue rs232/modbus 연결  (0) 2022.03.21
plc timer 주기적인 on off  (0) 2022.03.18
lse modbus rs232  (0) 2022.03.18
LSE PLC XG5000 / 주소  (0) 2022.03.17
plc ladder diagram  (0) 2022.02.14
Posted by 구차니
하드웨어/PLC (LSE)2022. 3. 17. 10:35

그냥 장비를 쭈욱 추가해보는데

베이스 보드 위치에 따라서 주소가 중복되지 않게 할당되어 있고

장치에 연결된 주소가 늘었다 줄었다 할 뿐 프로그래머블 하게 장치별로 할당되는 건 아닌듯 하다.

 

아래는 16개짜리 장치 / 8개 짜리 장치를 등록했을때의 address map 이고

 

아래는 32개 / 16 / 16 / 16 / 8 / 8 / 8 8/ 16 개로 등록했을때의 address map

 

하나의 슬롯이라도 반드시 16비트만 볼 필요는 없는건가 싶다.

'하드웨어 > PLC (LSE)' 카테고리의 다른 글

lse xgk-cpue rs232/modbus 연결  (0) 2022.03.21
plc timer 주기적인 on off  (0) 2022.03.18
lse modbus rs232  (0) 2022.03.18
LSE PLC Write  (0) 2022.03.17
plc ladder diagram  (0) 2022.02.14
Posted by 구차니
이론 관련/전기 전자2022. 3. 16. 16:33

 

 

[링크 : https://m.blog.naver.com/pkw00/220333975771]

 

 

Neutral

Live

[링크 : https://gammabeta.tistory.com/3182]

 

PLC 설명서를 보는데 

 

PE - Protective Earth

[링크 : https://blog.orientalmotor.com/grounding-basics-what-are-the-differences-between-pe-and-fg]

'이론 관련 > 전기 전자' 카테고리의 다른 글

a/w  (0) 2022.06.02
TR과 저항으로 AND, OR, NOT구현하기  (0) 2022.04.28
ac dc coupling  (0) 2022.02.23
led 와 solar panel  (0) 2022.02.22
FFT RBW - Resolution Band Width  (0) 2021.12.22
Posted by 구차니

별건 아니고 그냥

python 실행해서 뜨는 프롬프트에서 입력해서 실행하는 모드

 

[링크 : https://en.m.wikibooks.org/wiki/Python_Programming/Interactive_mode]

[링크 : https://stackabuse.com/python-programming-in-interactive-vs-script-mode/]

 

'Programming > python(파이썬)' 카테고리의 다른 글

python openCV / PIL 포맷 변경  (0) 2022.04.12
파이썬 딕셔너리 변수 생성과 리턴 enumerate, zip  (0) 2022.04.12
python3 opencv2 checker board  (0) 2022.03.14
pdb  (0) 2022.03.14
python debug (pdb)  (0) 2022.03.04
Posted by 구차니

어우 정신없어

하라고 하니 한다고 여기저기 들쑤시면서 재고 있는지 파악하고 구매하는데

급 현태

 

아니.. 내가 왜 ㅠㅠ

 

그 와중에 기름값.. 우리동네에서 가장 싼데인데도

1998원.. 6만원해서 겨우 30.03리터.. 무섭다..

오늘이 가장 싼날입니다. 소리가 괜히 나오는게 아닌 듯..

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

보안 전시회  (0) 2022.04.20
ai 컨퍼런스  (0) 2022.04.14
대선, 코로나  (0) 2022.03.09
먹방  (0) 2022.02.26
대전 외근  (0) 2022.02.24
Posted by 구차니

나중에 따라해.. 봐야지 ㅠㅠ

 

[링크 : http://www.gisdeveloper.co.kr/?p=6868]

'Programming > python(파이썬)' 카테고리의 다른 글

파이썬 딕셔너리 변수 생성과 리턴 enumerate, zip  (0) 2022.04.12
python interactive mode  (0) 2022.03.15
pdb  (0) 2022.03.14
python debug (pdb)  (0) 2022.03.04
opencv python  (0) 2022.02.25
Posted by 구차니
Programming/openCV2022. 3. 14. 19:38

imshow만 하면 검은 창만 비어서 나오는데

waitKey()로 메시지 루프(?)를 돌리지 않아서 그렇다고 한다.

 

[링크 : https://stackoverflow.com/questions/21810452]

'Programming > openCV' 카테고리의 다른 글

opencv cv2.imshow() error  (0) 2024.01.16
opencv를 이용한 다중 템플릿 추적  (0) 2024.01.15
virtual mouse  (0) 2022.01.25
opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
opencv face detect  (0) 2019.05.10
Posted by 구차니

pdb

 

$ pdb chcker.py 
> /home/minimonk/src/py/chcker.py(1)<module>()
-> import numpy as np
(Pdb) run
Restarting chcker.py with arguments:

> /home/minimonk/src/py/chcker.py(1)<module>()
-> import numpy as np
(Pdb) list
  1  -> import numpy as np
  2   import cv2
  3   import glob
  4   # termination criteria
  5   criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 30, 0.001)
  6   # prepare object points, like (0,0,0), (1,0,0), (2,0,0) ....,(6,5,0)
  7   objp = np.zeros((6*7,3), np.float32)
  8   objp[:,:2] = np.mgrid[0:7,0:6].T.reshape(-1,2)
  9   # Arrays to store object points and image points from all the images.
 10   objpoints = [] # 3d point in real world space
 11   imgpoints = [] # 2d points in image plane.
(Pdb) n
> /home/minimonk/src/py/chcker.py(2)<module>()
-> import cv2
(Pdb) n
ImportError: 'No module named cv2'
> /home/minimonk/src/py/chcker.py(2)<module>()
-> import cv2
(Pdb) q

 

$ whereis pdb
pdb: /usr/bin/pdb2.7 /usr/bin/pdb /usr/bin/pdb3.6 /usr/share/man/man1/pdb.1.gz

$ ls -al /usr/bin/pdb*
lrwxrwxrwx 1 root root  6  4월 16  2018 /usr/bin/pdb -> pdb2.7
lrwxrwxrwx 1 root root 23  2월 28  2021 /usr/bin/pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx 1 root root  6  1월 28 12:37 /usr/bin/pdb3 -> pdb3.6
lrwxrwxrwx 1 root root 23 12월  9 06:08 /usr/bin/pdb3.6 -> ../lib/python3.6/pdb.py

$ ls -al /usr/lib/python3.
python3.6/ python3.7/ python3.8/ 

$ ls -al /usr/lib/python3.6/pdb.py 
-rwxr-xr-x 1 root root 61310 12월  9 06:08 /usr/lib/python3.6/pdb.py

[링크 : https://docs.python.org/ko/3.7/library/pdb.html]

'Programming > python(파이썬)' 카테고리의 다른 글

python interactive mode  (0) 2022.03.15
python3 opencv2 checker board  (0) 2022.03.14
python debug (pdb)  (0) 2022.03.04
opencv python  (0) 2022.02.25
python / opencv mouse event  (0) 2022.02.25
Posted by 구차니
프로그램 사용/iperf2022. 3. 14. 11:50

흐음.. 로컬로 쐈는데 이정도면.. 성능 엄청 안 좋은건가?

아무튼 893번을 보내고 또 10번을 더 보내서 총 903번의 전송이 발생하는 것으로 보인다.

 

$ iperf -u -p 16000 -c localhost
------------------------------------------------------------
Client connecting to localhost, UDP port 16000
Sending 1470 byte datagrams, IPG target: 11215.21 us (kalman adjust)
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 49969 connected with 127.0.0.1 port 16000
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec
[  3] Sent 893 datagrams
[  3] WARNING: did not receive ack of last datagram after 10 tries.

[링크 : https://idchowto.com/iperf-를-이용한-네트워크-성능-측정/]

[링크 : https://chanind.github.io/2020/05/15/network-bandwidth-stress-testing-iperf.html]

 

+

i5-2520m 이고 로컬로 했는데 저조하네..

서버

$ iperf -u -p 16000 -s localhost
iperf: ignoring extra argument -- localhost
------------------------------------------------------------
Server listening on UDP port 16000
Receiving 1470 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 16000 connected with 127.0.0.1 port 59209
[ ID] Interval       Transfer     Bandwidth        Jitter   Lost/Total Datagrams
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.003 ms    0/  893 (0%)

 

클라이언트

$ iperf -u -p 16000 -c localhost
------------------------------------------------------------
Client connecting to localhost, UDP port 16000
Sending 1470 byte datagrams, IPG target: 11215.21 us (kalman adjust)
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 59209 connected with 127.0.0.1 port 16000
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec
[  3] Sent 893 datagrams
[  3] Server Report:
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.000 ms    0/  893 (0%)

 

+

i7-10510U 라고 해도 별다를 건 없어 보이네?

서버

$ iperf -u -p 16000 -s localhost
iperf: ignoring extra argument -- localhost
------------------------------------------------------------
Server listening on UDP port 16000
Receiving 1470 byte datagrams
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 16000 connected with 127.0.0.1 port 44436
[ ID] Interval       Transfer     Bandwidth        Jitter   Lost/Total Datagrams
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.011 ms    0/  893 (0%)

 

클라이언트

$ iperf -u -p 16000 -c localhost
------------------------------------------------------------
Client connecting to localhost, UDP port 16000
Sending 1470 byte datagrams, IPG target: 11215.21 us (kalman adjust)
UDP buffer size:  208 KByte (default)
------------------------------------------------------------
[  3] local 127.0.0.1 port 44436 connected with 127.0.0.1 port 16000
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec
[  3] Sent 893 datagrams
[  3] Server Report:
[  3]  0.0-10.0 sec  1.25 MBytes  1.05 Mbits/sec   0.000 ms    0/  893 (0%)

 

 

+

-b 옵션을 통해 대역폭을 늘리니 cpu 사용율이 폭증한다.

'프로그램 사용 > iperf' 카테고리의 다른 글

iperf3 jumbo packet?  (0) 2025.02.15
iperf 파일로 바로바로 떨궈서 tail로 보기  (0) 2025.02.10
iperf3  (0) 2023.07.28
iperf로 100M 랜 / IEEE1394 대역폭 측정  (2) 2011.12.07
iperf - 대역폭 측정  (0) 2009.10.22
Posted by 구차니