336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.


Naver

[fuse low byte]

[CKSEL fuse bits...]

[open 16f877a 고장] :: ▶LINK ▶LINK 두개 링크를 참고해주세요 (댓글 환영합니다.)





http://treehouseprojects.ca/fusebits/


Setting Up An External Crystal Clock Source (with Fuse Bits) for AVR ATMega Microcontrollers


Choosing the values for the fuse bits


Just to make sure we are on the same page,

CKSEL3..0 means all the CKSEL bits from CKSEL0 to CKSEL3.

CKSEL stands for clock select,

and tells our microcontroller what kind of a clock we are using,

what its frequency is.

Let's look at Table 2 :


Table 2. Device Clocking Options Select

 Device Clocking

 CKSEL3..0

 External Crystal / Ceramic Resonator

 111 - 1010

 External Low Freq Crystal

 1001

 External RC Oscillator

 1000 - 0101

 Calibrated Internal RC

 0100 - 0001

 External Clock

 0000

Note : For all fuses "1" means unprogrammed while "0" means programmed

Default가 1이다.



From this, we see that CKSEL3..0 has to be somewhere between 1111 and 1010.

여기서, 우린 본다. that CKSEL3..0이 있어야만한다고 어딘가에 between 1111 & 1010.

So the four bits (CKSEL0, CKSEL1, CKSEL2, CKSEL3) are somewhere in that range.

그렇게 the 4개 비트들 (CKSEL 0 ~ 3)은 있다. 어딘가에 in that range에.

How do we know what they are exactly?

That depends on our crystal’s frequency,

어떻게  우리가 아는가? 그게 정확한지?

그건 의존한다. on 우리의 크리스탈 주파수에.

Table 2 is just telling us that 

if we use an external crystal, 

the four bits will be somewhere in that range.

Right, moving forward.

테이블2 (▲위 폴더) 는 그저 말해준다. 우리에게

만약 우리가 사용한다면 an 외부 크리스탈을,

the 4개 비트들은 will be 있게될거다. 어딘가에 in that range에.



Table 4. Crystal Oscillator Operating Modes

 CKOPT

 CKSEL3..1

 Freq. Range(MHz)

 Recommended Range for Caps. (pF)

 1

 101

 0.4 - 0.9

 -

 1

 110

 0.9 - 3.0

 12-22

 1

 111

 3.0 - 8.0

 12-22

 0

 101,110,111

 1.0 ≤

 12-22

Note: This option should not be used with crystals, only with ceramic resonators


Table 4 gives us some more detail about CKSEL3..1 (Note, not CKSEL0 just yet),

and 

tells us what our options for CKOPT are.

We will program CKOPT (set to Zero)

because a programmed CKOPT is needed

when we are dealing with higher frequency ranges,

need a full swing signal,

or we are driving a second buffer with the same output from the clock.

We meet the first criteria (16MHz > 1MHz),

so we will set CKOPT to 0.

As a result CKSEL3..1 can be any of 101,110,111,

it doesn't matter.

We'll go with setting the three CKSEL bits to 111 just for kicks.


Good. let's move on to the final three bits

we have to work on

: CKSEL0, SUT1, and SUT0.



.

.

.

Setting Up the Hardware

Finally, you are at the point at which you are ready to burn the fuse bits 

into your microcontroller.

최종적으로, 넌 있다. at the 포인트에 at which 네가 준비하는시점에 to 굽기위한 the 퓨즈비트를

into 너의 마이크로컨트롤러에.

But you want to make sure you have the crystal connected to your AVR too, 

so follow the schematic below;

하지만, 넌 want to 확인하길원한다. 네가 갖고있는지 the 크리스탈 연결되있는지 to AVR에,

so 따라가라 the 회로를 below;



C1 and C2 and 22pF ceramic capacitors.

Have this setup as close together as possible,

don't have wires running around the breadboard to reach the crystal and ground.

