wow - great replies Melanie - thanks a ton!Originally posted by Melanie
I'm just going to add to my previous posting to give you a nudge in the right direction... looking at the datasheet for your fan controller, it looks like you cannot address all the Registers sequentially in one hit (like I do with the DS1307 example). For a start, they're not sequential - it looks like Maxim designed this on a Friday afternoon and they went home early... so each Register will have to be addressed on an individual basis with it's own I2CRead/Write instruction.... example...
FanAddress var Byte
FanControl var Byte
FanData var Byte
FanControl=$02:FanData=%00001010:Gosub SetFanA
FanControl=$04:FanData=%11110101:Gosub SetFanA
.. ..
SetFanA:
FanAddress=$90
I2CWrite SDApin,SCLpin,FanAddress,FanControl,[FanData]
Return
I'll let you figure what I've set, and how I connected the chip to give it a $90 address...
Melanie
always type hex values in caps - noted!
no need to specify read or write bit in the address - noted!
about the ds1307:
from reading the datasheet, I see what you mean about $00 bit 7 ... assuming a fresh (or disconnected) clock chip, that bit will be high, so I can tell whether I need to initialize the chip or not.
bit manipulation:
well I'm real sorry I had to ask that! I've spent all this time reading datasheets but haven't given the pbp manual any attention.
about the max6650:
$90 - ok I'll answer the easy one first, wiring for the address!
Address $90 hex = 1001000 ... tie ADD pin 5 to ground
now, for my 100th time reading the 6650 datasheet, all the talk of register this ... bit that... is starting to make sense!
FanControl=$02=%00000010 ... select the CONFIG register
byte fandata=%00001010
bits 7 to 6 always 00 according to data sheet
bits 5 to 4 set to 00 = software full-on
bit 3 set to 1 = 12 volt fan
bits 2 to set to 010 = Prescaler divide by 4
next, FanControl=$04=%00000100 ... select GPIO configuration
byte fandata=%11110101
bit 7 set to 1 = gpio 4 high/input
bit 6 set to 1 = gpio 3 high/input
bits 5,4 set to 11 = gpio 2 high/input
bits 3,2 set to 01 = gpio 1 set to FULL ON input
bits 1,0 set to 01 = gpio 0 set to ALERT output
thanks A LOT for your help!
i'm in an optimistic mood already, as I tested my pair of max6650s that I had hand soldered to DIP 10 to µSOP adapters (max6650 is about the size of two grains of white rice!) ... both passed with flying colors connected directly to my PC's smbus
your responses to my questions makes me even more optimistic that I'll be able to complete my project easily! pbp is powerfull stuff, and so is the microchip pic!
my serial programmer just arrived saturday, cant wait to try some code against the real pic now!
have a good week,
Gordon
Bookmarks