Pages: 1 [2] 3 4   Go Down
Author Topic: Library for RAM chip  (Read 4327 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

_read() = _rbits;
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Intermediate Arduino user
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What about it?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

_read isn't a function returning a reference, so the assignment isn't possible.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Intermediate Arduino user
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK, so how would I make it so you could do a statement like: Serial.print(AM9111.read()); ?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
int AM9111::_read()
{
  digitalWrite(_odp,0);
  digitalWrite(_wep,1);
  int rv = 0;
  bitWrite(_rbits,0,digitalRead(_IO[0]));
  bitWrite(_rbits,1,digitalRead(_IO[1]));
  bitWrite(_rbits,2,digitalRead(_IO[2]));
  bitWrite(_rbits,3,digitalRead(_IO[3]));
  _read() = _rbits;
  return rv;
}
Have you ever thought why this routine would always return zero? (if it were to compile)
Is that what you want?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Intermediate Arduino user
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

WHat i wanted was to have _read read the outputs of the ram and have _read = the output ex: out = 1101; _read = 13;
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If that's what you wanted, why does it return zero?

Your _write method also (unusually) returns a value that is always zero.
« Last Edit: April 22, 2011, 04:45:32 pm by AWOL » Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Intermediate Arduino user
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I changed, but still has an error, do i have to have it do: return _rbits; ?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you initialise _rbits?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Intermediate Arduino user
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

how?

as in int _rbits?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No, apart from the missing semicolon, that looks more like a declaration, not an initialisation.

The clue is, you did initialise a variable, but it wasn't _rbits.
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Intermediate Arduino user
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so, how should i do it?
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd probably forget about _rbits altogether, and use (I mean really use) "rv".
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

0
Offline Offline
Newbie
*
Karma: 0
Posts: 26
Intermediate Arduino user
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ok, ill try it.
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 309
Posts: 26488
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

By the way, the spelling is "indeterminate", not "intermediate".    ;-)
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Pages: 1 [2] 3 4   Go Up
Jump to: