WHOA!..
haha.. thanks for the reply.. but its still a bit over my head..
Im not sure its just the basics/foundation I am missing? but Im still having this disconnect, putting the pieces together..
without specifics from you code..
just the general idea perhaps the SPI communication? or maybe its just how this chip works specifically? (I think my RFID reader/writer is similar..which is why i was thinking it was SPI protocol I am not understanding)
Im not new to programing "principles" in general..but not with hardware/embedded electronics.. more web related stuff.
its all these: 0x01 all over.. (kind of overwhelming at first)..
these are hex values? (addresses) for the MAX chip...
and in the last post.. you are defining 'terms' to be used as shortcuts to certain addresses.. correct so far? (I dont want to loosely say variable..as you used the #define command and I go tin trouble for that mis-terminology before) ![]()
Some of your comments after the lines are confusing though?
#define DECODE_MODE 0x09
this line..
defines the label DECODE_MODE to be/mean 0x09 everytime its used in the code.. correct?
// write data 0xFF, Code B Decode for all digits << You will set this for No Decode mode instead
this I dont understand though?
the rest you are doing the same..
#define INTENSITY_ADDRESS 0x0A // 0x07 to start, half intensity. valid from 0x00 (min) to 0x0F (max)
#define SCANLIMIT_ADDRESS 0x0B // 0xFF, all 8 digits on
#define SHUTDOWN_ADDRESS 0x0C // 0x01, normal operation (0x01 = shutdown) - powers up in shutdown mode
in some of the comments you just noting the RANGES of VALUEs that can be used for that 'variable/defined' term...
example:
#define INTENSITY_ADDRESS 0x0A
// 0x07 to start, half intensity. valid from 0x00 (min) to 0x0F (max)
all these 'defines' still need to have values assigned to them though..or maybe more accurately put.. they need data still written to them..yes?
So would I do this in the set up function?.. or am I totally wrong in this thinking.. and when the #defines above are not addresses for quick reference..but actual assignment of data??
Also I didnt see any importing of the SPI lib? (or any others) was this just assumed? and I was supposed to know? or? should be included? (sorry.. partial code snippets lead to confusion for newbies!
)
I'll try to give 'SPI' a chance as you say...but I need a bit of help I guess.. =)
an overview perhaps of how this hex address/data relationship and sending it all over..etc work..
not even trying to turn on an LED yet.. trying to set those defaults of the chip firs.t. (1 step at a time)
thanks
//Pin Out:
/*
-pin 12 is connected to the DataIn (MAX pin:1)
-pin 11 is connected to the CLK (MAX pin:13)
-pin 10 is connected to LOAD/CS/SS (MAX pin:12)
*/
#include <SPI.h>
#define DECODE_MODE 0x09 // write data 0xFF, Code B Decode for all digits << You will set this for No Decode mode instead
#define INTENSITY_ADDRESS 0x0A // 0x07 to start, half intensity. valid from 0x00 (min) to 0x0F (max)
#define SCANLIMIT_ADDRESS 0x0B // 0xFF, all 8 digits on
#define SHUTDOWN_ADDRESS 0x0C // 0x01, normal operation (0x01 = shutdown) - powers up in shutdown mode
void setup() {
Serial.begin(9600);
Serial.println("--SET UP CHIP--");
digitalWrite (10,LOW);
SPI.transfer (INTENSITY_ADDRESS, 0x07);
digitalWrite (10, HIGH);
}
void loop() {
//do whatever
}
I know that is wrong syntax.. as I just saw the transfer() method only accepts 1 parameter (val)..
also looking at the SPI examples.. I dont see any assignment of these #defines.. so Im assuming Im wrong on the whole thing? haha