/MSP-EXP430FR6989/MSP-EXP430FR6989_IR_RC5_to_LCD_2x20_8MHz.4th
Forth | 492 lines | 444 code | 48 blank | 0 comment | 19 complexity | 14620233fb1bd7b7bb35b7ebf2696c32 MD5 | raw file
Possible License(s): GPL-3.0
- ; --------------------------------------------
- ; MSP-EXP430FR6989_IR_RC5_to_LCD_2x20_8MHz.4th
- ; --------------------------------------------
- STOP ; to stop any interrupt in progress
- WIPE ;
- NOECHO ; comment to debug
-
- ; FORTH source file
-
- ; Copyright (C) <2015> <J.M. THOORENS>
-
- ; This program is free software: you can redistribute it and/or modify
- ; it under the terms of the GNU General Public License as published by
- ; the Free Software Foundation, either version 3 of the License, or
- ; (at your option) any later version.
-
- ; This program is distributed in the hope that it will be useful,
- ; but WITHOUT ANY WARRANTY; without even the implied warranty of
- ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- ; GNU General Public License for more details.
- ;
- ; You should have received a copy of the GNU General Public License
- ; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- ; ====================================================
- ; DEMO test : Display IR_RC5 command on LCD 2x20 chars
- ; ====================================================
-
- ; if the RC5 message is troncated (end of previous interrupt after RC5 message start),
- ; it is ignored
- ;
- ; S1 and S2 switches allow to modify the LCD contrast
-
-
- ; target : MSP-EXP430fr6989 LAUNCHPAD @ 8 MHz running FastForth ; 922 bytes
- ; note : at 4MHz and 921600bds, the protocol XON/XOFF crashes if line is empty.
- ; So, all lines of a source file must contain a minima a space.
-
- ; ===================================================================================
- ; in case of 3.3V powered by UARTtoUSB bridge, open J101 straps {RST,TST,V+,5V} BEFORE
- ; ===================================================================================
-
- ; ---------------------------------------------------
- ; MSP - MSP-EXP430FR6989 LAUNCHPAD <--> OUTPUT WORLD
- ; ---------------------------------------------------
- ; P1.0 - LED1 red
- ; P9.7 - LED2 green
-
- ; P1.1 - Switch S1 <--- LCD contrast + (finger :-)
- ; P1.2 - Switch S2 <--- LCD contrast - (finger ;-)
-
- ; note : ESI1.1 = lowest left pin
- ; note : ESI1.2 is not connected to 3.3V
- ; GND/ESIVSS - ESI1.3 <-------+---0V0----------> 1 LCD_Vss
- ; VCC/ESIVCC - ESI1.4 >------ | --3V3-----+----> 2 LCD_Vdd
- ; | |
- ; |___ 470n ---
- ; ^ | ---
- ; / \ BAT54 |
- ; --- |
- ; 100n | 2k2 |
- ; P3.6 - J4.37 UCA1 CLK TB0.2 >---||--+--^/\/\/v--+----> 3 LCD_Vo (=0V6 without modulation)
- ; P9.0/ESICH0 - ESI1.14 <------------------------> 11 LCD_DB4
- ; P9.1/ESICH1 - ESI1.13 <------------------------> 12 LCD_DB5
- ; P9.2/ESICH2 - ESI1.12 <------------------------> 13 LCD_DB5
- ; P9.3/ESICH3 - ESI1.11 <------------------------> 14 LCD_DB7
- ; P9.4/ESICI0 - ESI1.10 -------------------------> 4 LCD_RS
- ; P9.5/ESICI1 - ESI1.9 -------------------------> 5 LCD_R/W
- ; P9.6/ESICI2 - ESI1.8 -------------------------> 6 LCD_EN0
-
- ; P3.4 - J101.8 UCA1 TXD ---> RX UARTtoUSB bridge
- ; P3.5 - J101.10 UCA1 RXD <--- TX UARTtoUSB bridge
- ; P3.0 - J101.14 RTS ---> CTS UARTtoUSB bridge (optional hardware control flow)
- ; VCC - J101.16 <--- VCC (optional supply from UARTtoUSB bridge - WARNING ! must be 3.3V !)
- ; GND - J101.20 <--> GND (optional supply from UARTtoUSB bridge)
-
- ; VCC - J1.1 ---> VCC SD_CardAdapter
- ; GND - J2.20 <--> GND SD_CardAdapter
- ; P2.2 - J4.35 UCA0 CLK ---> CLK SD_CardAdapter (SCK)
- ; P2.6 - J4.39 ---> CS SD_CardAdapter (Card Select)
- ; P2.0 - J1.8 UCA0 TXD/SIMO ---> SDI SD_CardAdapter (MOSI)
- ; P2.1 - J2.19 UCA0 RXD/SOMI <--- SDO SD_CardAdapter (MISO)
- ; P2.7 - J4.40 <--- CD SD_CardAdapter (Card Detect)
-
- ; P4.0 - J1.10 <--- OUT IR_Receiver (1 TSOP32236)
- ; VCC - J6.1 ---> VCC IR_Receiver (2 TSOP32236)
- ; GND - J6.2 <--> GND IR_Receiver (3 TSOP32236)
-
- ; PJ.4 - LFXI 32768Hz quartz
- ; PJ.5 - LFXO 32768Hz quartz
- ; PJ.6 - HFXI
- ; PJ.7 - HFXO
-
- ; P1.3 - J4.34 Soft I2C_Master <--> SDA software I2C Master
- ; P1.5 - J2.18 Soft I2C_Master ---> SCL software I2C Master
- ; P1.4 - J1.7 UCB0 CLK TA1.0 <--> free
- ; P1.6 - J2.15 UCB0 SDA/SIMO <--> SDA hardware I2C Master or Slave
- ; P1.7 - J2.14 UCB0 SCL/SOMI ---> SCL hardware I2C Master or Slave
-
-
- ; P3.0 - J4.33 UCB1 CLK ---> free (if UARTtoUSB with software control flow)
- ; P3.1 - J4.32 UCB0 SDA/SIMO <--> free
- ; P3.2 - J1.5 UCB0 SCL/SOMI ---> free
- ; P3.3 - J1.5 TA1.1 <--> free
-
-
-
- ; HERE ; general minidump, part 1
-
- ; ------------------------------;
- CODE 20_us ; n -- n * 20 us
- ; ------------------------------;
- BEGIN ; 3 cycles loop + 6~
- ; MOV #5,W ; 3 MCLK = 1 MHz
- ; MOV #23,W ; 3 MCLK = 4 MHz
- MOV #51,W ; 3 MCLK = 8 MHz
- ; MOV #104,W ; 3 MCLK = 16 MHz
- ; MOV #158,W ; 3 MCLK = 24 MHz
- BEGIN ; 3 cycles loop ==> 3 * W / F us = 100 us - 1 @ 8 MHz
- SUB #1,W ; 1
- 0= UNTIL ; 2
- SUB #1,TOS ; 1
- 0= UNTIL ; 2
- MOV @PSP+,TOS ; 2
- MOV @IP+,PC ; 4
- ENDCODE ; 20 cycles mini with call and return
-
- ; ------------------------------;
- CODE TOP_LCD ; LCD Sample
- ; ------------------------------; if write : 0bxxxxWWWW --
- ; ; if read : -- 0b0000RRRR
- BIS.B #0x40,Y ; P9OUT.6 LCD_EN 0-->1
- BIT.B #0x20,Y ; P9IN.5 LCD_RW test
- 0= IF ; write LCD bits pattern
- AND #0x0F,TOS ; keep low nibble
- ADD Y,TOS ; add CMD to DATA in TOS
- MOV.B TOS, &0x282 ; MOVE LCD_CMD_and_Data bits to P9OUT.0123456
- BIC.B #0x40,&0x282 ; P9OUT.6 LCD_EN 1-->0 ==> strobe data
- MOV @PSP+,TOS ;
- MOV @IP+,PC
- THEN ; read LCD bits pattern
- MOV.B Y,&0x282 ; MOVE LCD_CMD bits to P9OUT.456
- SUB #2,PSP
- MOV TOS,0(PSP)
- BIC.B #0x40,&0x282 ; P9OUT.6 LCD_EN 1-->0 ==> strobe data
- MOV.B &0x280,TOS ; get LCD_Data from P9IN.(0-3)
- AND.B #0x0F,TOS
- MOV @IP+,PC
- ENDCODE
-
- ; ------------------------------;
- CODE LCD_W ; byte -- write byte
- ; ------------------------------;
- SUB #2,PSP ;
- MOV TOS,0(PSP) ; -- 0bxxxxLLLL 0bHHHHLLLL
- RRUM #4,TOS ; -- 0bxxxxLLLL 0bxxxxHHHH
- BIC.B #0x20,Y ; P9OUT.5 LCD_RW=0
- BIS.B #0x0F,&0x284 ; P9DIR.(0-3) LCD_Data as output
- PUSH IP
- ASM>FORTH
- TOP_LCD 2 20_us \ write high nibble first
- TOP_LCD 2 20_us ; ;
-
- ; ------------------------------;
- CODE LCD_R ; -- byte read byte
- ; ------------------------------;
- BIC.B #0x0F,&0x284 ; P9DIR.(0-3) LCD_Data as intput
- BIS.B #0x20,Y ; P9OUT.5 LCD_RW=1
- PUSH IP
- ASM>FORTH
- TOP_LCD 2 20_us \ read high nibble first
- TOP_LCD 2 20_us
- FORTH>ASM ; -- 0b0000HHHH 0b0000LLLL
- MOV @RSP+,IP
- MOV @PSP+,W ; W = high nibble
- RLAM #4,W ; -- 0b0000LLLL W = 0bHHHH0000
- ADD.B W,TOS
- MOV @IP+,PC
- ENDCODE
-
- ; ------------------------------;
- CODE LCD_WrF ; func -- Write Fonction
- ; ------------------------------;
- MOV #0,Y ; P9OUT.4 LCD_RS=0
- JMP LCD_W
- ENDCODE
-
- ; ------------------------------;
- CODE LCD_RdS ; -- status Read Status
- ; ------------------------------;
- MOV #0,Y ; P9OUT.4 LCD_RS=0
- JMP LCD_R
- ENDCODE
-
- ; ------------------------------;
- CODE LCD_WrC ; char -- Write Char
- ; ------------------------------;
- MOV #0x10,Y ; P9OUT.4 LCD_RS=1
- JMP LCD_W
- ENDCODE
-
- ; ------------------------------;
- CODE LCD_RdC ; -- char Read Char
- ; ------------------------------;
- MOV #0x10,Y ; P9OUT.4 LCD_RS=1
- JMP LCD_R
- ENDCODE
-
- ; ------------------------------;
- ; : LCD_Clear 0x01 LCD_WrF 80 20_us ; ; perhaps bad init
- : LCD_Clear 0x01 LCD_WrF 100 20_us ;
-
- ; ------------------------------;
- : LCD_Home 0x02 LCD_WrF 80 20_us ;
- ; ------------------------------;
-
- ; : LCD_Entry_set 0x04 OR LCD_WrF ;
- ; : LCD_Display_Ctrl 0x08 OR LCD_WrF ;
- ; : LCD_Display_Shift 0x10 OR LCD_WrF ;
- ; : LCD_Fn_Set 0x20 OR LCD_WrF ;
- ; : LCD_CGRAM_Set 0x40 OR LCD_WrF ;
- ; : LCD_Goto 0x80 OR LCD_WrF ;
-
-
- ; ------------------------------;
- ; IR_RC5 driver ;
- ; ******************************;
- CODE IR_RC5 ; wake up on P4.0 change interrupt
- ; ******************************;
- BIC #0xF8,0(RSP) ; CPU on, GIE off in oldSR
- ; ------------------------------;
- ; in : SR(9)=old Toggle bit memory
- ; SMclock = 8 MHz or 16 MHz
- ; use : U,V,W,X,Y, TA0 timer, TA0R register
- ; out : U = 0 x T A4 A3 A2 A1 A0| 0 C6 C5 C4 C3 C2 C1 C0
- ; SR(9)=new Toggle bit memory
- ; ------------------------------;
- ; RC5_FirstStartBitHalfCycle: ;
- ; ------------------------------;
- MOV #0,&0x0360 ; predivide by 1 in TA0EX0 register ( 8 MHZ), reset value
- ; MOV #1,&0x0360 ; predivide by 2 in TA0EX0 register (16 MHZ)
- ; MOV #2,&0x0360 ; predivide by 3 in TA0EX0 register (24 MHZ)
- MOV #1778,X ; RC5_Period in us
- MOV #14,W ; count of loop
- BEGIN ;
- ; ------------------------------;
- ; RC5_TopSynchro: ; <--- loop back ---+ with readjusted RC5_Period
- ; ------------------------------; | here, we are just after 1/2 RC5_cycle
- MOV #0b1011100100,&0x0340 ; (re)start timer_A | SMCLK_pre/2 /8 : 2us time interval,free running,clear TA0_IFG and TA0R
- ; RC5_Compute_3_4Period: ; |
- RRUM #1,X ; X=1/2 cycle |
- MOV X,Y ; Y=1/2 ^
- RRUM #1,Y ; Y=1/4
- ADD X,Y ; Y=3/4
- ; RC5_Wait_1_4: ; wait 3/4 cycle after 1/2 cycle to sample RC5_Input at 1/4 cycle
- BEGIN CMP Y,&0x0350 ; CMP &TA0R with 3/4 cycle value
- = UNTIL ;
- ; ------------------------------;
- ; RC5_Sample: ; at 1/4 cycle, we can sample RC5_input, ST2/C6 bit first
- ; ------------------------------;
- BIT.B #0x01,&0x0221 ; C_flag = P4.0 = IR bit
- ADDC V,V ; C_flag <-- V(15):V(0) <-- C_flag
- MOV.B &0x0221,&0x0239 ; preset IES_4.0 state for next IFG
- BIC.B #0x01,&0x023D ; clear P4.0_IFG after full cycle pin change
- SUB #1,W ; decrement count loop
- ; count = 13 ==> V = x x x x x x x x |x x x x x x x /C6
- ; count = 0 ==> V = x x /C6 Tg A4 A3 A2 A1|A0 C5 C4 C3 C2 C1 C0 1
- 0<> WHILE ; ----> out of loop ----+
- ; RC5_compute_2_4_OverFlow: ; |
- ADD X,Y ; | out of bound = 5/4 period
- ; RC5_WaitHalfCycleP1.2_IFG: ; |
- BEGIN ; |
- CMP Y,&0x0350 ; | TA0R = 5/4 cycle test
- >= IF ; | if cycle time out of bound
- MOV #4,&0x0340 ; | stop timer_A and clear TA0R
- RETI ; | then quit to do nothing
- THEN ; |
- ; ------------------------------; |
- BIT.B #0x01,&0x023D ; ^ | test P4.0_IFG
- <> UNTIL ; | |
- MOV &0x0350,X ; | | get new RC5_period value
- REPEAT ; ----> loop back --+ |
- ; ------------------------------; |
- ; RC5_SampleEndOf: ; <---------------------+
- ; ------------------------------;
- MOV #4,&0x0340 ; stop timer_A
- RLAM #1,V ; V = x /C6 Tg A4 A3 A2 A1 A0|C5 C4 C3 C2 C1 C0 1 0
- ; ------------------------------;
- ; ------------------------------;
- ; Only New_RC5_Command ADD_ON ; use SR(9) bit as toggle bit
- ; ------------------------------;
- MOV @RSP,X ; retiSR(9) = old RC5 toggle bit
- RLAM #4,X ; retiSR(9) --> X(13)
- XOR V,X ; (new XOR old)(13) Toggle bit
- BIT #0x2000,X ; X(13) = New_RC5_command
- 0= IF ;
- RETI ; case of repeated RC5_command : RETI without SR(9) change
- THEN ;
- XOR #0x0200,0(RSP) ; change Toggle bit memory SR(9)
- ; ------------------------------;
- ; ------------------------------;
- ; RC5_ComputeNewRC5word ;
- ; ------------------------------;
- MOV.B V,U ; U= 0 0 0 0 0 0 0 0 C5 C4 C3 C2 C1 C0 0 0
- RRUM #2,U ; U= 0 0 0 0 0 0 0 0 0 0 C5 C4 C3 C2 C1 C0
- ; AND #0x7F00,V ; V= 0 /C6 Tg A4 A3 A2 A1 A0 0 0 0 0 0 0 0 0
- ; ADD V,U ; U= 0 /C6 Tg A4 A3 A2 A1 A0 0 0 C5 C4 C3 C2 C1 C0
- ; ------------------------------;
- ; RC5_ComputeC6bit ;
- ; ------------------------------;
- BIT #0x4000,V ; test /C6
- 0= IF BIS.B #0x40,U ; set C6 bit
- THEN ;
- ; ------------------------------;
- ; RC5_CommandByteIsDone: ; U= 0 0 0 0 0 0 0 0 0 C6 C5 C4 C3 C2 C1 C0
- ; ------------------------------;
-
-
- ; ------------------------------;
- ; Display IR_RC5 code ;
- ; ------------------------------;
- BIS.B #1,&0x0202 ; P1.0 OUT high ==> switch ON LED1
- ; ------------------------------;
- SUB #4,PSP ;
- MOV &BASE,2(PSP) ; save base
- MOV TOS,0(PSP) ;
- MOV.B U,TOS ;
- ASM>FORTH \ ; IP is free
- ['] LCD_CLEAR IS CR
- ['] LCD_WrC IS EMIT
- CR ." 0x" HEX 2 U.R
- ['] (CR) IS CR
- ['] (EMIT) IS EMIT
- FORTH>ASM ; nice code, right ?
- MOV @PSP+,&BASE
- ; ------------------------------;
- BIC.B #1,&0x0202 ; P1.0 OUT low ==> switch OFF LED1
- ; ------------------------------;
- RETI ; CPU is ON, GIE is OFF
- ENDCODE ;
- ; ------------------------------;
-
-
- ; ******************************;
- CODE WDT_Int ; Watchdog interrupt routine, warning : not FORTH executable !
- ; ******************************;
- BIC #0xF8,0(RSP) ; set CPU ON and GIE OFF in retiSR
- ; ------------------------------;
- BIT.B #0x02,&0x200 ; test P1IN.1 = switch S1
- 0= IF ; case of switch S2 pressed
- CMP #7,&0x3D6 ; TB0CCR2 ; mini Ton = 7/40 & VDD=3V3 ==> LCD_Vo = 0V04
- U>= IF ;
- SUB #1,&0x3D6 ; TB0CCR2 ; action for switch S1 (P1.1) : -72 mV / decrement
- THEN
- ELSE
- BIT.B #0x04,&0x200 ; test P1IN.2 = switch S2
- = IF
- CMP #36,&0x3D6 ; TB0CCR2 ; maxi Ton = 36/40 & VDD=3V3 ==> LCD_Vo = -2V04
- U< IF
- ADD #1,&0x3D6 ; TB0CCR2 ; action for switch S2 (P1.2) : 72 mV / increment
- THEN
- THEN
- THEN ;
- RETI ; CPU is ON, GIE is OFF
- ENDCODE
- ; ------------------------------;
-
-
- ; ------------------------------;
- CODE START ;
- ; ------------------------------;
- ; 0b0000 0010 1001 0100 ; TB0CTL = 0x3C0
- ; - - ; CNTL Counter lentgh ; 00 = 16 bits
- ; -- ; TBSSEL TimerB clock select ; 10 = SMCLK
- ; -- ; ID input divider ; 10 = /4
- ; -- ; MC Mode Control ; 01 = up mode
- ; - ; TBCLR TimerB Clear
- ; - ; TBIE
- ; - ; TBIFG
- ; ------------------------------;
- ; 0b0000 0000 0110 0000 ; TB0CCTLx = 0x3C{2,4,6,8,A,C,E}
- ; -- ; CM Capture Mode
- ; -- ; CCIS
- ; - ; SCS
- ; -- ; CLLD
- ; - ; CAP
- ; --- ; OUTMOD ; 011 = set/reset
- ; - ; CCIE
- ; - ; CCI
- ; - ; OUT
- ; - ; COV
- ; - ; CCIFG
- ; ------------------------------;
- ; ; TB0CCRx 0x3D{2,4,6,8,A,C,E}
- ; ; TB0EX0 0x3E0
- ; ------------------------------;
- ; set TimerB to make 50kHz PWM ;
- ; ------------------------------;
- ; MOV #0b1000010100,&0x3C0 ; TB0CTL = SMCLK/1, up mode, clear timer, no int
- ; MOV #0,&0x03E0 ; predivide by 1 in TB0EX0 register (1 MHZ) (generate 25 kHz PWM)
- ; ------------------------------;
- ; MOV #0b1000010100,&0x3C0 ; TB0CTL = SMCLK/1, up mode, clear timer, no int
- ; MOV #1,&0x03E0 ; predivide by 2 in TB0EX0 register (4 MHZ)
- ; ------------------------------;
- MOV #0b1010010100,&0x3C0 ; TB0CTL = SMCLK/4, up mode, clear timer, no int
- MOV #0,&0x03E0 ; predivide by 1 in TB0EX0 register (8 MHZ)
- ; ------------------------------;
- ; MOV #0b1010010100,&0x3C0 ; TB0CTL = SMCLK/4, up mode, clear timer, no int
- ; MOV #1,&0x03E0 ; predivide by 2 in TB0EX0 register (16 MHZ)
- ; ------------------------------;
- ; MOV #0b1010010100,&0x3C0 ; TB0CTL = SMCLK/4, up mode, clear timer, no int
- ; MOV #2,&0x03E0 ; predivide by 3 in TB0EX0 register (24 MHZ)
- ; ------------------------------;
- MOV #40,&0x3D2 ; TB0CCR0 = 40*0.5us=20us (40us @ 1MHz)
- ; ------------------------------;
- ; set TimerB to generate LCD_V0 via TB0.2 and P3.6/P6.6
- ; ------------------------------;
- MOV #0b1100000,&0x3C6 ; TB0CCTL2 output mode = set/reset ; clear CCIFG
- MOV #25,&0x3D6 ; TB0CCR2 ; contrast adjust : 25/40 ==> LCD_Vo = -1V3
- ; ------------------------------;
- ; init PORTB (P4:P3) (complement)
- BIS.B #0x40,&0x224 ; P3DIR.6 TB0.2 output
- BIS.B #0x40,&0x22C ; P3SEL1.6 TB0.2
- BIS.B #1,&0x239 ; P4IES.0 high to low edge select
- BIC.B #1,&0x23D ; P4IFG.0 clear int flag for TSOP32236 (after IES select)
- BIS.B #1,&0x23B ; P4IE.0 enable interrupt for TSOP32236
- ; ------------------------------;
- ; init PORTE (P9:P10) (complement)
- BIC.B #0xB0,&0x282 ; P9OUT.45 LCD_RS = LCD_RW = LED2 = 0
- BIS.B #-1,&0x284 ; P9DIR.0123 as output, wired to DB.4567 LCD_Data
- ; P9DIR.456 as outputs, wired to LCD_RS LCD_RW LCD_EN
- ; P9DIR.7 as output, LED2
- BIC.B #-1,&0x286 ; P9REN.0123 LCD_Data pullup/down disable
- ; P9REN.456 LCD_RS, LCD_RW, LCD_EN, pullup/down disable
- ; P9DIR.7 LED2 pullup/down disable
- ; ------------------------------;
- ; WDT interval init part ;
- ; ------------------------------;
- ; MOV #0x5A5E,&0x15C ; init WDT Vloclk source 10kHz /2^9 (50 ms), interval mode
- MOV #0x5A3D,&0x15C ; init WDT ACLK source 32.768kHz /2^13 (250 ms), interval mode
- ; MOV #0x5A5D,&0x15C ; init WDT Vloclk source 10kHz /2^13 (800 ms), interval mode
- BIS #1,&0x100 ; enable WDT interval mode interrupt in SFRIE
- ; ------------------------------;
- ; init interrupt vectors
- ; ------------------------------;
- MOV #IR_RC5,&0xFFCC ; init P4 interrupt vector
- MOV #WDT_int,&0xFFF2 ; init WDT interval vector interrupt
- ; ------------------------------;
- ; Init LCD
- ; ------------------------------;
- ASM>FORTH
- 0x03E8 20_us \ ; 1- wait 20 ms
- 0x03 TOP_LCD \ ; 2- send DB5=DB4=1
- 0xCD 20_us \ ; 3- wait 4,1 ms
- 0x03 TOP_LCD \ ; 4- send again DB5=DB4=1
- 5 20_us \ ; 5- wait 0,1 ms
- 0x03 TOP_LCD \ ; 6- send again again DB5=DB4=1
- 2 20_us \ ; wait 40 us = LCD cycle
- 0x02 TOP_LCD \ ; 7- send DB5=1 DB4=0
- 2 20_us \ ; wait 40 us = LCD cycle
- 0x28 LCD_WrF \ ; 8- 0b001DNFxx "FonctionSet" D=8/4 DataBus width, Number of lines=2/1, Font bold/normal
- 0x08 LCD_WrF \ ; 9- 0b1DCB "DisplayControl" : Display off, Cursor off, Blink off.
- LCD_Clear \ ; 10- "LCD_Clear"
- 0x06 LCD_WrF \ ; 11- 0b01xx "LCD_EntrySet" : address and cursor shift after writing in RAM
- 0x0C LCD_WrF \ ; 12- 0b1DCB "DisplayControl" : Display on, Cursor off, Blink off.
- ." Type STOP to quit IR_RC5_to_LCD"
- LIT RECURSE IS WARM \ ; insert this routine between COLD and WARM...
- (WARM) ; ; ...and continue with WARM
-
- CODE STOP
- MOV #0b1010000100,&0x3C0 ; TB0CTL = SMCLK/4, STOP mode, clear timer, no int
- BIC.B #0x01,&0x23B ; P4IE.0 disable interrupt for RC5_INT
- BIC #1,&0x100 ; disable WDT interval mode interrupt in SFRIE
- ASM>FORTH
- ['] (WARM) IS WARM \ ; reconnect WARM to (WARM)
- -1 ABORT"
- ; ; above, ABORT" followed by CRLF allows to compile an empty string...
-
- ; DUP HERE SWAP - DUMP ; general minidump, part 2
-
- ; words
-
- FORGET IR_RC5 FORGET WDT_Int ; not FORTH executable
- FORGET 20_us FORGET LCD_W ; because they are not necessary
- FORGET LCD_R FORGET TOP_LCD ; because they are not necessary
-
- ECHO
- ; compiling done
- RST_HERE ;
- START ; hit key enter :