Ok I Give Up :( I2cwrite And Read


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    May 2005
    Posts
    49

    Question Ok I Give Up :( I2cwrite And Read

    HERE ARE THE CODES I REALLY CAN'T FIND THE PROBLEM.I READ MELANIE'S (I2CRead & I2CWrite not working as expected)AND TRYED EVERYTHING BUT NOT WORKING
    I AM USEING
    16F877 AND 24C02 AND EVERY THING CONNECTED WELL.

    '''''''''''THE CODES
    DEFINE LCD_DREG PORTD
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTD
    DEFINE LCD_EBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    adcon1=7
    kont var byte
    kont = %10100000
    adr var BYTE
    adr =2
    B2 VAR BYTE
    B2=0
    B VAR BYTE
    B=145

    loop:
    if portb.0=0 then goto wrt
    if portb.1=0 then goto wrd
    goto loop

    wrt:
    lcdout $fe,1
    lcdout "YAZILIYOR..."
    I2CWRITE PORTC.4,PORTC.3,kont,adr,[B]
    PAUSE 1000
    lcdout $fe,1
    lcdout "YAZILDI...."
    GOTO LOOP

    wrd:
    I2CREAD PORTC.4,PORTC.3,kont,adr,[B2]
    PAUSE 30
    lcdout $fe,1
    lcdout "OKUNAN:",#B2
    GOTO LOOP
    END


    IN THE PICTURE U CAN SEE THE PROBLEM WELL
    WHERE IS THE PROBLEM????
    Attached Images Attached Images  
    Last edited by SuB-ZeRo; - 11th July 2005 at 02:28.
    Asking is not a shame but not learning is a SHAME!!!

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    I don't have a Datasheet for a 24C02F, but I assume you've connected Vss and Vdd as you should have (since it's not shown on your schematic)... and what have you done with the WP pin? Is it grounded or floating? Again, not shown in your schematic.

  3. #3
    Join Date
    May 2005
    Posts
    49


    Did you find this post helpful? Yes | No

    Red face Here It Is.. :)

    http://www.geocities.com/burakloves/24c02.pdf datasheet of the 24c02 and yes WP is connected with ground.Proteus don'y use Vdd or Vss it connects automaticly.I set up this circuit in real world and still have the same result
    and u can see the circuit2
    Attached Images Attached Images  
    Last edited by SuB-ZeRo; - 11th July 2005 at 03:53.
    Asking is not a shame but not learning is a SHAME!!!

  4. #4
    mytekcontrols's Avatar
    mytekcontrols Guest


    Did you find this post helpful? Yes | No

    Exclamation

    I understand that a lot of pcb layout packages don't always show VDD, VCC, VSS, or GND connections on devices, but I do see a floating MCLR connection which is a not good. If this isn't tied to +5V (or whatever you are running for a positive supply), you will have random resets occurring. Hopefully this IS the problem, since this would be an easy fix.

    Good Luck,

  5. #5
    Join Date
    May 2005
    Posts
    49


    Did you find this post helpful? Yes | No

    Exclamation i connected the mclr in the real world

    Yes in the curcuit i can't connect the Mclr to the +5 V if i do the program stops.But in the real world i connected the mclr to the +5 V still nothing change i do every thing that has been writen in the threads and picbasic book.I give word to adres after than i give byte to adres nothing change. And suggestions?
    Asking is not a shame but not learning is a SHAME!!!

  6. #6
    Join Date
    May 2005
    Posts
    49


    Did you find this post helpful? Yes | No

    Talking Ok I Faund It

    HERE IS THE CODES

    DEFINE LCD_DREG PORTD
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTD
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTD
    DEFINE LCD_EBIT 1
    DEFINE LCD_BITS 4
    DEFINE LCD_LINES 2
    DEFINE LCD_COMMANDUS 2000
    DEFINE LCD_DATAUS 50
    adcon1=7
    kontwr CON %10100000
    adr var byte
    adr =0000
    B2 VAR WORD
    b2=0
    B VAR WORD
    B=185
    loop:
    if portb.0=0 then goto wrt
    if portb.1=0 then goto wrd
    goto loop

    wrt:
    lcdout $fe,1
    lcdout "YAZILIYOR..."
    I2CWRITE PORTC.4,PORTC.3,%10100001,adr,[B]
    PAUSE 1000
    lcdout $fe,1
    lcdout "YAZILDI...."
    GOTO LOOP

    wrd:
    I2CREAD PORTC.4,PORTC.3,kontwr,adr,[b2]
    PAUSE 30
    lcdout $fe,1
    lcdout "OKUNAN:",#B2
    GOTO LOOP
    END

    NOW IT'S WORKING GOOD
    Asking is not a shame but not learning is a SHAME!!!

Similar Threads

  1. I2CRead & I2CWrite not working as expected
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 30
    Last Post: - 27th October 2021, 18:36
  2. PIC 18F4550 and MCP23017
    By DaveC3 in forum Code Examples
    Replies: 12
    Last Post: - 4th December 2010, 14:01
  3. Puzzling issue with I2CWRITE to 24LC512
    By aberco in forum General
    Replies: 4
    Last Post: - 22nd August 2008, 17:47
  4. can't read from DS1621
    By HOBBPROG in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 12th May 2008, 22:53
  5. My I2CWRITE - timings and tricks
    By FinchPJ in forum Code Examples
    Replies: 5
    Last Post: - 3rd March 2008, 21:40

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts