forked from zrafa/30pin-simm-ram-arduino
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ram_test.ino
77 lines (53 loc) · 1.52 KB
/
ram_test.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "ram.h"
/*
* RAM test : Test a SIMM RAM module with the ram library for Arduino
*
* Copyright (C) 2014 Rafael Ignacio Zurita <rafaelignacio.zurita@gmail.com>
*
* This ram test is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* You should have received a copy of the GNU Library General Public
* License along with this software (check COPYING); if not, write to the Free
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
char texto[80];
unsigned char i;
unsigned char j;
unsigned char buf;
unsigned char v[100];
char st[] = "This is a test\n";
void setup() {
ram_init();
/* write 4K */
for (i=0;i<64;i++)
for (j=0;j<64;j++)
ram_write(i, j, j);
/* read 4K */
for (i=0;i<64;i++)
for (j=0;j<64;j++)
buf = ram_read(i, j);
/* write at row=62 the text "This is a text\n" */
for (i=0;i<strlen(st);i++)
ram_write(62, i, (unsigned char) st[i]);
/* read row=62 */
for (i=0;i<strlen(st);i++)
v[80+i] = ram_read(62, i);
/* read row=63 */
for (i=0;i<64;i++)
v[i] = ram_read(63, i);
/* stop ram interrupts */
TIMSK1 &= ~(1<<OCIE1A);
Serial.begin(115000);
for (i=0;i<64;i++) {
sprintf(texto, "Testing RAM readings : %0x ", v[i]);
Serial.println(texto);
}
sprintf(texto, "Testing RAM readings : %s", &v[80]);
Serial.println(texto);
}
void loop(void) {
delay(1000);
}