A forth for LPC8xxx
Hello
Diff: lpc8xx.s
- Revision:
- 1:1224cf3799a5
- Parent:
- 0:df922596d756
--- a/lpc8xx.s Fri Dec 04 13:09:58 2015 +0000 +++ b/lpc8xx.s Thu May 12 15:53:05 2016 +0000 @@ -1,3 +1,5 @@ +; MSEl=6, PSEL=1, DIV=3 ==> 28MHz + RAMForIAP EQU 128 RomSize EQU 0x4000 @@ -180,6 +182,9 @@ ; Configure USART 0/1/2 for receiving and transmitting data: ; In the SYSAHBCLKCTRL register, set bit 14 to 16 (Table 18) to enable the clock to the register interface. + +; FLASHCFG et FLASHTIM >> à seter to 0 !!!!!!!!! + UartConfig MOVS r2, #1 LSLS r2, #14 ; USART0 (bit 14) @@ -193,7 +198,7 @@ LDR r1,=PINASSIGN0 STR r0,[r1] ;Configure the UART clock div - MOVS r0,#3 ; UART clock 4MHz + MOVS r0,#3 ; UART clock 4MHz/16 LDR r1,=UARTCLKDIV STR r0,[r1] LDR r1,=(USART0) @@ -201,7 +206,8 @@ MOVS r0,#0x05 ; 8 bits, no Parity, 1 Stop bit */ STR r0, [r1,#CFG] ;Configure BRG - MOVS r0,#207 ; = 4000000/19200 -1 + MOVS r0,#12 ; 19200bps +; MOVS r0,#3 ; 57600bps STR r0,[r1,#BRG] BX lr LTORG @@ -210,7 +216,7 @@ ; and leave the xEmit label on ; the same line as instruction ;----------------------------------- -LTx LINK LExit +LTx LINK LDup DCB 4 DCB "EMIT" @@ -218,26 +224,16 @@ ; Place here your code for the Emit ; routine ; If it is a high level put a doCol -; at the begenning and an Exit at the end +; at the beginning and an Exit at the end ;----------------------------------- +Emit DCD xEmit xEmit LDR r1,=(USART0) Emit1 LDR r2,[r1,#STAT] LSRS r2,#3 BCC Emit1 ; ? ready to Xmit STR TOS,[r1,#TXDAT] ; Xmit POP {TOS} ; Discard & Update TOS - RET - -;xEmit doCol -; DCB Lit32 !ne marche pas -; DCD USART0 ; (char, USART0) ! -;Emit1 DCB Dup ; (char,USART0, USART0) !ne marche pas -; DCB Lit8, STAT, Plus, At ; (char, USART0, @Stat) -; DCB Lit8, 4, And ; (char, USART0, flag) !ne marche pas -; ZBranch Emit1 ; (char, USART0) -; DCB Lit8, TX, Plus ; (char, USART0Tx) !ne marche pas -; DCB Store -; DCB Exit + Next ;----------------------------------- ; DONT Change the 4 lines below @@ -247,14 +243,15 @@ LRecv LINK LTx DCB 4 DCB "KEY?" - +KeyQ DCD Recv0 ;----------------------------------- ; Place here your code for the Key? ; routine ; If it is a high level put a doCol ; at the beginning and an Exit at the end ;----------------------------------- -KeyQ PUSH {TOS} + +Recv0 PUSH {TOS} LDR r1,=(USART0) LDR r2,[r1,#STAT] LSRS r2,#1 @@ -262,7 +259,7 @@ LDR TOS,=0xffffffff ; True flag B Recv2 Recv1 SUBS TOS,TOS ; Clear TOS (false falg) -Recv2 RET +Recv2 Next ;----------------------------------- ; DONT Change the 4 lines below @@ -270,7 +267,7 @@ LKey LINK LRecv DCB 3 DCB "KEY" - +Key DCD xKey ;----------------------------------- ; Place here your code for the Key ; routine @@ -283,5 +280,5 @@ LSRS r2,#1 BCC Key1 LDR TOS,[r1,#RXDAT] - RET + Next END \ No newline at end of file