You could use the following setup to try out the impact of the crystal along with the following code (skip this little bit if you don't want to try out a simple example)


▼▼▼▼▼▼▼▼▼▼▼▼▼

/*

*CrystalTest.c

*This simple code is meant to teach how an external crystal works for an AVR ATMega

*by flashing an LED ON and OFF every 200 milliseconds

*/

//This tells the AVR how many Cycles equates to One second

//For this code, we are using the internal 1 MHz crystal, so we have F_CPU defined as 1 million

#ifndef F_CPU

#define F_CPU 1000000UL     //1 million

#endif


#include<avr/io.h>

#include<util.delay.h>

int main(void)

{

DDRC = (1<<RC5);

while(1)

{

//LED on

PortC = (1<<PC5);

_delay_ms(200);

//LED off

PortC = (0<<PC5);

_delay_ms(200);

}

}

▲▲▲▲▲▲▲▲▲▲▲▲▲

======================================================================================================================

http://www.instructables.com/id/Avr-fuse-basics-Running-an-avr-with-an-external-cl/?ALLSTEPS

.

.

.

Step 6: Summing up.

The previous step might look confusing 
and out of order 
but this step will give a clear picture of the whole process.
이전 step은 아마 햇갈려 보일것이다.
and 고장난걸로보인다.
but the step will 줄것이다. a 분명한 사진을 of the 전체 과정의.
So what do we actually want to do? 
We have a microcontroller(here Atmega 8). 
It runs on the default frequency it was shipped with. 
We want to run it on 16Mhz external crystal.
So 뭘 우리가 실제로 하길 원하는가?
우린 갖고있다. a Microcontroller ATmega8을
이건 돌아간다. on the 초기치 주파수에서 it was 배송된 with.
우린 원한다. to 동작시키길 그걸 on 16MHz 외부 크리탈에서.

So what to do exactly? Only see and change fuse bit values.
We should also not forget that 1 means unprogrammed 
and 0 means programmed.
So 할게 뭔가 정확히? Only 봐라 and 바꿔라. fuse bit 값들을.
우린 should also not 잊어선안된다. that 
1은 의미한다. unprogrammed를
0은 의미한다. programmed를.

Now, the chip is sitting with its default fuse byte configuration.
이제 the 칩은 놓여있다. with its 초기치 fuse byte 구성으로.

First of all we need to decide, how to run the microcontroller? 
For simplicity, lets take that we only have three options
- external crystal, external resonator or internal oscillator.
우선 우린 결정할필요가있다.
간략화하기위해, let's take that 우리가 only 갖고있다고 3개 옵션들을
-외부 Xtal, 외부 레조네이터 or 내부 오실레이터.


We found out that crystal oscillator is a reliable time keeping source 
and we dont mind spending a little for two 22pf capacitors. 
Our choice is now clear, we want to run the avr chip with an external crystal.

But where to get the options 
for making the choice of external crystal oscillator?
우린 찾아냈다. that 크리스탈 오실레이터가 신뢰할수있는 타임이라는걸 유지하며 source를
and 우린 신경쓰지않는다. 소모하는걸 a little for 2개 22pF capacitors를 위해.
But 어디인가 to get하기위해 the options를
for 만들기위해 the 초이스를 of 외부 크리스탈 오실레이터의?


The options are available at CKSEL3 to CKSEL0 
in the Low fuse byte. 
옵션들은 are available하다. at CKSEL 3 ~ 0에서
in the Low Fuse Byte에서.
We looked up the table provided in the microcontroller's datasheet
and 
found out that there is an option 
called cermaic resonator or crytal oscillator.
We certainly want this, 
so we note down the bit values of CKSEL3-CKSEL0 
associated with it.
우린 바라봤다. up the 표를 제공된 in the μC의 데이터시트에서
and
찾아냈다. that there is an 옵션이 있다는걸
불리는 세라믹 resonator or Xtal oscillator라고.
우린 확실히 원한다. 이걸,
so 우린 적어내려간다. the bit 값들을 of CKSEL3~0의
관련된 with 그것과.


Hmm, but there is a range of values for that, 1111-1010.
Which one to specifically take? 
And how to specify the frequency of the crystal oscillator? 
Obviously there are many frequencies available for crystals, 
we want to run it only on 16Mhz.
값의 범위는 1111 ~ 1010이다.  (F~A).
어떤걸 특별히 take해야할까?
And how to 특정화시키는법은? the Freq를 of the Xtal의?
분명히 there are 많은 Freq들이 있다. available한 for Xtal들을위한,
우린 원한다. to 동작시키기위해 it을 only on 16MHz상에서만.

For this, we look up at another table, 
containing the frequency 
and the recommended range of capacitors 
to be used with them.
In this table, we find that 16Mhz is greater that 1 Mhz 
so we choose that option. 
The bit value that was associated with CKOPT 
for our choice is 0 and along with that, 
we chose 111 for the values of CKSEL3-CKSEL1.
이걸위해, 우린 자세히봐야한다. at 다른 table을,
포함하는 the 주파수를
and the 추천된 범위를 of 커페시터들의
to be used with them.
이 테이블에서, 우린 찾는다. that 16MHz는 더크다.
so 우린 선택했다. that 옵션을
the bit value that was 관련된 with CKOPT에
for 우리 선택은 0이다. and 그와함께,
우린 선택했다. 111을 for the 값들을위해 CKSEL3~0의.

Now we are certain that we are running the avr chip 
with an external crytal of 16Mhz.
We just read an instructable about fuse bits 
and it talked of some start up time stuff 
which the crytal needs to warm up 
and start giving relaible signals.
이제 우린 확신한다. that 우리가 동작시키고 있다고 the AVR 칩을 
with an 외부 크리스탈 of 16MHz로.
우린 막 읽었다. an instructable을 about 퓨즈비트들에대한
and it talked of some 스타트업 뭔가를
which the Xtal이 필요로하는 준비하는데
and start 주기시작한다. 신뢰할만한 신호들을.
How do we find it ?
We find it again in a table 
provided in the same instructable. 
Now this table contains CKSEL0 value and SUT1 and SUT0 value. 
We choose the option of start up time 
of 65 milliseconds 
and thus our corresponding bit values are CKSEL0 -1, SUT1- 1, 
SUT0- 1.
어떻게 찾을 수 있을까?
우린 찾는다. it again in 테이블에서
제공된 in the 같은 instructable에서.
이제 이 테이블은 포함한다. CKSEL0 값을 and SUT1~0 값을.
우린 선택한다. the 옵션을 of the 스타트업 타임의
of 65 밀리세컨드로.
and 따라서 우리의 상응하는 bit 값은 CKSEL0은 1, SUT0은 1,
SUT0은 1이다.
We thus successfully completed choosing the set of Low fuse byte.

Initially the high fuse byte setting was-

우린 성공적으로 마무리지었다. 선택하는데 the set of Low Fuse Byte를.
처음 the High Fuse Byte 세팅은 was-
7)RSTDISBL- 1
6)WDTON - 1
5)SPIEN -0
4)CKOPT -1
3)EESAVE -1
2)BOOTSZ1 -0
1)BOOTSZ0 -0
0)BOOTRST -1

