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
  1. #1

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

    hello people I'm in big trouble i2c, I'm using a pic 16F628A a 24c32a and eeprom proteus simulator
    I am using 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
    B2 var byte 'Data 2
    B3 var byte 'Data 3

    ADCON1 = 7 'Set PORTA and PORTE to digital
    Lcdout $ fe, 1, "1 EEPROM"
    pause 1000
    Lcdout $ fe, 1, "writing"
    pause 100
    Lcdout $ FE, 1
    PAUSE 100
    Pause 100 'Wait for LCD to start up
    b1 = e0 + $ 80 'B1 is the EEPROM data
    b2 = e0 + $ B0
    pause 100
    I2CWRITE SDA, SCL, $ A0, E0, [B1, "pic basic pro"] 'WRITTEN
    pause 100

    the phrase "pic basic pro" is a stored eeprom, which do happen to read this sentence and appears on lcd

    you guys could help me with this
    thank you
    fernandocsouza

  2. #2
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    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

    What is not working?

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


    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

    Quote Originally Posted by Fernandocsouza View Post
    ...
    PORTB DEFINE LCD_DREG
    DEFINE LCD_DBIT 4
    PORTB DEFINE LCD_RSREG
    DEFINE LCD_RSBIT 1
    PORTB DEFINE LCD_EREG
    DEFINE LCD_EBIT 2
    ...
    This is an example from the manual:

    ' Set LCD Data port
    DEFINE LCD_DREG PORTA
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 0
    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTA
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 4
    ' Set LCD Enable port
    DEFINE LCD_EREG PORTB
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 3
    ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_BITS 4
    ' Set number of lines on LCD
    DEFINE LCD_LINES 2
    ' Set command delay time in us
    DEFINE LCD_COMMANDUS 1500
    ' Set data delay time in us
    DEFINE LCD_DATAUS 44
    Your syntax varies slightly.

    Robert

  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

    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

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    2,610


    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

  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 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

  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

    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

  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

    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

  9. #9


    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

  10. #10


    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.

  11. #11


    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!

  12. #12


    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

    thank you for answering me NOMAD installed microcode studio again and the LCD worked just right and I could write the phrase "pic basic pro" in eeprom 24c32a, and now a friend as I do for reading the data and display on lcd
    please help me
    fernandocsouza

  13. #13


    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

    Friend nomad thanks for helping me
    got the pic 16F628A read the eeprom 24c32a this error in declarations
    I2CREAD SDA, SCL, $ A1, e0 + $ 20 [b1 str \ 9] 'limit
    pause 100

    lcdout str b1 \ 9
    pause 100
    had to put the var data with the line of the EEPROM memory in the case E0 + $ 20
    but anyway thanks
    fernandocsouza

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 : 1

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