please friends help a beginner with i2chello people I'm in big trouble i2c, I'm using


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: please friends help a beginner with i2chello people I'm in big trouble i2c, I'm u

    Good morning guys thanks for replying, well what is not working:
    the data are already saved in eeprom 24c32a I was wondering how do I make reading through these data through the 24c32a eeprom PIC16F628A
    (example when I write I2CWRITE SDA, SCL, $ A0, e0, [B1, "pic basic pro"]
    it is recorded in the external EEPROM, and now comes the hardest as I do for the the reading of this phrase "pi pro basic" appears on the LCD
    already used all the commands and the phrase nothing appears
    I2CREAD SDA, SCL, $ A0, E0, b1, b2, b3
    I2CREAD SDA, SCL, $ A0, E0, b1, b2
    I2CREAD SDA, SCL, $ A0, E0, b1
    what I'm already one week trying to solve this and nothing, please help me staff
    thank you

    fernandocsouza

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: please friends help a beginner with i2chello people I'm in big trouble i2c, I'm u

    Code:
    Lcdout $ fe, 1, "1 EEPROM"
    I'm not sure you can have a SPACE after $.

    Post all your updated code. It will be easier to spot an error than using our crystal ball.

    Do you get any compile errors?

    Robert

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: please friends help a beginner with i2chello people I'm in big trouble i2c, I'm u

    hello robert thanks for replying, oh oo this code
    hello robert thanks for replying, oh oo this code

    PORTB DEFINE LCD_DREG
    DEFINE LCD_DBIT 4
    PORTB DEFINE LCD_RSREG
    DEFINE LCD_RSBIT 1
    PORTB DEFINE LCD_EREG
    DEFINE LCD_EBIT 2


    SCL var PORTA.0 'Clock pin
    SDA var PORTA.1 'Data pin

    E0 var byte 'Address <<<< I changed this to "WORD"

    B1 var byte 'Data 1


    ADCON1 = 7 'Set PORTA and PORTE to digital

    Pause 100 'Wait for LCD to start up
    b1 = e0 + $ 80 'B1 is the EEPROM data

    pause 100
    I2CWRITE SDA, SCL, $ A0, E0, [B1, "pic basic pro"] 'WRITTEN
    pause 100
    I2CREAD SDA, SCL, $ A0, E0, b1
    PAUSE 100
    lcdout $ FE, 1, B1
    end

    I want the pic 16F628A EEPROM read and write q 24c32a this recorded in the external EEPROM and appears on the LCD, the case would be the phrase "pic basic pro"

    sorry my english, I'm Brazilian, sao paulo

    thank you
    fernandocsouza

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: please friends help a beginner with i2chello people I'm in big trouble i2c, I'm u

    The lcd defines are not correct format.

    The 16f628a does not use adcon1, but you need to turn off comparators that are on porta.

    'ADCON1 = 7 'Set PORTA and PORTE to digital
    CMCON = 7 'turn off comparators

    address E0 is not set anywhere.

    remove the spaces after "$"

    that i2cread will only read one byte, you'll need to set an array and use str\x or a loop to read the whole string.

    You may want to send something to the lcd first to make sure it's working before solving the i2cread issues.
    the following compiles and should display the "Display working" at least
    Code:
    DEFINE LCD_DREG PORTB
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTB
    DEFINE LCD_RSBIT 1
    DEFINE LCD_EREG PORTB
    DEFINE LCD_EBIT 2
    
    SCL var PORTA.0 'Clock pin
    SDA var PORTA.1 'Data pin
    
    E0 var WORD 'Address <<<< I changed this to "WORD"
    B1 var byte 'Data 1
    
    CMCON = 7  'turn off comparators
    
    Pause 100 'Wait for LCD to start up
    
    E0 = $0000      'didn't see i2c address anywhere, need to set.
    b1 = e0 + $80 'B1 is the EEPROM data
    
    pause 100
    LCDOUT $FE,1,"Display working!" ' see if lcd setup correctly.
    I2CWRITE SDA, SCL, $A0, E0, [B1, "pic basic pro"] 'WRITTEN
    pause 100
    I2CREAD SDA, SCL, $A0, E0, b1
    PAUSE 100
    lcdout $FE, 1, B1
    end

  5. #5


    Did you find this post helpful? Yes | No

    Default Re: please friends help a beginner with i2chello people I'm in big trouble i2c, I'm u

    also need to add "TRISB = 0" somewhere before using lcdout. (default is input, need to set to output)
    Also, make sure Low voltage programming is disabled, it uses portb.4.
    Last edited by nomad; - 5th May 2014 at 17:44. Reason: oops

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: please friends help a beginner with i2chello people I'm in big trouble i2c, I'm u

    HELLO personal thanks for replying,
    I pulled the ADCON1 and put the CMCON = 7 and appeared error symbol

    Nor did the case of states i2c address you explain to me or write code to perform this address
    because the lcd was already running and the data were recorded in eeprom 24c32a
    the difficult that even this reading is made of the data in the EEPROM and show lcd

    thanks for helping me
    fernandocsouza

  7. #7


    Did you find this post helpful? Yes | No

    Default Re: please friends help a beginner with i2chello people I'm in big trouble i2c, I'm u

    (double post)
    Last edited by Demon; - 5th May 2014 at 23:58.

  8. #8


    Did you find this post helpful? Yes | No

    Default Re: please friends help a beginner with i2chello people I'm in big trouble i2c, I'm u

    sorry, i'm lost as how to help. your code should not compile at all.
    (I tried in microcode studio, fixed all the errors, and posted the result.)
    Are you sure you've selected 16f628a? it has comparators and uses cmcon.
    I've used them before and checked against my old projects and the data sheet.
    what I posted compiles fine here with no errors. (Although I did not correct the i2cread section to get the full string for display)

    If nothing at all is displaying, there's bigger issues.

    make sure 16f628a is the chip youre using, and it is selected in your program!

Similar Threads

  1. Beginner I2C Questions
    By rocket_troy in forum Serial
    Replies: 13
    Last Post: - 23rd May 2013, 02:08
  2. Replies: 10
    Last Post: - 2nd May 2009, 07:42
  3. Trouble with I2C - Part 1
    By munromh in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 18th November 2008, 11:43
  4. I2C write - value too big
    By ruijc in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 6th April 2008, 13:20
  5. Big big big memory or tiny SDs!
    By Ron Marcus in forum Off Topic
    Replies: 9
    Last Post: - 25th May 2007, 18:02

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