Now we have to change them to-

7)RSTDISBL -1
6)WDTON -1
5)SPIEN -0
4)CKOPT -0
3)EESAVE -1
2)BOOTSZ1 -0
1)BOOTSZ0 -0
0)BOOTRST -1

That is 11001001 in binary or C9 in hexadecimal. 
We are only changing the CKOPT from 1 to 0
leaving all others untouched.


Now for the low fuse byte, intially it was-

7)BODLEVEL -1
6)BODEN -1
5)SUT1 -1
4)SUT0 -0
3)CKSEL3 -0
2)CKSEL2 -0
1)CKSEL1 -0
0) CKSEL0 -1

We are changing it to-

7)BODLEVEL -1
6)BODEN -1
5)SUT1 -1
4)SUT0 -1
3)CKSEL3 -1
2)CKSEL2 -1
1)CKSEL1 -1
0) CKSEL0 -1

That is 11111111 in binary or FF in hexadecimal. 

Now since we are done doing evrything, 
we just need to burn these new settings in the microcontroller.
Using avrdude syntax, 
it should be-

avrdude -c usbasp -p m8 -U lfuse:w:0b11111111:m -U hfuse:w:0b11001001:m

But it is better to write this in hexadecimal, like- 

avrdude -c usbasp -p m8 -U lfuse:w:0xff:m -U hfuse:w:0xC9:m


The default values for Atmega8 internal 1Mhz oscillator was- 

avrdude -p atmega8 -c usbasp -U lfuse:w:0xE1:m -U hfuse:w:0xD9:m



Finally, the total procedure ends here.
Though this does not completely explain about fuses 
and how to program them, 
this definately gives a rough idea for beginners 
on what are fuses and how they are to be handled.
마지막으로 최종 절차는 끝났다.
비록 이건 does not  완벽히 설명되지않았더라도 about fuses에대해
and how to 프로그램하는법을,
이건 분명히 준다. a rough한 아이디어를 for 초보자들에게
on 무엇이 퓨즈들인지 and 어떻게 그것들이 다뤄지는지.
Happy DIY-ing :)

==========================================================

http://mulgu.kr/entry/Code-Example-ATMEGA848-UART-%EC%98%88%EC%A0%9C%EC%86%8C%EC%8A%A4



Posted by ElectricShock
:
BLOG main image
잡동사니들(지극히 개인취향인...) (다른글에도 댓글 부탁해요♥) You May Leave English Messages on GuestBook. by ElectricShock

공지사항

카테고리

분류 전체보기 (782)
Programming(=프로그래밍) (3)
MiDi (2)
Animation (4)
Blender (3D Graphic Program.. (10)
Blendtuts.com (Series) (1)
Blender 기초 팁들 (2)
Processing (디지털미디어과) (2)
Music (1)
Books in the world (0)
Communication(CAN, UART, et.. (12)
MCU Examples (PIC 기반) (7)
Transistor (1)
Mikro C Pro (11)
Mikro Pascal (1)
Proton IDE (0)
Robot (0)
Swift 3D (1)
Dummies Series (1)
All about Hacking (0)
제2 외국어 (1)
PIC 해외서적들 (3)
AVR (25)
PIC (MikroC) (MPLAB) (4)
Assembly (2)
ARM (3)
Arduino (26)
PSpice (1)
Proteus ISIS (14)
CodeVision (2)
FPGA (15)
MPLAB (24)
PCB (the Procedure) (15)
3D Printer (5)
PICKIT3 (6)
Matlab (11)
RaspBerry PI (15)
BeagleBone (1)
Android Studio (17)
졸업작품 (172)
Korea History (0)
Issue(사회) (73)
Multimeter 리뷰 (1)
Oscilloscope (1)
A (34)
B (19)
J (6)
C (32)
P (12)
T (37)
H (12)
I (12)
M (44)
R (5)
E (5)
F (2)
D (9)
O (2)
L (7)
S (9)
W (2)
V (6)
G (14)
Visual C++ or Visual Studio (2)
Android App Development (0)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백