I2C and MCP23016


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by keymuu View Post

    By CONFIGs you mean? See post #1
    No look at this thread.
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Oops, sorry... the question was about all this here below

    Here are the configurations settings:
    DEFINE RESET_ORG 1000h ' Room for Microchip USB Bootloader
    define ADC_BITS 10 ' 10 bit A/D
    define ADC_CLOCK 3 ' 3=rc
    define ADC_SAMPLEUS 50 ' sampling time in us
    define I2C_HOLD 1 ' Can't read or write MCP23016 without i2c_hold = 1

    '**************** Define LCD registers and bits *********************
    DEFINE LCD_DREG PORTD ' Set LCD Data port
    DEFINE LCD_DBIT 4 ' Set starting Data bit (0 or 4 if 4-bit bus)
    DEFINE LCD_RSREG PORTC ' Set LCD Register Select port
    DEFINE LCD_RSBIT 2 ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTC ' Set LCD Enable port
    DEFINE LCD_EBIT 1 ' Set LCD Enable bit
    DEFINE LCD_BITS 4 ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 4 ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2000 ' Set command delay time in us, 2000 us
    DEFINE LCD_DATAUS 50 ' Set data delay time in us, 50 us

    sda var PORTB.0 ' i2c data pin 33
    scl var PORTB.1 ' i2c clock pin 34

    deviceIO con $40 ' MCP23016
    GP0 con $00 ' port GP0 all in
    GP1 con $01 ' port GP1 all in
    OLAT0 con $02 ' Output latch register 0
    OLAT1 con $03 ' 1
    IPOL0 con $04 ' input polarity normal, not inverted
    IPOL1 con $05 '
    IODIR0 con $06 ' all out = 0
    IODIR1 con $07 '
    INTCAP1 con $09
    INTCAPbyte var byte
    IOCON1 con $0b '

    cmd con $fe ' LCD command
    clr con 1 ' LCD clear display
    blink con $0f ' LCD blinkinking cursor on
    home1 con $80 ' LCD move cursor to beginning of first line
    home2 con $c0 ' LCD move cursor to beginning of second line
    home3 con $94 ' debug lines
    home4 con $d4 ' debug lines

Similar Threads

  1. MCP23016 I2C serial I/O expander chip
    By GeoJoe in forum Serial
    Replies: 7
    Last Post: - 31st October 2007, 15:39
  2. MCP23016 missing D7 on I2CRead
    By TWSK in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th June 2007, 18:37
  3. Using I2C with FullSpeed USB
    By Demon in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 8th July 2006, 04:52
  4. MCP23016 I/O expander
    By Demon in forum mel PIC BASIC Pro
    Replies: 42
    Last Post: - 24th October 2005, 01:01
  5. MCP23016 I/O expander with PBP?
    By Jon Chandler in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 22nd August 2005, 09:32

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