string&i2c


Results 1 to 5 of 5

Thread: string&i2c

Threaded View

  1. #1
    cesurcelik's Avatar
    cesurcelik Guest

    Default string&i2c

    hi all.
    what i want to do is sending string from pc-hyperterminal via pic16f876 to i2c then reading i2c
    my code is:
    INCLUDE "MODEDEFS.BAS"
    DEFINE CHAR_PACING 65000
    DEFINE OSC 20
    CONTROL CON $A0
    DPIN VAR PORTC.4
    CPIN VAR PORTC.3
    VALUE VAR BYTE[21]
    ADDRESS VAR BYTE

    SERIN2 PORTC.7,396,[WAIT("Ee"),STR VALUE \ 21]

    ADDRESS=0
    WRITEX:

    FOR ADDRESS=0 TO 20
    I2CWRITE DPIN,CPIN,CONTROL,ADDRESS,[VALUE]
    PAUSE 10
    NEXT ADDRESS


    READX:

    FOR ADDRESS=0 TO 20

    I2CREAD DPIN,CPIN,CONTROL,ADDRESS,[VALUE]
    SEROUT2 PORTC.6,396,[#ADDRESS,"=",VALUE[ADDRESS],10,13]
    NEXT ADDRESS
    LOOP:
    GOTO LOOP
    END


    when i send "EeABCDEFGHIJKLMNPRSTUV" to i2c
    the response is:

    Òú
    1:B
    2:C
    3
    4:E
    5:F
    6:G
    7:H
    8:I
    9:J
    10:K
    11:L
    12:M
    13:N
    14:P
    15:R
    16:S
    17:T
    18:U
    19:V
    20:
    as you see the ,i can't read the first address and value(0=A),i don't understand why?

    tank you
    Last edited by cesurcelik; - 17th February 2006 at 16:44.

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