Pic18f2550 EEPROM Write


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2007
    Posts
    25

    Default Pic18f2550 EEPROM Write

    Hi All ,

    Can Anyone Please Clarify Why This Weird Output Occurs ?

    Using PBP 2.60 , Pic18f2550 .

    DEFINE OSC 48
    @ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
    @ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
    @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
    @ __CONFIG _CONFIG3H, _PBADEN_OFF_3H & _MCLRE_OFF_3H
    @ __CONFIG _CONFIG4L, _LVP_OFF_4L &_XINST_OFF_4L

    USBBufferSizeMax con 8 ' maximum buffer size
    USBBufferSizeTX con 8 ' input
    USBBufferSizeRX con 8 ' output

    ' the USB buffer...
    USBBuffer Var Byte[USBBufferSizeMax]
    USBBufferCount Var Byte
    i var Byte
    ' ************************************************** **********
    ' * main program loop - remember, you must keep the USB *
    ' * connection alive with a call to USBService every couple *
    ' * of milliseconds or so... *
    ' ************************************************** **********
    usbinit ' initialise USB...
    ProgramStart:

    For i = 0 to 254 ;>>> Works Fine
    write i,$3D ;>>>Works Fine
    Next i ;>>>Works Fine

    ; But When Try This Without For-Next it Didnt Work :

    i = $78
    write 23,i ;>>> Weird Values At Location 23 , or No write .



    gosub DoUSBIn
    gosub DoUSBOut
    goto ProgramStart

    ' ************************************************** **********
    ' * receive data from the USB bus *
    ' ************************************************** **********
    DoUSBIn:
    USBBufferCount = USBBufferSizeRX ' RX buffer size
    USBService ' keep connection alive
    USBIn 1, USBBuffer, USBBufferCount, DoUSBIn ' read data, if available
    return

    ' ************************************************** **********
    ' * wait for USB interface to attach *
    ' ************************************************** **********
    DoUSBOut:
    USBBufferCount = USBBufferSizeTX ' TX buffer size
    USBService ' keep connection alive
    USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
    return

  2. #2
    Join Date
    Jun 2007
    Posts
    25

    Default Re: Pic18f2550 EEPROM Write

    No Reply Till Now , I Tried To Make It With at24c32 , Also With No Success !!!
    * I Have A0&A1&A2&WP Wired To GND .

    My Code :
    AX VAR Byte
    AX = $22

    I2cWRITE PORTB.0,PORTB.1,$A0,$33,AX ; >>>Where Portb.0 is datapin , portb.1 clock pin , $A0 control , $33 memory address , AX my Data .

    Nothing Written Or Wrong Values .

  3. #3
    Join Date
    Jun 2007
    Posts
    25

    Default Re: Pic18f2550 EEPROM Write

    dears ,

    please this drive me crazy , tried 16f84a & 18f2550 , no success at all, tried many examples , even in the installation of pbp folder all not working .

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,383

    Default Re: Pic18f2550 EEPROM Write

    I2cWRITE PORTB.0,PORTB.1,$A0,$33,AX ; >>>Where Portb.0 is datapin , portb.1 clock pin , $A0 control , $33 memory address , AX my Data .
    did you read the pbp manual or the 24c32 data sheet ?

    I2cWRITE PORTB.0,PORTB.1,commandbyte,addressword,[databyte];

  5. #5
    Join Date
    Jun 2007
    Posts
    25

    Default Re: Pic18f2550 EEPROM Write

    Dear Richard ,

    thanks For Your Reply ,

    But Let Me Explain Something , I read Both , And Tried everything With no Success .

    Finally I Tried To Make It With Proton basic , Do you know , its working like a charm from first try with the A/M Example .

    The Issue With Picbasic Itself .

Similar Threads

  1. read/write eeprom
    By mel4853 in forum mel PIC BASIC Pro
    Replies: 17
    Last Post: - 1st March 2010, 02:17
  2. EEPROM write
    By Sach_1979 in forum General
    Replies: 2
    Last Post: - 23rd September 2009, 20:18
  3. Write to eeprom
    By mradde in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 1st February 2009, 19:27
  4. WRITE TO Eeprom
    By crhomberg in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 12th February 2008, 05:33
  5. Do I need a DELAY following a WRITE to EEPROM?
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 0
    Last Post: - 13th July 2004, 17:25

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