eeprom help

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

eeprom help

#1 Post by ideasman » 07 Mar 2010 10:26

Hi can someone help please? when I turn the micro off and on why the data is not stored in eeprom?.
Im trying to create a small terminal program to store values.

cheers ideasman
program storage1
'dspic30f4013
include "DSPIC_aditional_string_library"
dim value as string
'dim iArr as word[2] = ("a","j",0)
dim a as word[3]'[2]


dim eeRead as word
eeAddr as longint

dArr as string[16]
iArr1 as word[16]
i as word

dim myArray as byte[5]
dim count as byte
Dim adcres as word
txt as string[6]
dim receive as string
dim delim as string
'ADPCFG = 0xFFFF




sub procedure InitController()
ADPCFG = 0x0000 'digital io all off are analog

'TRISB = $ffff 'portb outputs



uart1_init(9600)
end sub



main:
TRISB = 0
LATB = 0xFFFF
eeRead = 0xAAAA
eeAddr = 0x7FFC80

for count = 0 to 2 step 1
'while(eeRead <> 0)
eeRead = Eeprom_Read(eeAddr)
dArr = Lo(eeRead)
i = 1
eeAddr = eeAddr + 2
next count
count = 0
'wend
Lcd_Init_EasyDsPIC4()
Lcd_Out(2,1, dArr)
'--- ...and display it on LCD.
while true
InitController()
' portb = 0xffff

for count = 0 to 3 step 1



while Uart1_Data_Ready = 0
'nop
wend
'Uart1_Write_Text("Enter CAL CHIP #")
delay_ms(1)
myArray[count] = Uart1_Read_Char()
next count
count = 0
'until count = 4
if (myArray[0] = 43) and (myArray[1] = 43) then

Uart1_Write_Text("Enter CAL CHIP #")
delay_ms(2)
goto here
else
goto main

end if



if Uart1_Data_Ready() = 0 then
goto main
else
receive = Uart1_Read_Char()
Delay_10ms
Uart1_Write_char(receive)
delim = receive
a[0] = delim
Uart1_Write_text("Entered")

end if

'a = iArr


iArr1[0] = a[0]

'--- disable analog inputs

while(eeRead < 0xAABA)
Eeprom_Write(eeAddr, eeRead)
eeRead = eeRead + 1
while(NVMCON.15 <> 0)
nop ' wait for write to finish,
wend
LATB = Eeprom_Read(eeAddr) ' then, read the just-written
' data.
eeAddr = eeAddr + 2

wend
'--- write entire row of EEPROM data,...
Eeprom_Write_Block(0x7FFC20, iArr1)
while(NVMCON.15 <> 0)
nop
wend
'--- ...read the data back...
eeRead = 1
eeAddr = 0x7FFC20
i = 0
for count = 0 to 1 step 1

'eeRead <> 0
eeRead = Eeprom_Read(eeAddr)
dArr = Lo(eeRead)
i = 1
eeAddr = eeAddr + 2

next count
count = 0

wend
'Lcd_Init_EasyDsPIC4()
' Lcd_Out(2,1, dArr)

goto main
end.

User avatar
tihomir.losic
mikroElektronika team
Posts: 2138
Joined: 02 Dec 2009 14:16
Location: Serbia
Contact:

Re: eeprom help

#2 Post by tihomir.losic » 09 Mar 2010 13:41

Hello,

please, create Support ticket on:
http://www.mikroe.com/en/support
and send me your project in order to inspect it.

Thanks.

Best regards,

Losic Tihomir
mikroElektronika [Support team]

Post Reply

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