Need Help on PCA9555 communication


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2007
    Posts
    11

    Question Need Help on PCA9555 communication

    Hi Guys, Does anyone have a sample or idea how this PCA955 chip works? I had viewed it's datasheet it is using 16BitI2C communication any sample code you have there in pbp? It would be a great help.


    Thanks in Advance

  2. #2
    Join Date
    Mar 2005
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Hello,

    This is a working example that I used earlier.
    4 PCA9555 were used on adress 0,1,2,3 as you will find back in the code.



    '************************************************* ***************
    '* Name : PCA9555.BAS *
    '* Author : Vits Paul *
    '* Notice : Copyright (c) 2004 *
    '* : All Rights Reserved *
    '* Date : 12/16/2004 *
    '* Version : 1.0 *
    '* Notes : *
    '* : *
    '************************************************* ***************
    DEFINE LOADER_USED 1

    Include "Modedefs.Bas"
    DEFINE HSER_BAUD 9600
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    ' Set LCD Data port
    DEFINE LCD_DREG PORTB
    ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_DBIT 4
    ' Set LCD Register Select port
    DEFINE LCD_RSREG PORTC
    ' Set LCD Register Select bit
    DEFINE LCD_RSBIT 4
    ' Set LCD Enable port
    DEFINE LCD_EREG PORTC
    ' Set LCD Enable bit
    DEFINE LCD_EBIT 5
    ' 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 2000
    ' Set data delay time in us
    DEFINE LCD_DATAUS 50

    'define I2C
    SCL VAR PORTB.1
    SDA VAR PORTB.2



    ' Define program variables

    x1 var byte
    x2 var byte
    n var byte

    OPTION_REG.7 = 0 ' Enable PORTB pullups

    ADCON1 = 7 ' Make PORTA and PORTE digital

    i2cwrite SDA,SCL,%01000000,%00000110,[0,0] 'Adres0 write to configuration register place 6 all output
    pause 10
    i2cwrite SDA,SCL,%01000010,%00000110,[0,0] 'Adres1 write to configuration register place 6 all output
    pause 10
    i2cwrite SDA,SCL,%01000100,%00000110,[0,0] 'adres2 write to configuration register place 6 all output
    pause 10
    i2cwrite SDA,SCL,%01000110,%00000110,[0,0] 'adres3 write to configuration register place 6 all output
    pause 10
    Lcdout $fe, 1, "test PCA9555" ' Display sign on message
    PAUSE 10

    loop:
    x1 = 3
    x2 = 192
    for n = 1 to 8

    i2cwrite SDA,SCL,%01000000,%000000010,[x1,x2]
    i2cwrite SDA,SCL,%01000010,%000000010,[x2,x1]
    i2cwrite SDA,SCL,%01000100,%000000010,[x1,x1]
    i2cwrite SDA,SCL,%01000110,%000000010,[x2,x2]
    pause 10
    x1 = x1 * 2
    x2 = x2/2
    Lcdout $fe, 1, "LOOP",dec n
    pause 100
    next n
    x1 = 192
    x2 = 3

    for n = 1 to 8

    i2cwrite SDA,SCL,%01000000,%000000010,[x1,x2]
    i2cwrite SDA,SCL,%01000010,%000000010,[x2,x1]
    i2cwrite SDA,SCL,%01000100,%000000010,[x1,x1]
    i2cwrite SDA,SCL,%01000110,%000000010,[x2,x2]
    pause 10
    x2 = x2 * 2
    x1 = x1/2
    Lcdout $fe, 1, "LOOP",dec n
    pause 100
    next n
    goto loop


    End

  3. #3
    Join Date
    Jan 2007
    Posts
    11


    Did you find this post helpful? Yes | No

    Default

    Thanks for your generous help, I will try it asap.

Similar Threads

  1. Freeze the communication after 30 minutes
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 23rd May 2009, 07:46
  2. Bootloader,MCSP and Serial communication
    By surfer0815 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd March 2006, 10:52
  3. Replies: 2
    Last Post: - 10th June 2005, 02:34
  4. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 15:45
  5. Replies: 8
    Last Post: - 11th November 2004, 20:08

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