• Support PF! Buy your school textbooks, materials and every day products Here!

Testing RAM on Board using Machine Assembly Code

  • Thread starter NHLspl09
  • Start date
  • #1
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

Answers and Replies

  • #2
rcgldr
Homework Helper
8,691
522
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
96
0
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
rcgldr
Homework Helper
8,691
522
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
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
96
0
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
rcgldr
Homework Helper
8,691
522
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
96
0
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
rcgldr
Homework Helper
8,691
522
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
96
0
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
rcgldr
Homework Helper
8,691
522
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
96
0
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
Homework Helper
8,691
522
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
Those two lines set portb's direction bits?
Yes, as commented in the image you attached to the first post.
 
  • #13
96
0
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
rcgldr
Homework Helper
8,691
522
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
96
0
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.
 

Related Threads on Testing RAM on Board using Machine Assembly Code

  • Last Post
Replies
3
Views
9K
  • Last Post
Replies
6
Views
2K
Replies
2
Views
13K
Replies
16
Views
7K
  • Last Post
Replies
1
Views
1K
Replies
2
Views
666
Replies
4
Views
648
Replies
13
Views
2K
Replies
10
Views
12K
  • Last Post
Replies
3
Views
7K
Top