Hi everyone, I have a simple project that I haven't quite managed to get working - I did a search on similar Maxim chips (517,518) but can't get sample code working there either.
It's a simple project, a large brass and copper art piece in the form of a goldfish. The electronic part is the eye, an RGB 1W LED - the colour of which I want to change depending on the room temperature. If it's a bit cold, say 14 deg C, the colour would be purple - blue and red LEDs on strong, no green. Over 28, just the red. In between, a mix of the colours.
To do that, I thought I'd use the PWM of my 14M2 for one LED, and a MAX519 dual DAC I found in my box of things for the other two. It's I2C.
The 519 has four AD points that you tie high to low, depending on the address you want to give. I have all mine set to high, so the address is %01011110 (the 010 leader is standard for these DAC chips, plus LSB = 0).
On the 2 DAC outputs, I have simple 5mm red and green LEDs with 470 ohm resistors to ground. These are just for testing so I can see if it's working.
I can't seem to get the DACs to work. The code is quite simple really (from what I see) - simply call the i2c address, then pass a 00,value or 01,value depending on which DAC channel I want. I've tried slow and fast i2c, also cranking up the internal 14m2 speed to 8 Mhz.
I've checked that pin 4 of the DAC is to 0V, and pin 12 to 5V. I have a 0.1uF cap across these pins. SCL and SDA are connected correctly, with 4k7 pull-up resistors.
I suspect there's something so simple, I've just missed it in a senior moment, perhaps. The picaxe itself is working fine, the other pins happily do what they should. Temp_read is just a byte which ultimately will have the temperature.
temp_read = 1
i2cslave %01011110, i2cfast, i2cbyte ' fire up the DAC MAX519
pause 50
max519_test:
writei2c $00,(temp_read) 'DAC Channel 0
b6 = 255 - temp_read
writei2c $01,(b6) 'DAC Channel 1
wait 2
temp_read = temp_read + 1
goto max519_test
... any suggestions?
I tried to attach the MAX519 datasheet here to save suggesters having to download it, but it's over 1Mb, so it failed. Here's the link though:
https://datasheets.maximintegrated.com/en/ds/MAX517-MAX519.pdf
It's a simple project, a large brass and copper art piece in the form of a goldfish. The electronic part is the eye, an RGB 1W LED - the colour of which I want to change depending on the room temperature. If it's a bit cold, say 14 deg C, the colour would be purple - blue and red LEDs on strong, no green. Over 28, just the red. In between, a mix of the colours.
To do that, I thought I'd use the PWM of my 14M2 for one LED, and a MAX519 dual DAC I found in my box of things for the other two. It's I2C.
The 519 has four AD points that you tie high to low, depending on the address you want to give. I have all mine set to high, so the address is %01011110 (the 010 leader is standard for these DAC chips, plus LSB = 0).
On the 2 DAC outputs, I have simple 5mm red and green LEDs with 470 ohm resistors to ground. These are just for testing so I can see if it's working.
I can't seem to get the DACs to work. The code is quite simple really (from what I see) - simply call the i2c address, then pass a 00,value or 01,value depending on which DAC channel I want. I've tried slow and fast i2c, also cranking up the internal 14m2 speed to 8 Mhz.
I've checked that pin 4 of the DAC is to 0V, and pin 12 to 5V. I have a 0.1uF cap across these pins. SCL and SDA are connected correctly, with 4k7 pull-up resistors.
I suspect there's something so simple, I've just missed it in a senior moment, perhaps. The picaxe itself is working fine, the other pins happily do what they should. Temp_read is just a byte which ultimately will have the temperature.
temp_read = 1
i2cslave %01011110, i2cfast, i2cbyte ' fire up the DAC MAX519
pause 50
max519_test:
writei2c $00,(temp_read) 'DAC Channel 0
b6 = 255 - temp_read
writei2c $01,(b6) 'DAC Channel 1
wait 2
temp_read = temp_read + 1
goto max519_test
... any suggestions?
I tried to attach the MAX519 datasheet here to save suggesters having to download it, but it's over 1Mb, so it failed. Here's the link though:
https://datasheets.maximintegrated.com/en/ds/MAX517-MAX519.pdf