Testing RAM on Board using Machine Assembly Code

AI Thread Summary
To test the UT6264CPCL RAM chip, a two-loop method is recommended: one loop fills the RAM with a cycling data pattern, and the second reads and compares the data to verify integrity. If the test fails, an LED should light up to indicate the error, while a passing test lights a different LED. Assembly language commands such as "compare immediate," "load immediate," and "output" to the appropriate port are essential for controlling the LEDs. Setting the direction bits for the port is also necessary before outputting values to light the LEDs. This approach will help ensure the RAM is functioning correctly during the microprocessor course.
NHLspl09
Messages
96
Reaction score
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: 923
Physics news on Phys.org
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:
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?
 
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.
 
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?
 
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 ...).
 
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:
 
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.
 
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.
 

Similar threads

Back
Top