Project

General

Profile

Вывод РОНа » History » Version 2

Version 1 (krufter_multiclet, 07/18/2013 07:22 PM) → Version 2/3 (krufter_multiclet, 07/19/2013 11:05 AM)

h1. Вывод РОНа

Для платы HW1-MCp04:

<pre>
.include "HDL50001_pcf.inc"

.alias ron2 4
.alias ron3 5

.alias UART_DATA UART0_DATA
.alias UART_BDR UART0_BDR
.alias UART_ST UART0_ST
.alias UART_CR UART0_CR

.alias UART_PORT_PIN 0x300
.alias UART_PORT_BPS GPIOB_BPS

.text

paragraph1:
setl #ron3, 0x12345678
jmp initUART
complete

initUART:
getl 0x00000300
wrl @1, UART_PORT_BPS
getl 0x00000104
wrl @1, UART_BDR
getl 0x00000003
wrl @1, UART_CR
jmp send_byte_UART
setl #ron2, 7
complete

send_byte_UART:
getl #ron2
jne @1, send_byte_UART
je @2, buf_TXD
getq #ron3
slrq @1, 8
setq #ron3, @1
wrl @3, UART_DATA
subl @7, 1
setl #ron2, @1
complete

buf_TXD:
rdl UART_ST
getl 0x00000004
and @1, @2
je @1, buf_TXD
jne @2, end
complete

end:
getl 0x1000
complete
</pre>

Для платы LDM-MCp04:

<pre>
.include "HDL50001_pcf.inc"

.alias ron2 4
.alias ron3 5

.alias UART_DATA
UART3_DATA
.alias UART_BDR UART3_BDR
.alias UART_ST UART3_ST
.alias UART_CR UART3_CR

.alias UART_PORT_PIN 0x300
.alias UART_PORT_BPS GPIOD_BPS

.text

paragraph1:
setl #ron3, 0x12345678
jmp initUART
complete

initUART:
getl 0x00000300
wrl @1, UART_PORT_BPS
getl 0x00000104
wrl @1, UART_BDR
getl 0x00000003
wrl @1, UART_CR
jmp send_byte_UART
setl #ron2, 7
complete

send_byte_UART:
getl #ron2
jne @1, send_byte_UART
je @2, buf_TXD
getq #ron3
slrq @1, 8
setq #ron3, @1
wrl @3, UART_DATA
subl @7, 1
setl #ron2, @1
complete

buf_TXD:
rdl UART_ST
getl 0x00000004
and @1, @2
je @1, buf_TXD
jne @2, end
complete

end:
getl 0x1000
complete
</pre>