PageRenderTime 49ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/MSP-EXP430FR5969/MSP-EXP430FR5969_RC5_to_I2CF_SoftM.4th

https://gitlab.com/Jean-Michel/FastForthForMSP430fr5xxx
Forth | 445 lines | 411 code | 34 blank | 0 comment | 13 complexity | 060d1de55250ff529afb2387f4acf6e1 MD5 | raw file
Possible License(s): GPL-3.0
  1. ; --------------------------------------
  2. ; MSP-EXP430FR5969_RC5_to_I2CF_SoftM.4th
  3. ; --------------------------------------
  4. STOP ; to stop any interrupt in progress
  5. WIPE ;
  6. NOECHO ; comment to debug
  7. ; FORTH source file
  8. ; Copyright (C) <2016> <J.M. THOORENS>
  9. ;
  10. ; This program is free software: you can redistribute it and/or modify
  11. ; it under the terms of the GNU General Public License as published by
  12. ; the Free Software Foundation, either version 3 of the License, or
  13. ; (at your option) any later version.
  14. ;
  15. ; This program is distributed in the hope that it will be useful,
  16. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ; GNU General Public License for more details.
  19. ;
  20. ; You should have received a copy of the GNU General Public License
  21. ; along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. ; ========================================
  23. ; DEMO : I2C_MASTER WRITE & I2C_SLAVE READ
  24. ; I2C_MASTER PART
  25. ; ========================================
  26. ; target : MSP-EXP430fr5969 LAUNCHPAD @ 8MHz
  27. ; ===================================================================================
  28. ; in case of 3.3V powered by UARTtoUSB bridge, open J13 straps {RST,TST,V+,5V} BEFORE
  29. ; ===================================================================================
  30. ; -----------------------------------------------
  31. ; MSP - LAUNCHPAD <--> OUTPUT WORLD
  32. ; -----------------------------------------------
  33. ; P4.6 - J6 - LED1 red
  34. ; P1.0 - LED2 green
  35. ; P4.5 - Switch S1 \\\ <--- LCD contrast + (finger :-)
  36. ; P1.1 - Switch S2 \\\ <--- LCD contrast - (finger ;-)
  37. ; GND - J1.2 \\\ <-------+---0V0----------> 1 LCD_Vss
  38. ; VCC - J1.3 \\\ >------ | --3V6-----+----> 2 LCD_Vdd
  39. ; \\\ | |
  40. ; \\\ |___ 470n ---
  41. ; \\\ ^ | ---
  42. ; \\\ / \ BAT54 |
  43. ; \\\ --- |
  44. ; \\\ 100n | 2k2 |
  45. ; P2.2 - J4.7 UCB0 CLK TB0.2 \\\ >---||--+--^/\/\/v--+----> 3 LCD_Vo (=0V6 without modulation)
  46. ; P3.4 - J4.8 \\\ -------------------------> 4 LCD_RS
  47. ; P3.5 - J4.9 \\\ -------------------------> 5 LCD_R/W
  48. ; P3.6 - J4.10 \\\ -------------------------> 6 LCD_EN0
  49. ; PJ.0 - J3.1 \\\ <------------------------> 11 LCD_DB4
  50. ; PJ.1 - J3.3 \\\ <------------------------> 12 LCD_DB5
  51. ; PJ.2 - J3.5 \\\ <------------------------> 13 LCD_DB5
  52. ; PJ.3 - J3.7 \\\ <------------------------> 14 LCD_DB7
  53. ; P2.0 - J13.8 UCA0 TXD ---> RX UARTtoUSB bridge
  54. ; P2.1 - J13.10 UCA0 RXD <--- TX UARTtoUSB bridge
  55. ; P4.1 - J13.14 RTS ---> CTS UARTtoUSB bridge (optional hardware control flow)
  56. ; VCC - J13.16 <--- VCC (optional supply from UARTtoUSB bridge - WARNING ! 3.3V !)
  57. ; GND - J13.20 <--> GND (optional supply from UARTtoUSB bridge)
  58. ; VCC - J11.1 ---> VCC SD_CardAdapter
  59. ; GND - J12.3 <--> GND SD_CardAdapter
  60. ; P2.4 - J4.6 UCA1 CLK ---> CLK SD_CardAdapter (SCK)
  61. ; P4.3 - J4.5 ---> CS SD_CardAdapter (Card Select)
  62. ; P2.5 - J4.4 UCA1 TXD/SIMO ---> SDI SD_CardAdapter (MOSI)
  63. ; P2.6 - J4.3 UCA1 RXD/SOMI <--- SDO SD_CardAdapter (MISO)
  64. ; P4.2 - J4.2 <--- CD SD_CardAdapter (Card Detect)
  65. ; P4.0 - J3.10 <--- OUT IR_Receiver (1 TSOP32236)
  66. ; VCC - J3.2 ---> VCC IR_Receiver (2 TSOP32236)
  67. ; GND - J3.9 <--> GND IR_Receiver (3 TSOP32236)
  68. ; PJ.4 - LFXI 32768Hz quartz
  69. ; PJ.5 - LFXO 32768Hz quartz
  70. ; PJ.6 - HFXI
  71. ; PJ.7 - HFXO
  72. ; P1.2 - J5.19 Soft I2C_Master <--> SDA <----------------------------------------------------> P1.6 other LAUNCHPAD
  73. ; P1.3 - J5.11 Soft I2C_Master ---> SCL -----------------------------------------------------> P1.7 other LAUNCHPAD
  74. ; P1.4 - J5.12 TB0.1 <--> free
  75. ; P1.5 - J5.13 UCA0 CLK TB0.2 <--> free
  76. ; P1.6 - J5.15 UCB0 SDA/SIMO <--> SDA
  77. ; P1.7 - J5.14 UCB0 SCL/SOMI <--- SCL
  78. ; P3.0 - J5.7 <--> free
  79. ; P2.3 - NC
  80. ; P2.7 - NC
  81. ; P3.1 - NC
  82. ; P3.2 - NC
  83. ; P3.3 - NC
  84. ; P3.7 - NC
  85. ; P4.4 - NC
  86. ; P4.7 - NC
  87. ; HERE ; general minidump, part 1
  88. ; ==========================================================;
  89. ; I2C SOFT MASTER Fast mode (400kHz) ;
  90. ; ==========================================================;
  91. ; P1.2 = SDA
  92. ; P1.3 = SCL
  93. ; use Px.0 to Px.3 for good timing at 8 MHz
  94. ; tested in RX and TX at 8 MHZ with 3k3 external pullup resistors
  95. ; results : speed in RX = TX = 270 kHz
  96. VARIABLE I2CSLV_ADR ; contents slave address & R/W
  97. VARIABLE I2CM_OUT ; buffer output, lentgh,DATA (low,HIGH)
  98. VARIABLE I2CM_IN ; buffer input, lentgh,DATA (low,HIGH)
  99. 2 ALLOT
  100. ; ------------------------------;
  101. CODE I2C_MTX ; MASTER TX one byte ; shared code for address and TX data
  102. ; ------------------------------;
  103. BEGIN ;
  104. ADD.B X,X ; 1 l shift one left
  105. U>= IF ; 2 l carry set ?
  106. BIC.B #0x04,&0x204 ; 4 l yes : P1DIR.2 as input ==> SDA high because pull up resistor
  107. ELSE ; 2 l
  108. BIS.B #0x04,&0x204 ; 4 l no : P1DIR.2 as output ==> SDA low
  109. THEN ; l _
  110. BIC.B #0x08,&0x204 ; 4 l _^ P1DIR.3 release SCL (high)
  111. BEGIN ; 14/16~l
  112. BIT.B #0x08,&0x200 ; 3 h test if SCL is released
  113. 0<> UNTIL ; 2 h _
  114. BIS.B #0x08,&0x204 ; 4 h v_ P1DIR.3 as output : force SCL low
  115. SUB #1,W ; 1 l dec count of bits
  116. 0= UNTIL ; 2 l
  117. ; ------------------------------;
  118. ; I2C_Master_TXreadAckOrNack ; here, SDA is indetermined, SCL is strech low by master
  119. ; ------------------------------;
  120. BIC.B #0x04,&0x204 ; 3 l P1DIR.2 as input : release SDA high
  121. ; JMP M_SCL ; 2 l
  122. MOV @RSP+,PC ; 4 l
  123. ENDCODE ;
  124. ; ------------------------------;
  125. ; P4.0 - J3.10 <--- OUT IR_Receiver (1 TSOP32236)
  126. ; VCC - J3.2 ---> VCC IR_Receiver (2 TSOP32236)
  127. ; GND - J3.9 <--> GND IR_Receiver (3 TSOP32236)
  128. ; ------------------------------;
  129. ; IR_RC5 driver ;
  130. ; ******************************;
  131. CODE IR_RC5 ; wake up on P4.0 change interrupt
  132. ; ******************************;
  133. BIC #0xF8,0(RSP) ; CPU on, GIE off in oldSR
  134. ; ------------------------------;
  135. ; in : SR(9)=old Toggle bit memory
  136. ; SMclock = 8 MHz or 16 MHz
  137. ; use : U,V,W,X,Y, TA0 timer, TA0R register
  138. ; out : U = 0 x T A4 A3 A2 A1 A0| 0 C6 C5 C4 C3 C2 C1 C0
  139. ; SR(9)=new Toggle bit memory
  140. ; ------------------------------;
  141. ; RC5_FirstStartBitHalfCycle: ;
  142. ; ------------------------------;
  143. MOV #0,&0x0360 ; predivide by 1 in TA0EX0 register ( 8 MHZ), reset value
  144. ; MOV #1,&0x0360 ; predivide by 2 in TA0EX0 register (16 MHZ)
  145. ; MOV #2,&0x0360 ; predivide by 3 in TA0EX0 register (24 MHZ)
  146. MOV #1778,X ; RC5_Period in us
  147. MOV #14,W ; count of loop
  148. BEGIN ;
  149. ; ------------------------------;
  150. ; RC5_TopSynchro: ; <--- loop back ---+ with readjusted RC5_Period
  151. ; ------------------------------; | here, we are just after 1/2 RC5_cycle
  152. MOV #0b1011100100,&0x0340 ; (re)start timer_A | SMCLK_pre/2 /8 : 2us time interval,free running,clear TA0_IFG and TA0R
  153. ; RC5_Compute_3_4Period: ; |
  154. RRUM #1,X ; X=1/2 cycle |
  155. MOV X,Y ; Y=1/2 ^
  156. RRUM #1,Y ; Y=1/4
  157. ADD X,Y ; Y=3/4
  158. ; RC5_Wait_1_4: ; wait 3/4 cycle after 1/2 cycle to sample RC5_Input at 1/4 cycle
  159. BEGIN CMP Y,&0x0350 ; CMP &TA0R with 3/4 cycle value
  160. = UNTIL ;
  161. ; ------------------------------;
  162. ; RC5_Sample: ; at 1/4 cycle, we can sample RC5_input, ST2/C6 bit first
  163. ; ------------------------------;
  164. BIT.B #0x01,&0x0221 ; C_flag = P4.0 = IR bit
  165. ADDC V,V ; C_flag <-- V(15):V(0) <-- C_flag
  166. MOV.B &0x0221,&0x0239 ; preset IES_4.0 state for next IFG
  167. BIC.B #0x01,&0x023D ; clear P4.0_IFG after full cycle pin change
  168. SUB #1,W ; decrement count loop
  169. ; count = 13 ==> V = x x x x x x x x |x x x x x x x /C6
  170. ; count = 0 ==> V = x x /C6 Tg A4 A3 A2 A1|A0 C5 C4 C3 C2 C1 C0 1
  171. 0<> WHILE ; ----> out of loop ----+
  172. ; RC5_compute_2_4_OverFlow: ; |
  173. ADD X,Y ; | out of bound = 5/4 period
  174. ; RC5_WaitHalfCycleP1.2_IFG: ; |
  175. BEGIN ; |
  176. CMP Y,&0x0350 ; | TA0R = 5/4 cycle test
  177. >= IF ; | if cycle time out of bound
  178. MOV #4,&0x0340 ; | stop timer_A and clear TA0R
  179. RETI ; | then quit to do nothing
  180. THEN ; |
  181. ; ------------------------------; |
  182. BIT.B #0x01,&0x023D ; ^ | test P4.0_IFG
  183. <> UNTIL ; | |
  184. MOV &0x0350,X ; | | get new RC5_period value
  185. REPEAT ; ----> loop back --+ |
  186. ; ------------------------------; |
  187. ; RC5_SampleEndOf: ; <---------------------+
  188. ; ------------------------------;
  189. MOV #4,&0x0340 ; stop timer_A
  190. RLAM #1,V ; V = x /C6 Tg A4 A3 A2 A1 A0|C5 C4 C3 C2 C1 C0 1 0
  191. ; ------------------------------;
  192. ; ------------------------------;
  193. ; Only New_RC5_Command ADD_ON ; use SR(9) bit as toggle bit
  194. ; ------------------------------;
  195. MOV @RSP,X ; retiSR(9) = old RC5 toggle bit
  196. RLAM #4,X ; retiSR(9) --> X(13)
  197. XOR V,X ; (new XOR old)(13) Toggle bit
  198. BIT #0x2000,X ; X(13) = New_RC5_command
  199. 0= IF ;
  200. RETI ; case of repeated RC5_command : RETI without SR(9) change
  201. THEN ;
  202. XOR #0x0200,0(RSP) ; change Toggle bit memory SR(9)
  203. ; ------------------------------;
  204. ; ------------------------------;
  205. ; RC5_ComputeNewRC5word ;
  206. ; ------------------------------;
  207. MOV.B V,U ; U= 0 0 0 0 0 0 0 0 C5 C4 C3 C2 C1 C0 0 0
  208. RRUM #2,U ; U= 0 0 0 0 0 0 0 0 0 0 C5 C4 C3 C2 C1 C0
  209. ; AND #0x7F00,V ; V= 0 /C6 Tg A4 A3 A2 A1 A0 0 0 0 0 0 0 0 0
  210. ; ADD V,U ; U= 0 /C6 Tg A4 A3 A2 A1 A0 0 0 C5 C4 C3 C2 C1 C0
  211. ; ------------------------------;
  212. ; RC5_ComputeC6bit ;
  213. ; ------------------------------;
  214. BIT #0x4000,V ; test /C6
  215. 0= IF BIS.B #0x40,U ; set C6 bit
  216. THEN ;
  217. ; ------------------------------;
  218. ; RC5_CommandByteIsDone: ; U= 0 0 0 0 0 0 0 0 0 C6 C5 C4 C3 C2 C1 C0
  219. ; ------------------------------;
  220. ; Prepare I2C_MASTER ;
  221. ; ------------------------------;
  222. SWPB U ; 1 high byte = data
  223. ADD #1,U ; 1 low byte = count
  224. MOV U,&I2CM_OUT ; 3
  225. ; ------------------------------;
  226. ; SUB #2,PSP
  227. ; MOV TOS,0(PSP)
  228. ; MOV.B U,TOS
  229. ; ASM>FORTH
  230. ; cr ." 0x" HEX 2 U.R
  231. ; FORTH>ASM
  232. ; ==============================;
  233. ; CODE I2C_M ; soft I2C_Master driver
  234. ; ==============================;
  235. ; ; in : I2CSLV_ADR & (R/W)
  236. ; ; : I2CM_IN/I2CM_OUT as requested by I2C_SLA_ADR(0)
  237. ; ; : I2CM_IN/I2CM_OUT(0) = count of datas to be TX/RX
  238. ; ; : I2CM_IN/I2CM_OUT(0) = 0 ==> send only I2C address
  239. ; ; used: U BUF_PTR
  240. ; ; V count of I2C datas exchanged
  241. ; ; W count of bits
  242. ; ; X data
  243. ; ; Y BUF_ORG
  244. ; ; out : I2CSLV_ADR & (R/W) unchanged
  245. ; ; Y = BUF_ORG
  246. ; ; U = BUF_PTR pointing on first data not exchanged
  247. ; ; V = count+1 of TX/RX datas exchanged (if ack on addr)
  248. ; ; I2CM_IN/OUT(0) = count of data not exchanged (normally = 0)
  249. ; ; I2CM_IN/OUT(0) = -1 <==> Nack on address
  250. ; ------------------------------;
  251. ; I2C_Master_Start_Cond: ; here, SDA and SCL are in idle state
  252. ; ------------------------------;
  253. BIS.B #0x04,&0x204 ; 4 l P1DIR.2 force SDA output (low)
  254. MOV.B &I2CSLV_ADR,X ; 3 h @ in X
  255. MOV #I2CM_OUT,U ; 2 h buffer out by default
  256. BIT.B #1,X ; 1 h test I2C R/w flag
  257. 0<> IF ; 2 h
  258. MOV #I2CM_IN,U ; 2 h buffer in
  259. THEN ;
  260. MOV U,Y ; 1 h U=BUF_ptr Y=BUF_org
  261. MOV.B @U+,V ; 2 h V = count of datas
  262. ; ; ------------------------------;
  263. ; ; Init M_TI2C first ! ; IP must be initialized
  264. ; ; ------------------------------;
  265. ; MOV #2,IP ; 1 h tHD:STA=4us, 15~ complement @ 8MHz
  266. ; ; MOV #13,IP ; 2 h tHD:STA=4us, 48~ complement @ 16MHz
  267. ; ; MOV #23,IP ; 2 h tHD:STA=4us, 78~ complement @ 24MHz
  268. ; ; ------------------------------;
  269. ; CALL #M_TI2C ; wait tHD;STA
  270. BIS.B #0x08,&0x204 ; 4 h P1DIR.3 force SCL output (low)
  271. ; ------------------------------; l
  272. ; I2C_Master_Start_EndOf: ;
  273. ; ------------------------------;
  274. ; I2C_Master_Send_address ; may be SCL is held low by slave
  275. ; ------------------------------;
  276. ADD #1,V ; 1 l to add address in count
  277. MOV #8,W ; 1 l prepare 8 bit Master writing
  278. ; ; ADD #0,IP ; 2 l tLOW=4,7us, 15~ complement @ 8MHz
  279. ; ; ADD #3,IP ; 2 l tLOW=4,7us, 54~ complement @ 16MHz
  280. ; ; ADD #4,IP ; 2 l tLOW=4,7us, 90~ complement @ 24MHz
  281. ; ------------------------------;
  282. CALL #I2C_MTX ; 4 l to send address
  283. ; ------------------------------;
  284. BEGIN ;
  285. ; ; ADD #0,IP ; 2 l +15~ complement @ 8MHz
  286. ; ; ADD #0,IP ; 2 l +45~ complement @ 16MHz
  287. ; ; ADD #0,IP ; 2 l +78~ complement @ 24MHz
  288. ; CALL #M_TI2C ; wait still tLOW=4,7us
  289. ; ------------------------------; l
  290. ; Master TX/RX ACK/NACK ;
  291. ; ------------------------------; l _
  292. ; CALL #M_SCL ; SCL _| |_ C flag = NACK
  293. BIC.B #0x08,&0x204 ; 3 l _^ P1DIR.3 release SCL (high)
  294. BEGIN ;
  295. BIT.B #0x08,&0x200 ; 3 h test if SCL is released
  296. 0<> UNTIL ; 2 h
  297. BIT.B #0x04,&0x200 ; 3 h _ P1IN.2 : get SDA
  298. BIS.B #0x08,&0x204 ; 3 h v_ P1DIR.3 as output : force SCL low
  299. ; ------------------------------; l
  300. ; I2C_Master_Loop_Data ;
  301. ; ------------------------------;
  302. 0<> IF BIS #2,SR ; 5 l if Nack (TX), force Z+1 ==> StopCond
  303. ELSE SUB.B #1,V ; 3 l else dec count
  304. THEN ; l
  305. ; --------------------------;
  306. ; I2C_Master_CheckCountDown ; count=0 or Nack received
  307. ; --------------------------;
  308. 0= IF ; 2 l count reached or Nack
  309. ; ----------------------;
  310. ; I2C_Master_StopCond ;
  311. ; ----------------------; _
  312. BIS.B #0x04,&0x204 ; SDA |_ P1DIR.2 as output ==> SDA low
  313. SUB.B V,0(Y) ; 4 l _ refresh buffer length
  314. BIC.B #0x08,&0x204 ; SCL _| P1DIR.3 release SCL (high)
  315. BEGIN ;
  316. BIT.B #0x08,&0x200 ; 3 h SCL released ?
  317. 0<> UNTIL ; 2 h
  318. ; CALL #M_TI2C ; _ wait tSU:STO=0.6us
  319. BIC.B #0x04,&0x204 ; SDA _| P1DIR.2 as input ==> SDA high with pull up resistor
  320. ; ----------------------;
  321. ; I2C_Master_Endof ;
  322. ; ----------------------;
  323. RETI ; ====> unique return
  324. ; --------------------------;
  325. THEN ;
  326. ; --------------------------;
  327. MOV.B #8,W ; 1 l prepare 8 bits transaction
  328. BIT #1,&I2CSLV_ADR ; 3 l I2C_Master Read/write bit test
  329. 0= IF ; 2 l write flag test
  330. ; ======================;
  331. ; I2C_Master_TX ;
  332. ; ======================;
  333. MOV.B @U+,X ; 2 l next byte to transmit
  334. ; ; ADD #0,IP ; 2 l tLOW=4,7us, 15~ complement @ 8MHz
  335. ; ; SUB #3,IP ; 2 l tLOW=4,7us, 36~ complement @ 16MHz
  336. ; ; SUB #2,IP ; 2 l tLOW=4,7us, 72~ complement @ 24MHz
  337. ; ----------------------; 17 l
  338. CALL #I2C_MTX ; Master send 8 bits of address then release SDA
  339. ; ----------------------; 4 l
  340. ELSE ; l
  341. ; ======================;
  342. ; I2C_Master_RX: ; here, SDA is indetermined, SCL is strech low by master
  343. ; ======================;
  344. BEGIN ;
  345. BIC.B #0x04,&0x204 ; 4 l P1DIR.2 as input ==> release SDA high because pull up resistor
  346. ; ; ADD #0,IP ; 2 l tLOW=4,7us, 6~ complement @ 8MHz
  347. ; ; SUB #1,IP ; 2 l tLOW=4,7us, 42~ complement @ 16MHz
  348. ; ; ADD #1,IP ; 2 l tLOW=4,7us, 81~ complement @ 24MHz
  349. ; ; CALL #M_TI2C ; wait still tLOW
  350. ; --------------------; 8 l _
  351. ; CALL #M_SCL ; SCL _| |_
  352. BIC.B #0x08,&0x204 ; 3 l _^ P1DIR.3 release SCL (high)
  353. BEGIN ;
  354. BIT.B #0x08,&0x200 ; 3 h test if SCL is released
  355. 0<> UNTIL ; 2 h
  356. BIT.B #0x04,&0x200 ; 3 h _ P1IN.2 : get SDA
  357. BIS.B #0x08,&0x204 ; 3 h v_ P1DIR.3 as output : force SCL low
  358. ; --------------------; 4 l
  359. ADDC.B X,X ; 1 l C <-- X <--- C
  360. SUB #1,W ; 1 l count of bits
  361. 0= UNTIL ; 2 l
  362. MOV.B X,0(U) ; 3 l store byte @ BUF_ptr
  363. ADD #1,U ; 1 l
  364. ; ----------------------;
  365. ; I2C_MSendAckOrNack ; here, SDA is released by slave, SCL is strech low by master
  366. ; ----------------------;
  367. SUB.B #1,V ;
  368. 0<> IF ; 2
  369. BIS.B #0x04,&0x204 ; 4 l prepare send Ack if byte count <> 1
  370. THEN ;
  371. THEN ;
  372. AGAIN ; 2 l
  373. ENDCODE ;
  374. ; ------------------------------;
  375. ; ------------------------------;
  376. CODE START ;
  377. ; ------------------------------;
  378. ; I2C_MASTER init part ;
  379. ; ------------------------------;
  380. MOV #0b0010100,&I2CSLV_ADR ; MSP-EXP430FR5969 slave address, not the tn2313_KPD12 one
  381. ; ------------------------------;
  382. ; init PORTB (P2:P1) (complement) default I/O are input with pullup resistors
  383. ; ------------------------------;
  384. BIC.B #0x0C,&0x206 ; P1REN.23 SDA, SCL internal pullup resistors disabled
  385. BIC.B #0x0C,&0x204 ; P1DIR.23 master SDA & SCL pins as input high
  386. BIC.B #0x0C,&0x202 ; P1OUT.23 preset SDA output low
  387. ; ------------------------------;
  388. ; init PORTB (P4:P3) (complement) default I/O are input with pullup resistors
  389. ; ------------------------------;
  390. BIC.B #0x01,&0x23D ; P4IFG.0 clear int flag for TSOP32236 (after IES select)
  391. BIS.B #0x01,&0x23B ; P4IE.0 enable interrupt for TSOP32236
  392. ; ------------------------------;
  393. ; init interrupt vectors ;
  394. ; ------------------------------;
  395. MOV #IR_RC5,&0xFFD0 ; init P4 vector interrupt
  396. ; ------------------------------;
  397. ASM>FORTH
  398. ." Type STOP to quit RC5_to_I2C_Fast_SoftMaster"
  399. LIT RECURSE IS WARM \ ; insert this routine between COLD and WARM...
  400. (WARM) ; ; ...and continue with WARM
  401. CODE STOP
  402. BIC.B #0x01,&0x23B ; Clear P4IE.0 IR_RC5 interrupt from TSOP32236
  403. ASM>FORTH
  404. ['] (WARM) IS WARM \ ; reconnect WARM to (WARM)
  405. -1 ABORT"
  406. ; ; above, ABORT" followed by CRLF allows to compile an empty string...
  407. ; DUP HERE SWAP - DUMP ; general minidump, part 2
  408. FORGET I2C_MTX FORGET IR_RC5 ; because not FORTH executable
  409. ECHO
  410. RST_HERE
  411. START