이진수 MSB, LSB 역순으로 만들기 함수
AVR&ARM2016. 5. 11. 11:43
void reverse(unsigned char data)
{
unsigned char tmp=0;
// 데이터 뒤집어 주는 부분.
for(char i=0; i<8;i++)
{
tmp|=(data&0x01)<<(7-i); // 0x01 비트 부터 비교해서 넣어줌.
data>>=1; // 데이터를 옮겨서 다음비트 비교할 수 있도록 해줌.
}
data = tmp;
}
'AVR&ARM' 카테고리의 다른 글
[AVR] DC_motor 제어 (1) | 2016.05.26 |
---|---|
[Avr studio] warning: large interger implicitly truncated to unsigned type (0) | 2016.05.26 |
avr 처음 사용시 Fuse 설정 (0) | 2016.05.13 |
[AVR studio] warning "F_CPU~" (0) | 2016.04.20 |
suggest parentheses around arithmetic in operand of '|' [-Wparentheses] (0) | 2016.04.20 |
[AVR studio] warning "F_CPU~"
AVR&ARM2016. 4. 20. 17:46
#warning "F_CPU not defined for <util/delay.h>" [Wcpp]
이때
메뉴에서 Project- Configuration option 에서
avr 클럭을 넣어주면 오류 사라짐.
(16Mhz라서 16000000을 넣어주었음.)
'AVR&ARM' 카테고리의 다른 글
[AVR] DC_motor 제어 (1) | 2016.05.26 |
---|---|
[Avr studio] warning: large interger implicitly truncated to unsigned type (0) | 2016.05.26 |
avr 처음 사용시 Fuse 설정 (0) | 2016.05.13 |
이진수 MSB, LSB 역순으로 만들기 함수 (0) | 2016.05.11 |
suggest parentheses around arithmetic in operand of '|' [-Wparentheses] (0) | 2016.04.20 |