1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Testing RAM on Board using Machine Assembly Code

  1. Mar 18, 2012 #1
    I'm currently taking a Microprocessor course and we are adding to our breadboard week by week. The most recent add on was a UT6264CPCL RAM chip. Other chip specifications are given below in in 2. Relevant equations. My question is, how do we test to make sure that the RAM is working using two LEDs (one for it works and one for it doesn't)? I know a little bit about machine assembly language (using AVR Studio 4) and that's what we're programming our boards with (RAM Tester code attached). I'm certain everything is wired up correctly and I've done multiple tests to be sure there's no busted buses. Any help or pointers is greatly appreciated!

    1. The problem statement, all variables and given/known data

    How do you test to make sure that the RAM is working using two LEDs (one for it works and one for it doesn't)?

    2. Relevant equations

    (Attachment 1 - Ram Tester Code)

    Microcontroller - Atmega 8515
    Decoder - DM74LS138
    Latch - SN74ALS573CN
    Driver/Receiver (used for reset switch) - MAX233CPP

    3. The attempt at a solution

    (Attachment 1 - Ram Tester Code)
     

    Attached Files:

  2. jcsd
  3. Mar 18, 2012 #2

    rcgldr

    User Avatar
    Homework Helper

    Those tests will check for data issues, but not address issues. You need to add a test that uses one loop to fill ram with a cycling pattern of data, then a second loop to read all the ram and compare with the pattern. To check all bits, repeat these two pattern loops, using variations on the pattern and addresses so all bits and address lines are checked.
     
    Last edited: Mar 18, 2012
  4. Mar 18, 2012 #3
    Thank you for the response!! The only thing is, I'm not the strongest with Assembly language, so I'm having a little difficulty implementing those tests. Any suggestions? Would this mean I choose one port of addresses on the chip to put a test LED in?
     
  5. Mar 18, 2012 #4

    rcgldr

    User Avatar
    Homework Helper

    I assume the LED's can be hooked up to any port. The if the test fails, you light up one of them, if the test passes you light the other one.

    You could zero out all of memory, then write to addresses[0 -> 254] with the value 1 to 255, then read all of memory to verify that only addresses[0 -> 254] had values 1 to 255. The zero addresses[0->254], and fill addresses [255->509] with 1 to 255, read all of memory to verify that only addresses[255->509] had values 1 to 255. Then zero addresses[255->509], ... and repeat this cycle until you tested all addresses. You could repeat this test alternating between 0x55 and 0xaa.
     
  6. Mar 19, 2012 #5
    Does assembly language have a similar call out to if statements? That's how I would do it if I were writing this code in C/C++ at least.

    Ok I follow you on that - would this be completed using commands like compare immediate, load immediate, write and read?
     
  7. Mar 19, 2012 #6

    rcgldr

    User Avatar
    Homework Helper

    If the test fails at any point, it needs to use a conditional branch to go to a routine that turns on the LED for fail and then stops (or loops forever, I'm not sure how your program is supposed to end). If all the tests pass, the program should end up at a routine that turns on the LED for pass and then stops (or loops forever or ...).
     
  8. Mar 20, 2012 #7
    Gotcha, I do understand what you're saying, but my newest question is how exactly do you "light" and LED through assembly code? That's what I'm lacking in understanding at the moment :confused:
     
  9. Mar 20, 2012 #8

    rcgldr

    User Avatar
    Homework Helper

    Output a value to PORTB, such as out PORTB,r16. (could be any register). Try different values (with just 1 bit set) to see which bit turns on which LED.
     
  10. Mar 21, 2012 #9
    Ok I see I see, silly question with my inexperience - I would load a value into r16 prior to my out statement to portb, r16 right?

    Example being:

    ldi r16, 1
    out PORTB, r16
     
  11. Mar 21, 2012 #10

    rcgldr

    User Avatar
    Homework Helper

    Yes, try 1, 2, 4, ... 0x80 to see what happens. I assume you've also included the code to set portb's direction bits before you try output to portb:

    ldi r16,0xff
    out DDRB, r16
     
  12. Mar 22, 2012 #11
    These two lines set portb's direction bits?
     
  13. Mar 22, 2012 #12

    rcgldr

    User Avatar
    Homework Helper

    Yes, as commented in the image you attached to the first post.
     
  14. Mar 22, 2012 #13
    Right :redface: my apologies, I was a little confused. But I really do appreciate your help, thank you very much. Once I get to the labs I'm going to attempt at testing my ram using your help, if I have any questions as I'm testing I'll be sure to contact you if that's ok.
     
  15. Mar 22, 2012 #14

    rcgldr

    User Avatar
    Homework Helper

    If this is a lab, there's some chance that they have deliberately messed up the ram to see if your program will catch the problem. It could be missing or shorted data and/or address lines.
     
  16. Mar 22, 2012 #15
    It's not necessarily a lab, more so a lecture where we learn about the new components we need to implement on our boards and then have time we spend in the labs working on our boards and adding them keeping them up to date throughout the semester.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Testing RAM on Board using Machine Assembly Code
Loading...