You’d have thought that with all this learning and fun stuff happening here at Wardian Towers, that as I get further and further into this electronic ‘lark’, first with PIC’s, then I2C, then real time clock counters, then I2C input/output devices, then into iButtons and all the wonders they produce; you’d have thought that it would get easier as time went on.

Scientists do say that the brain is in fact like a giant muscle, and that the more you use it, the easier it gets as it becomes more familiar with cramming it with yet more and more knowledge.

Well, I can report that from this end, it most certainly doesn’t seem to.Before...

But then again, I guess I’m not as young as I used to be, and maybe doing this kind of stuff is really for the twenty-somethings.

But then again, if I was twenty-something again, I’d be either playing on my X-Box, or drooling over a new Porsche, or Armani suit.  BUT, I’ve been there.  Got the T-shirt; read the book.  Boring.  Shallow.

Whatever.

To the right here is the board before I fitted the new memory chip.  The chip itself is a Microchip device called a ’24FC512′.  This denotes it’s from the ’24’ series of serial EEPROM (Electrically Erasable Programmable Read Only Memory) chips, and it will store up to 512 K bits of information.  Note the ‘bits’ bit.  In more user-friendly language, it will store up to 64 K Bytes of 8-bit words. (As we all know, there are 8 bits to a byte.)

The datasheet tells me that I can have up to four of these little guys sat on the same I2C lines, each individually addressable, so I could have up to 256K bytes of information storage on just four chips.

Frightening.

Hooking the thing up was ridiculously easy, and took a matter of minutes -I just had to remember to wire the SDA (data) and SCL (clock) lines properly.  Mix them up and all kinds of exciting and unexpected stuff would happen....After

There’s also a pin which you can either wire up, or even have sat on another output pin from the PIC.  This pin is the ‘Write Protect’ pin.  With it sat at 5-volts, you can read the contents of the chip, but it won’t let you write, while tying the pin to ground gives you unfettered access to everything.  This is a pretty useful feature, and I may well use it if I get the opportunity.

And here is the chip in circuit.  As I said, ridiculously easy to wire up, and you can barely notice any other new components.  They’re there, though.

And so to programming it.

And this is where all the ‘fun‘ started.

I set up an entirely new project in the X-IDE program I use from Microchip so as not to contaminate the other stuff I’ve written.  Okay, doing it this way may take longer, but it gives you a ‘fresh canvas’ to work on, and it prevents great lumps of code being sat in the program for other functions that you will never use in this.  It also focuses the mind on just what you really need in there to get the program running.

For this program, I needed the new RS232 program I’d written the other day so I could actually see in a box on the screen what the processor was putting into the RAM and also what was coming off the RAM.  Yes, I could have done it with simple LED’s already sat on the board, but that would have been pratty.

After several hours, many cups of tea, and of course, ‘consultation chats’ with young Alfie (…He’s a bit ropy on I2C, but learning fast…), I finally nailed it when I realised that you never use the ‘Acknowledge’ pulse when you’re writing to the device, but when you read from it, you must acknowledge every byte apart from the last one where you send a ‘NotAcknowledge’ pulse.

Oh, and to be on the safe side, you need plenty of ‘IdleI2C()’s thrown around, just for good measure.

Again, last night was another late one, but I can report total success.

I can now write data to this chip, switch the whole thing off, have a cup of tea, switch it all back on, and the data is still exactly as I wrote it.

Today, I have other, much less fun stuff to do, and of course Wednesday and Thursday are ‘Plotting’ days.

But I shall return soon to this project -hopefully before I forget everything I’ve done.

Unlike the RAM I’ve just fitted and programmed, unfortunately, I do forget stuff when switched ‘off’.

 

Print Friendly