Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Please help me with PCF8591P controll and programming with 8051

Status
Not open for further replies.

turjasu

Newbie level 3
Joined
May 1, 2011
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,308
Hello friends,
Im new to this forum...But Im with a serious problem.
I have the intention of displaying digital byte value, read by the ADC PCF8591P to an output port of 89C51. For that I have done the interfacing

of pcf8591p with the AT898C51 through P1.0 = sda and P1.1=SCL and have done the programming. It is attached with this post in .txt format.
However, i will still explain once:
1. I send a Start condition
2. i send hex value 90h for address with A0=A1=A2=0 and r/w'=0
3. i sense ack frm pcf
4. i send 40h for activating dac
5. i wait for ack
6. i send a dummy write byte 00h to output in dac
7. i wait for ack
8. i send stop
now comes the reading routine
1. i send start
2. i send 91h for r/w'=1 for read
3. i wait for ack
4. i read databyte
5. i send master not-ack for last read
6. i read databyte again since first byte is useless
7. i send ack again from mcu to pcf8591p
8. i move the value in accumulator, read previously from pcf to port 0
9. i send stop

Now the problem is that whenever Im moving the read data, I always get 00H at the port. infact i have checked, pcf always gives to mcu 00hex

value, not the converted value. the dac part is fine. i checked it with other values, its working fine. the entire program is also executing

properly, which i have checked out. Please help me, If i am missing any command in the program, or managing the I2C routines improperly. I have

used Assembly language. I have attached the entire program.
 

Attachments

  • main routine.txt
    3.3 KB · Views: 87


To sidy50:

Well I will ofcorse go thru the tutorial given by you, but let me say that this isnt the first I2C interfacing Im doing. I have done interfacing with 24C02 etc. This PCF8591 is just not working. The DAC part is working fine, but the ADC values are always coming at R0 as 00H. I feel there's something im missing in controlling the PCF8591 adressing or command sending codes. Please go thru the attached program in .txt file and comment.

Thanks for your reply
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top