This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

RSLK LAB 3 SOLUTION CODE



Hello,

Does anyone have the solution code to Lab 3 for the RSLK? It is writing an assembly code to convert sensor data into mm.

Thanks.

  • Hello,

    The RSLK curriculum has a downloadable software which has starter code for the labs. The intention is for the student to review the videos, lab documents and edit and modify the codes. Most of the hints are within the lab documents. 
    As this is used in curriculum by universities, we don't provide the solution, unless you are a faculty. 

    Thanks for your understanding. Hope the review of the module 2-3 should help. In addition you can find several resources on the professor's home page. 

  • So can people in industry not get solutions?

    I am stuck on the line of code below, if input < 2552, set output to 800:

    My code gets 15/16 test cases right except for the first input value which is under 2552.

    Convert: .asmfunc
    ; put your solution here
    LDR R3, IRMax
    LDR R2, IRSlope
    LDR R1, IROffset
    MVN R1, R1
    ADD R1, R1, #1
    SUB R1, R0, R1
    UDIV R0, R2, R1

    ;if input < 2552, set output to 800
    CMP R0, R3
    IT LO
    LDRLO R0, IRLow
    BX LR

    .endasmfunc
    .align 4
    IRSlope .field 1195172,32
    IROffset .field -1058,32
    IRMax .field 2552,32
    IRLow .field 800,32
    .end

    There is not really anything about how to do this in the videos. 

  • Here is what you had earlier:

    Convert: .asmfunc
    ; put your solution here
    LDR R2, IRSlope //load slope
    LDR R1, IROffset //load offset
    MVN R1, R1 //flip offset because its negative
    ADD R1, R1, #1
    SUB R0, R0, R1 //subtract input by offset
    UDIV R0, R0, R1 //divide input-offset by slope, IS MAKING R0 = 0?

    Note below: 

    the divide is wrong, you want 1195172/(n – 1058)

    R2 has 1195172

    R0 has (n – 1058)

    UDIV R0,R2,R0


  • Yes, I fixed that. The part that I am stuck on is how to do conditional statements in Assembly.

  • Hi,

    I recommend using a reference book for assembly programming.

    The module 3 which includes assembling coding is a cursor to some fundamentals on micro controllers. 
    This is an optional module.

    Please also review the user guide, the module 21 which guides you to what modules you need for completing challenges.

    Module 5 should help you build the robot and then work through 6-14. Module 15 will require additional components not included in the kit.

    Hope this helps.

    Ayesha 

  • Closing this.

    Thanks

    Ayesha

**Attention** This is a public forum