I have an 8051 microcontroller with external ram attached to it and I want to test the ram to see that it can store and load data correctly (which I think it currently does not).
In my program, I have it where the value 80h is written to 1st byte of memory and the value increments as each memory address is incremented but the value rolls over to zero every 256 bytes starting with the 128th byte.
This is my function:
;extended memory test. C=1=memory fault
memtest:
mov DPTR,#0h
mov R7,#80h
;fill with incrementing values
post1:
mov A,R7
movx @DPTR,A
inc R7
inc DPTR
mov A,DPH
orl A,DPL
jnz post1
;Test for incrementing values
mov DPTR,#0h
mov R7,#80h
post2:
clr C
movx A,@DPTR
subb A,R7
setb C
jnz isbadram
movx @DPTR,A
mov A,R7
inc R7
inc DPTR
mov A,DPH
orl A,DPL
clr C
jnz post2
isbadram:
ret
But I think I need to do more of a rigorous test. I think I need to write and read different values multiple times to the same locations but I don't know how many times to test a location and I don't know the best values to try.
I'm just afraid if I test a location too many times, then my program will spend forever testing memory before it begins doing anything useful.
Luckily I own some microcontrollers that can execute instructions at about 40nS each. I have others of the same family that execute instructions at about 0.5uS each.
So whats the best way to test a ram chip already installed in the system without spending too much time on the testing?
Aucun commentaire:
Enregistrer un commentaire