[an error occurred while processing this directive] [an error occurred while processing this directive]
Ответ: Смотри
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)
[an error occurred while processing this directive] [an error occurred while processing this directive]

Отправлено Bill 29 мая 2002 г. 11:04
В ответ на: Может у кого есть пример преобразования bin8 в BCD для AVR на asm. Спасибо. отправлено dm37 29 мая 2002 г. 09:38

;
; ** BinToBCD -- the routine to convert 8 bit binary number to a 2 digit BCD number
;
BinToBCD:
CLR R17 ; Set ten counter
?0005:
CPI R16, 10 ; See if the value is less then 10
BRCS ?0004 ; Branch if YES

SUBI R17, -16 ; Bump ten counter
SUBI R16, 10 ; Subtract 10
RJMP ?0005 ; Loop
?0004:
OR R16,R17 ; Combine high and low BCDs
RET

Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru