Note that there are some explanatory texts on larger screens.

plurals
  1. POARM Assembly for development board
    primarykey
    data
    text
    <p>I'm currently messing around with an LPC 2378 which has an application board attached. On the fan there are several components, 2 of which are a fan and a heater.</p> <p>If bits 6 and 7 of port 4 are connected to the fan (motor controller), the following code will turn on the fan:</p> <pre><code> FanOn STMFD r13!,{r0,r5,r14} ; Push r0, r5 and LR LDR R5, =FIO4PIN ; Address of FIO4PIN LDR r0, [r5] ; Read current Port4 ORR r0, r0, #0x80 STR r0, [r5] ; Output LDMFD r13!,{r0,r5,r14} ; Pop r0, r5 and LR mov pc, r14 ; Put link register back into PC </code></pre> <p>How can I rewrite this block of code to turn on a heater connected to bit 5 of port 4, (Setting the bit to 1 will turn it on, setting it to 0 will turn it off).</p> <p>Edit after answered question:</p> <pre><code>;============================================================================== ; Turn Heater On ;============================================================================== heaterOn STMFD r13!,{r0,r5,r14} ; Push r0, r5 and LR LDR R5, =FIO4PIN ; Address of FIO4PIN LDR r0, [r5] ; Read current Port4 ORR r0, r0, #0x20 STR r0, [r5] ; Output LDMFD r13!,{r0,r5,r14} ; Pop r0, r5 and LR mov pc, r14 ; Put link register back into PC ;============================================================================== ; Turn The Heater Off ;============================================================================== heaterOff STMFD r13!,{r0,r5,r14} ; Push r0, r5 and LR LDR R5, =FIO4PIN ; Address of FIO4PIN LDR r0, [r5] ; Read current Port4 AND r0, r0, #0xDF STR r0, [r5] ; Output LDMFD r13!,{r0,r5,r14} ; Pop r0, r5 and LR mov pc, r14 ; Put link register back into PC </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload