레이블이 uCom인 게시물을 표시합니다. 모든 게시물 표시
레이블이 uCom인 게시물을 표시합니다. 모든 게시물 표시

2009년 10월 27일 화요일

[AVR] MCU Control Register

MCU Control Register – MCUCR

 

Bit

7

6

5

4

3

2

1

0

 

SRE

SRW10

SE

SM1

SM0

SM2

IVSEL

IVCE

Read/Write

R/W

R/W

R/W

R/W

R/W

R/W

R/W

R/W

Initial Value

0

0

0

0

0

0

0

0

 

Bit 7 – SRE: External SRAM/XMEM Enable

Writing SRE to one enables the External Memory Interface.The pin functions AD7:0,

A15:8, ALE, WR, and RD are activated as the alternate pin functions. The SRE bit overrides

any pin direction settings in the respective data direction registers. Writing SRE to

zero, disables the External Memory Interface and the normal pin and data direction settings

are used.

 

Bit 6 – SRW10: Wait-state Select Bit

For a detailed description in non-ATmega103 compatibility mode, see common description

for the SRWn bits below (XMCRA description). In ATmega103 compatibility mode,

writing SRW10 to one enables the wait-state and one extra cycle is added during

read/write strobe as shown in Figure 14.

 

 

2009년 10월 26일 월요일

[AVR] ATmega64와 ATmega128의 차이

 

ATmega64

ATmega128A

Flash (Kbytes)

64

128

EEPROM (Kbytes)

2

4

SRAM (Bytes)

4096

4096

Max I/O Pins

54

53

F.max (MHz)

16

16

Vcc (V)

2.7 – 5.5

2.7 – 5.5

10-bit A/D Channels

8

8

Analog Comparator

Yes

Yes

16-bit Timers

2

2

8-bit Timer

2

2

Brown Out Detector

Yes

Yes

Ext Interrupts

8

8

Hardware Multiplier

Yes

Yes

Interrupts

34

34

ISP

Yes

Yes

On Chip Oscillator

Yes

Yes

PWM Channels

8

8

RTC

Yes

Yes

Self Program Memory

Yes

Yes

SPI

1

1

TWI

Yes

Yes

UART

2

2

Watchdog

Yes

Yes

Pb-Free Packages

MLF (VQFN) 64

TQFP 64

MLF (VQFN) 64

TQFP 64

 

결론적으로는 메모리 차이인거다.

2009년 10월 21일 수요일

[AVR] Atmega128 Software reset

Software reset이 필요한 경우

 

asm("jmp 0");

 

또는

 

#define WDR asm("WDR")

WDR;

 

이렇게 하면 된다.

 

하드웨어적으로 리셋 시켜주는 편이 더 좋긴 하겠지만...

2009년 10월 19일 월요일

[AVR] ATmega I/O 레지스터

ATmega128 각 포트는 3개의 I/O레지스터를 사용하여 제어할 수 있도록 구성되어 있다.

 

DDRx(Data Direction Register) : 입출력의 방향 설정 (R/W)

PINx(Port Input Pins Register) : 포트 입력 핀 (Only Read)

PORTx : 데이터 출력 (R/W)

 

보통의 마이컴은 입력과 출력 데이터 레지스터를 구분하지 않는데 AVR의 경우 각각의 레지스터를 가진다.

 

 

* Datasheet 보러가기 : Atmega128L

 

* Datasheet 일부 발췌 (60page..)

Three I/O memory address locations are allocated for each port, one each for the Data

Register – PORTx, Data Direction Register – DDRx, and the Port Input Pins – PINx. The

Port Input Pins I/O location is read only, while the Data Register and the Data Direction

Register are read/write.

2009년 10월 14일 수요일

[PIC] carry는 알겠는데 digit carry는 뭔데?

OPCODE FIELD DESCRIPTIONS 보다가 질문.

 

Field

Description

f

Register file address (0x00 to 0x7F)

W

Working register (accumulator)

b

Bit address within an 8-bit file register

k

Literal field, constant data or label

x

Don't care location (= 0 or 1).

The assembler will generate code with x = 0.

It is the recommended form of use for

compatibility with all Microchip software tools.

d

Destination select; d = 0: store result in W,

d = 1: store result in file register f.

Default is d = 1.

PC

Program Counter

/TO

Time-out bit

C

Carry bit

DC

Digit carry bit

Z

Zero bit

/PD

Power-down bit

 

 

캐리가 뭔지는 안다.

이진수 1 + 1하면 캐리 1이고 값은 0.

그거 표시하려고 carry bit가 있는 것이라고 생각된다.

 

그럼 digit carry bit는 왜 있는거지? 이건 뭐지?

 

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

아래와 같이 답이 달렸다.

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

 

고장난우주선 2009/05/31 16:12

저도 궁금해서 검색좀 해봤는데요.

Digit Carry는 10진수에서 한지리 올라갈때 발생하는 자릿수 올림수 인거 같습니다.

Device를 정확히 모르겠으나.
PIC16F946 Datasheet를 보면.

STATUS<1> DC: A carry-out from the 4th low-order bit of the result occurred
STATUS<0> C: A carry-out from the Most Significant bit of the result occurred

이렇게 나와 있습니다.

Carry는 MSB에서 발생한 올림수.
Digit Carry는 하위 4bit 에서 상위 bit로 올라가는 올림수.
라는 뜻 같아요.

아마도, BCD code와 관련이 있을거 같은데요.
확실히는 모르겠구요.

BCD code는 뭔지 아실테니깐 생략하고,
BCD에서 1001 + 0001 = 0001 0000 이렇게 되잖아요.

제 짐작으로는 하위 4bit의 값이 1001 보다 클때 Digit Carry가 발생하는거 같습니다.

  • BlogIcon 윤뽀 2009/05/31 19:54

    전 Device PIC16F883입니다 ㅎ
    고장난우주선님과 같은 PIC16F 계열이라 반갑네요 >ㅅ<//

    BCD코드!
    그렇군요 진짜 생각지도 못했는데 ;

    883에 대한 Datasheet도 제대로 보지 못하고 막 시작한 일이라 이게 뭐지 이게 뭐지 하면서 전 그냥 DC를 Find만 해 봤었거든요

    시간을 좀 가지고 들여다봐야하는데 히~

    고장난우주선님 덕분에 좋은 정보를 얻고 있습니다
    이렇게 티스토리까지 왕림하셔서 알려주시다니 ㅠㅠ

    더구나 오늘은 주말! 일요일!

    놀고있는 제가 살짝 부끄럽습니다 *-_-*

    남은 주말 잘 보내시고, 힘차게 다음주 시작해 보아요~