1 / 5

FND(assembly)

FND(assembly). Code description. 20072413 박민호. Code - main. FND. LOOP: LDI R16, 0xFF ;R16 = 0xFF STS DIG_SELECT, R16 ;FND_CS = R16 LDI R16, 0xFF ;R16 = 0xFF STS FND_DATA, R16 ;FND_DATA = R16 LDI R17, 0x00 ;R17 = 0x00 LOOP1: MOV R16, R17 ;R16 = R17

aulii
Download Presentation

FND(assembly)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. FND(assembly) Code description • 20072413박민호

  2. Code - main FND LOOP: LDI R16, 0xFF ;R16 = 0xFF STS DIG_SELECT,R16 ;FND_CS = R16 LDI R16, 0xFF ;R16 = 0xFF STS FND_DATA, R16 ;FND_DATA = R16 LDI R17, 0x00 ;R17 = 0x00 LOOP1: MOV R16, R17 ;R16 = R17 CALL BIN2LED ;call BIN2LED subroutine STS FND_DATA, R16 ;FND_DATA = R16 CALL D50MS ;call D50MS subroutine INC R17 ;R17++ CPI R17, 0x10 ;(R17==0x10)? BRNE LOOP1 ;다르면 goto LOOP1 LDI R16, 'H' ;R16 = 'H' CALL BIN2LED ;call BIN2LED subroutine STS FND_DATA, R16 ;FND_DATA = R16 CALL D50MS ;call D50MS subroutine LDI R16, '-' ;R16 = '-' CALL BIN2LED ;call BIN2LED subroutine STS FND_DATA, R16 ;FND_DATA = R16 CALL D50MS ;call D50MS subroutine LDI R16, '.' ;R16 = '.' CALL BIN2LED ;call BIN2LED subroutine STS FND_DATA, R16 ;FND_DATA = R16 CALL D50MS ;call D50MS subroutine LDI R16, ''' ;R16 = ''' CALL BIN2LED ;call BIN2LED subroutine STS FND_DATA, R16 ;FND_DATA = R16 CALL D50MS ;call D50MS subroutine JMP LOOP ;goto LOOP 출처 : 수업자료

  3. Code - bin2led FND BIN2LED: PUSH R17 PUSH ZH PUSH ZL CPI R16, 'H' BRNE BIN2L1 LDI R16, 0x10 RJMP BIN2L4 BIN2L1: CPI R16, '-' BRNE BIN2L2 LDI R16, 0x11 RJMP BIN2L4 ... BIN2L4: LDI R17, byte3(FND_TABLE << 1) LDI ZH, high(FND_TABLE << 1) LDI ZL, low(FND_TABLE << 1) ADD ZL, R16 CLR R16 ADC ZH, R16 ADC R17, R16 OUT RAMPZ, R17 LPM R16, Z POP ZL POP ZH POP R17 RET FND_TABLE: .db 0b11000000, 0b11111001 ; 0, 1 .db 0b10100100, 0b10110000 ; 2, 3 .db 0b10011001, 0b10010010 ; 4, 5 .db 0b10000010, 0b11011000 ; 6, 7 .db 0b10000000, 0b10010000 ; 8, 9 .db 0b10001000, 0b10000011 ; a, b .db 0b11000110, 0b10100001 ; c, d .db 0b10000110, 0b10001110 ; e, f .db 0b10001001, 0b10111111 ; H, - .db 0b01111111, 0b11111111 ; ., ' RAMPZ 레지스터와 함께 z-pointer를 초기화해주기 위한 작업이다. 여기서는 LPM을 사용하므로, RAMPZ가 필요없다. 따라서 LDI R17, byte3(FND_TABLE<<1) ADC R17, R16 OUT RAMPZ, R17 이 세 줄은 없어도 상관없음!! ;첫 번째 바이트 더한 캐리를 두 번째 바이트에 더함 ;두 번째 바이트 더한 캐리를 세 번째 바이트에 더함 ;세 번째로 올라온 캐리를 RAMPZ set하는데 사용 출처 : 수업자료

  4. Sstate in memory FND 2x FND_TABLE: .db 0b11000000, 0b11111001 ; 0, 1 .db 0b10100100, 0b10110000 ; 2, 3 .db 0b10011001, 0b10010010 ; 4, 5 .db 0b10000010, 0b11011000 ; 6, 7 .db 0b10000000, 0b10010000 ; 8, 9 .db 0b10001000, 0b10000011 ; a, b .db 0b11000110, 0b10100001 ; c, d .db 0b10000110, 0b10001110 ; e, f .db 0b10001001, 0b10111111 ; H, - .db 0b01111111, 0b11111111 ; ., '

  5. Thank you FND Q&A

More Related