Please I need help with eeprom

General discussion on mikroBasic for dsPIC30/33 and PIC24.
Post Reply
Author
Message
ideasman
Posts: 50
Joined: 01 Mar 2009 23:10

Please I need help with eeprom

#1 Post by ideasman » 25 Mar 2010 02:24

guys can someone help converting this pic code to dspic or create some code for a dynamic read and write via uart. :roll:
cheers IDEASMAN


sub procedure eprom_write(dim adr,dat as byte)
EEADR=adr
EEDATA=dat
EECON1.WREN=1
INTCON.GIE=0
EECON2=$55
EECON2=$AA
EECON1.WR=1
EECON1.WREN=0
INTCON.GIE=1
end sub

sub function eprom_read(dim adr as byte) as byte
EEADR=adr
EECON1.RD=1
result=EEDATA
end sub
I am willing to buy a case of beer via paypal for the effort. :lol:
code is in attachment

rmteo
Posts: 1330
Joined: 19 Oct 2006 17:46
Location: Colorado, USA

Re: Please I need help with eeprom

#2 Post by rmteo » 25 Mar 2010 02:41

There are built-in libaries to read and write EEPROM. See the manual and/or HELP file. To write to EEPROM:

Code: Select all

dim wrAddr as longint
    eeData as word
  ...
  eeData = 0xAAAA
  wrAddr = 0x7FFC30
  Eeprom_Write(wrAddr, eeData)
To read from EEPROM:

Code: Select all

dim eeAddr as longint
      temp as word
...
eeAddr = 0x7FFC20
temp = Eeprom_Read(eeAddr)
Why pay for overpriced toys when you can have
professional grade tools for FREE!!! :D :D :D

ideasman
Posts: 50
Joined: 01 Mar 2009 23:10

Re: Thanks rmteo but!!

#3 Post by ideasman » 28 Mar 2010 12:33

I do know that that code exists but using it in a dynamic matter has proven not to work I was given some code above as a sub procedure and I would like to carry it out that way. so I can enter any data I wish into the eeprom

Thanks rmteo for your reply

ideasman

Post Reply

Return to “mikroBasic for dsPIC30/33 and PIC24 General”