ATmega,Xmega,AVR Studio - 문자열 프로그램메모리에서 읽어오기
C언어,ARM / 2020. 6. 27. 22:18
const char msg1[] ="test한글"; 이렇게 사용하면, 문자열은 RAM을 사용하게 됩니다. RAM이 적은 cpu에서 상당한 부담이 될 수 있습니다. 문자열을 FLASH에 저장했다가, 읽어오면, RAM사용량을 줄일 수 있습니다. const char msg1[] PROGMEM ="test한글"; void UART_send_pstr(PGM_P s) { char buf[256]; strcpy_P(buf,s); UART_send(buf,strlen(buf)); } void xxxx() { char buf[256]; UART_send_str(strcpy_P(msg1)); UART_send_pstr(msg1); }
'C언어,ARM' 카테고리의 다른 글
ST-LINK 펌웨어 쓰기 설정 (0) | 2020.07.11 |
---|---|
xmega - timer0 (0) | 2020.06.27 |
xmega - WDT reset 와치독 타이머 (0) | 2020.06.27 |
error C2143: syntax error : missing ';' before 'type' (0) | 2020.06.20 |
AVR Studio - cannot execute empty custom programming tool command. please provide again (0) | 2020.06.20 |