??? 03/19/11 19:58 Read: times |
#181612 - Getting a MAX521 to work with AT89S52 |
Hi,
I am trying to get a MAX521 to work with a AT89S52 through I2C using bit banging. The microcontroller is running @11.0592Mhz. Port P1.0 is connected to I2C clock and Port P1.1 is connected to I2C Data. I have used 10k external pullups. MAX521 A0, A1 are tied to ground. VREF for the MAX521 is being generated through a LM1117 and is set at 5V. As of now there is nothing connected to any of the DAC outputs. My code is as below PORT_DAC_CLOCK EQU P1.0 PORT_DAC_DATA EQU P1.1 LED_RED EQU P1.7 DAC_TEST: ;RESET THE DEVICE CALL DAC_START_BIT MOV A,#01010000B CALL DAC_BYTE MOV A,#00010000B CALL DAC_BYTE CALL DAC_STOP_BIT CALL SEC1D ;1 SEC DELAY CALL SEC1D ;1 SEC DELAY ;PUT OUT HALF VOLTAGE AT DAC 7 CALL DAC_START_BIT MOV A,#01010000B ;DEVICE ADDRESS CALL DAC_BYTE MOV A,#07H ;DAC ADDRESS CALL DAC_BYTE MOV A,#07FH ;DAC DATA FOR HALF VOLTAGE CALL DAC_BYTE CALL DAC_STOP_BIT DONE_DAC_TEST: RET DAC_START_BIT: SETB PORT_DAC_CLOCK SETB PORT_DAC_DATA CALL DAC_DELAY CLR PORT_DAC_DATA CALL DAC_DELAY CLR PORT_DAC_CLOCK CALL DAC_DELAY RET DAC_STOP_BIT: SETB PORT_DAC_CLOCK CALL DAC_DELAY CLR PORT_DAC_DATA CALL DAC_DELAY SETB PORT_DAC_DATA CALL DAC_DELAY RET DAC_BYTE: MOV R0,#8H DACB_LOOP: RLC A MOV PORT_DAC_DATA,C CALL DAC_DELAY SETB PORT_DAC_CLOCK CALL DAC_DELAY CLR PORT_DAC_CLOCK CALL DAC_DELAY DJNZ R0,DACB_LOOP SETB PORT_DAC_DATA CALL DAC_DELAY SETB PORT_DAC_CLOCK CALL DAC_DELAY JNB PORT_DAC_DATA,DONE_DAC_BYTE DAC_NO_ACK: ;TEMPORARY FOR DEBUGGING – FLASH LED TO INDICATE NO ACK FROM MAX521 CLR LED_RED CALL SEC1D CALL SEC1D SETB LED_RED CALL SEC1D CALL SEC1D SJMP DAC_NO_ACK DONE_DAC_BYTE: CLR PORT_DAC_CLOCK CALL DAC_DELAY RET DAC_DELAY: NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP RET I don't get any output at any of the DAC pins. So far I have tried playing around with the I2C timings, resetting the MAX521, changing the MAX521 IC, using DAC 0 to 6, still no output from the DAC. I think the I2C part of things is okay as the MAX521 gives the ACK. What am I missing? Any pointers / suggestions / feedback is mot welcome. Warm regards Punit |
Topic | Author | Date |
Getting a MAX521 to work with AT89S52 | 01/01/70 00:00 | |
Open-collector or open-drain! | 01/01/70 00:00 | |
Quasi bidirectional | 01/01/70 00:00 | |
Tried port 0 | 01/01/70 00:00 | |
Checked these things? | 01/01/70 00:00 | |
Tried these as well | 01/01/70 00:00 | |
Is the micro running at all? | 01/01/70 00:00 | |
Solved!!! | 01/01/70 00:00 |