Pages: [1]   Go Down
Author Topic: I wrote two Microchip libraries - MCP49x1 DACs and 24XX1025 EEPROMs  (Read 2366 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 2
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I made a small page for them here: http://exscape.org/arduino
... however the github repo is the one I'll 100% certainly keep up to date as changes are made: https://github.com/exscape/electronics/tree/master/Arduino/Libraries

Both are full-featured, optimized and fairly well-tested. I have more info in the READMEs (on github or in the downloads), but the brief info:

MCP49x1 DAC driver:
* Written for the MCP4901 (8-bit), MCP4911 (10-bit) and MCP4921 (12-bit) SPI DACs. Only tested with the MCP4901, but there is only *one* difference between them and the code that handles that is simple, so it should work just fine.
* Supports all the DAC features (aside from the obvious: shutdown mode to save power, and an output latch, to synchronize multiple DACs)
* Optimized for performance (has an option to not use digitalWrite, at least on the Uno/Mega boards. The rest would need minor code modifications.)

24XX1025 EEPROM driver:
* Should work with the 24LC1025, 24FC1025 and 24AA1025 chips.
* Splits writes into page writes automatically (if you have the RAM, writing the entire chip's 128 kiB at once should work)
* Helper functions to write bytes/ints/uints and floats
* Uses acknowledge polling instead of delay() to make sure the writes are made properly
* Tracks the current position for reads/writes, so you don't have to (unless you want to)

I hope someone finds them useful!
If you have any problems/bug reports/questions, contact me! smiley
Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The DAC library now also supports the dual channel MCP4902/MCP4912/MCP4922 chips. smiley
Aside from that, I don't think there are any noticeable differences between v1.0 and v1.1.
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 46
Posts: 2883
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank You.

Bob
Logged

--> WA7EMS <--
“The solution of every problem is another problem.” -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, thanks for the 24xx1025 library, I hope it will be very useful to me!

I think I'll try to write in blocks of 128 bytes (each time the EEPROM is going to be used will be completely filled in 5min, so I have to reduce the number of write cicles!). Doing it in this way each operation will spend 1000 write cicles instead of 128000!

Still I have 2 questions.
1) Do I have to check / control what is the position to be written (start of page/block), or it is controlled automatically?
2) Do I have to control in my program when the write cycle has finished? I mean, do I have to use any delay?

Thanks for your feedback
« Last Edit: December 29, 2012, 05:31:10 am by Lord_Corwin » Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, thanks for the 24xx1025 library, I hope it will be very useful to me!

I think I'll try to write in blocks of 128 bytes (each time the EEPROM is going to be used will be completely filled in 5min, so I have to reduce the number of write cicles!). Doing it in this way each operation will spend 1000 write cicles instead of 128000!

Still I have 2 questions.
1) Do I have to check / control what is the position to be written (start of page/block), or it is controlled automatically?
2) Do I have to control in my program when the write cycle has finished? I mean, do I have to use any delay?

Thanks for your feedback

Hi! smiley
1) It depends on what you mean. If you want it to be aligned (to reduce wear), you could start with setPosition to 0 (the default), and as you said write 128 bytes at a time, with write(buffer, numBytes). In this case, it tracks the current position, which will be 0, 128, 256 etc. Or, you can track it manually and use the write(address, buffer, numBytes) method.
2) No, the writes are synchronous, i.e. write() only returns when the write is finished, so it takes ~5 ms for it to return. No worries with delays or such.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 23
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the clarifications, very helpful!

Regards
Logged

Pages: [1]   Go Up
Jump to: