Testing RAM on Board using Machine Assembly Code

In summary: That's a great way to do it.Ok I follow you on that - would this be completed using commands like compare immediate, load immediate, write and read?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 ...).
  • #1
NHLspl09
96
0
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. Homework 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!

Homework Statement



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)?

Homework Equations



(Attachment 1 - Ram Tester Code)

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

The Attempt at a Solution



(Attachment 1 - Ram Tester Code)
 

Attachments

  • Ram Tester Code.jpg
    Ram Tester Code.jpg
    39 KB · Views: 883
Physics news on Phys.org
  • #2
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:
  • #3
rcgldr said:
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.

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?
 
  • #4
NHLspl09 said:
Would this mean I choose one port of addresses on the chip to put a test LED in?
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.

address test

NHLspl09 said:
The only thing is, I'm not the strongest with Assembly language, so I'm having a little difficulty implementing those tests.
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.
 
  • #5
rcgldr said:
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.

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?
 
  • #6
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 ...).
 
  • #7
rcgldr said:
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 ...).

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:
 
  • #8
NHLspl09 said:
how do you "light" an LED through assembly code?
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.
 
  • #9
rcgldr said:
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.

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
 
  • #10
NHLspl09 said:
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
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
 
  • #11
rcgldr said:
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

These two lines set portb's direction bits?
 
  • #12
rcgldr said:
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

NHLspl09 said:
Those two lines set portb's direction bits?
Yes, as commented in the image you attached to the first post.
 
  • #13
rcgldr said:
Yes, as commented in the image you attached to the first post.

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.
 
  • #14
NHLspl09 said:
attempt at testing my ram.
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.
 
  • #15
rcgldr said:
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.

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.
 

FAQ: Testing RAM on Board using Machine Assembly Code

1. How do you test RAM on board using machine assembly code?

The process of testing RAM on board using machine assembly code involves writing a program that runs through a series of instructions to check the functionality of the RAM. This program typically includes instructions to write and read data to and from specific memory addresses, as well as comparing the data to ensure it is correct.

2. What tools are needed to test RAM on board using machine assembly code?

To test RAM on board using machine assembly code, you will need a computer with a compatible processor and a software development environment that supports machine assembly language. You may also need a hardware emulator to simulate the computer's memory and a debugger to help identify and fix any issues.

3. What are the benefits of testing RAM on board using machine assembly code?

Testing RAM on board using machine assembly code allows for a more thorough and precise testing process compared to using software-based tools. Machine assembly code allows for direct access to the hardware, making it easier to detect and diagnose any issues with the RAM. It also allows for more control over the testing process and can be tailored to specific needs.

4. Are there any potential risks involved in testing RAM on board using machine assembly code?

There is a risk of causing damage to the hardware if the machine assembly code is not properly written or if the testing process is not carefully monitored. It is important to have a good understanding of the hardware and the code being used to avoid any potential risks.

5. Can testing RAM on board using machine assembly code be automated?

Yes, testing RAM on board using machine assembly code can be automated by creating a test program that can be run repeatedly. This allows for a more efficient and consistent testing process, especially for larger systems with a significant amount of RAM to test. However, it is still important to regularly monitor and review the test results to ensure accuracy and identify any potential issues.

Similar threads

Replies
1
Views
4K
Replies
7
Views
2K
Replies
1
Views
2K
Replies
2
Views
6K
Replies
2
Views
3K
Back
Top