티스토리 뷰
728x90
1. 개요 |
ARTIK 050에는 DEBUG용 UART와 기본 UART핀이 1세트가 존재합니다. 간단하게 5핀 UART USB모듈을 연결하여 2개의 터미널로 통신을 하는 소스코드입니다.
2. 회로 |
특별한 작업 필요 없이 모듈을 보드에 바로 연결하시면 됩니다.
3. Source Code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #include "wiced.h" #define RX_BUFFER_SIZE 64 #define TEST_STR "\r\nType something! Keystrokes are echoed to the terminal ...\r\n> " wiced_uart_config_t uart_config = { .baud_rate = 115200, .data_width = DATA_WIDTH_8BIT, .parity = NO_PARITY, .stop_bits = STOP_BITS_1, .flow_control = FLOW_CONTROL_DISABLED, }; wiced_uart_config_t uart_config2 = { .baud_rate = 115200, .data_width = DATA_WIDTH_8BIT, .parity = NO_PARITY, .stop_bits = STOP_BITS_1, .flow_control = FLOW_CONTROL_DISABLED, }; wiced_ring_buffer_t rx_buffer,rx_buffer2; uint8_t rx_data[RX_BUFFER_SIZE],rx_data2[RX_BUFFER_SIZE]; /****************************************************** * Function Definitions ******************************************************/ void application_start( ) { char c; uint32_t expected_data_size = 1; /* Initialise ring buffer */ ring_buffer_init(&rx_buffer, rx_data, RX_BUFFER_SIZE ); ring_buffer_init(&rx_buffer2, rx_data2, RX_BUFFER_SIZE ); /* Initialise UART. A ring buffer is used to hold received characters */ wiced_uart_init( STDIO_UART, &uart_config, &rx_buffer ); wiced_uart_init( WICED_UART_2, &uart_config2, &rx_buffer2); /* Send a test string to the terminal */ wiced_uart_transmit_bytes( STDIO_UART, TEST_STR, sizeof ( TEST_STR ) - 1 ); /* Wait for user input. If rsseceived, echo it back to the terminal */ while ( wiced_uart_receive_bytes( STDIO_UART, &c, &expected_data_size, WICED_NEVER_TIMEOUT ) == WICED_SUCCESS ) { wiced_uart_transmit_bytes( WICED_UART_2, &c, 1 ); expected_data_size = 1; } } |
4. 결과 |
디버그용 UART(COM4)에서 입력을 하면 모듈 UART(COM3)에서 출력이 나옵니다.
5. 소스 저장소 |
'HardWare > ARTIK' 카테고리의 다른 글
[ARTIK 050] TCP Client (0) | 2016.10.26 |
---|---|
[ARTIK 050] TCP Server (0) | 2016.10.26 |
[ARTIK 050] Thread (0) | 2016.10.17 |
[ARTIK 050] RGB LED(LS5050RGB, KY-009) (0) | 2016.10.17 |
[ARTIK 050] ARTIK Cloud & MQTT (0) | 2016.09.13 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- jad
- Java Decompiler
- 포켓몬 Go
- 포켓몬 고
- 카운터
- c언어
- 파일입출력
- java url
- counter
- 유전 알고리즘
- 안드로이드
- Service
- 인텐트
- 아두이노
- Notification
- vim
- 서버
- java
- 유전
- 테라펀딩 #투게더펀딩 #P2P투자 #부동산 소액 투자 #카카오 #토스
- LISTVIEW
- 알고리즘
- php
- 파일 입출력
- java 파일 입출력
- android
- 자바 입출력
- Res
- vim 설치
- 5582
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
글 보관함