Hi
when i add a new variable my program don't run as expected after.
i need to manualy atribute most of my variable to a spesific location in ram with the atribute "absolute" and even doing that it work only some time.
did i make a mistake in the configuration? or it's a bug of the compiller
i use a PIC32MZ0512EFF064
here my config register
DEVCFG3 : $1FC0FFC0 : 0x79000000
DEVCFG2 : $1FC0FFC4 : 0x40023B21
DEVCFG1 : $1FC0FFC8 : 0x5F74C6B9
DEVCFG0 : $1FC0FFCC : 0x403FF777
and i use level 4 with SSA in the optimisation parameter
thanks
Basile
problem in variable management
Re: problem in variable management
I'm using the Fat32 lib, and it's mostly the function I wrote to read an image or file in an SD card that malfunctioning when I adding new variables to make me over function
and assining each variable to a spesific place with "absolute" don't work finnaly
for example i just wrote a new function with 3 local variable and using also a global variable
if i call this new function it make my previous function not working
the 3 first functions are working if i don't call the last one in my main program
i change some variable of place and removed a "FAT32_ChangeDir(@dirname)"
now it's working when i call the last
but if i remove the 2 line
at the end off the function "seqima()"
it's not working again
I am starting losing my mind
if someone could help me
thanks all
Basile
ps sorry for my english
and assining each variable to a spesific place with "absolute" don't work finnaly
for example i just wrote a new function with 3 local variable and using also a global variable
if i call this new function it make my previous function not working
Code: Select all
sub procedure imageDisp(dim byref imgname as string)
fhandle = FAT32_Open(@imgname, FILE_READ_F32)
FAT32_Seek(fhandle, $A)
FAT32_Read(fhandle, @lineBuff, 3)
'UART1_Write(lineBuff[0])
stImage = lineBuff[0]
FAT32_Seek(fhandle,stImage)
for iL = 120 to 0 step -10
FAT32_Read(fhandle, @lineBuff, 32)
iI=0
for iR = 0 to 29 step 3
LEDdata[iI+iL][2] = lineBuff[iR]
LEDdata[iI+iL][1] = lineBuff[iR+1]
LEDdata[iI+iL][0] = lineBuff[iR+2]
inc(iI)
next iR
next iL
FAT32_Close(fHandle)
ledshow()
delay_ms(20)
end sub
sub procedure imageChar(dim byref charnameND as string)
fhandle = FAT32_Open(@charnameND, FILE_READ_F32)
FAT32_Seek(fhandle, $A)
FAT32_Read(fhandle, @lineBuff, 3)
'UART1_Write(lineBuff[0])
stImage = lineBuff[0]
FAT32_Seek(fhandle,stImage)
for iL = 120 to 0 step -10
FAT32_Read(fhandle, @lineBuff, 32)
iI=0
for iR = 0 to 29 step 3
LEDdata[iI+iL][2] = lineBuff[iR]
LEDdata[iI+iL][1] = lineBuff[iR+1]
LEDdata[iI+iL][0] = lineBuff[iR+2]
inc(iI)
next iR
next iL
FAT32_Close(fHandle)
ledshow()
end sub
sub procedure textD(dim byref texttoD as string,dim speedD as word)
dim tlong as byte
dim ichar as byte
dim charac as string[6]
dirname = "\"
FAT32_ChangeDir(@dirname)
dirname = "alpha"
FAT32_ChangeDir(@dirname)
tlong = length(texttoD)-1
for ichar = 0 to tlong
if texttoD[ichar] = " " then
charac = "sp.bmp"
else
charac = "0.bmp"
charac[0] = texttoD[ichar]
end if
imageChar(charac)
Vdelay_ms(speedD)
next ichar
end sub
Sub procedure seqima(dim byref directo as string)
dim nnext as integer
dim nameNum as string[8]
dim nName as word
dim Home as char
Home = "\"
FAT32_ChangeDir(@Home)
FAT32_ChangeDir(@directo)
nName = 0
while 1
inc(nName)
WordToStrWithZeros(nName,nameNum)
nameNum[0]=nameNum[1]
nameNum[1]=nameNum[2]
nameNum[2]=nameNum[3]
nameNum[3]=nameNum[4]
nameNum[4]="."
nameNum[5]="b"
nameNum[6]="m"
nameNum[7]="p"
nnext = FAT32_Exists(@nameNum)
if nnext = 0 then break end if
imageDisp(@nameNum)
wend
end sub
i change some variable of place and removed a "FAT32_ChangeDir(@dirname)"
now it's working when i call the last
Code: Select all
sub procedure imageDisp(dim byref imgname as string)
dim iR as byte 'absolute 0xA0000053
dim iL as byte 'absolute 0xA0000054
dim iI as byte 'absolute 0xA0000055
dim stImage as word absolute 0xA0000056
dim lineBuff as byte[32] 'absolute 0xA0000058
fhandle = FAT32_Open(@imgname, FILE_READ_F32)
FAT32_Seek(fhandle, $A)
FAT32_Read(fhandle, @lineBuff, 3)
'UART1_Write(lineBuff[0])
stImage = lineBuff[0]
FAT32_Seek(fhandle,stImage)
for iL = 120 to 0 step -10
FAT32_Read(fhandle, @lineBuff, 32)
iI=0
for iR = 0 to 29 step 3
LEDdata[iI+iL][2] = lineBuff[iR]
LEDdata[iI+iL][1] = lineBuff[iR+1]
LEDdata[iI+iL][0] = lineBuff[iR+2]
inc(iI)
next iR
next iL
FAT32_Close(fHandle)
ledshow()
delay_ms(20)
end sub
sub procedure imageChar(dim byref charnameND as string)
dim iR as byte 'absolute 0xA0000053
dim iL as byte 'absolute 0xA0000054
dim iI as byte 'absolute 0xA0000055
dim stImage as word absolute 0xA0000056
dim lineBuff as byte[32] 'absolute 0xA0000058
fhandle = FAT32_Open(@charnameND, FILE_READ_F32)
FAT32_Seek(fhandle, $A)
FAT32_Read(fhandle, @lineBuff, 3)
'UART1_Write(lineBuff[0])
stImage = lineBuff[0]
FAT32_Seek(fhandle,stImage)
for iL = 120 to 0 step -10
FAT32_Read(fhandle, @lineBuff, 32)
iI=0
for iR = 0 to 29 step 3
LEDdata[iI+iL][2] = lineBuff[iR]
LEDdata[iI+iL][1] = lineBuff[iR+1]
LEDdata[iI+iL][0] = lineBuff[iR+2]
inc(iI)
next iR
next iL
FAT32_Close(fHandle)
ledshow()
end sub
sub procedure textD(dim byref texttoD as string,dim speedD as word)
dim tlong as byte
dim ichar as byte
dim charac as string[6]
dirname = "\"
FAT32_ChangeDir(@dirname)
dirname = "alpha"
FAT32_ChangeDir(@dirname)
tlong = length(texttoD)-1
for ichar = 0 to tlong
if texttoD[ichar] = " " then
charac = "sp.bmp"
else
charac = "0.bmp"
charac[0] = texttoD[ichar]
end if
imageChar(charac)
Vdelay_ms(speedD)
next ichar
end sub
Sub procedure seqima()
dim nnext as integer
dim nameNum as string[8]
dim nName as word
nName = 0
while 1
inc(nName)
WordToStrWithZeros(nName,nameNum)
nameNum[0]=nameNum[1]
nameNum[1]=nameNum[2]
nameNum[2]=nameNum[3]
nameNum[3]=nameNum[4]
nameNum[4]="."
nameNum[5]="b"
nameNum[6]="m"
nameNum[7]="p"
nnext = FAT32_Exists(@nameNum)
if nnext = 0 then break end if
imageDisp(@nameNum)
wend
end sub
Code: Select all
nnext = FAT32_Exists(@nameNum)
if nnext = 0 then break end if
it's not working again
I am starting losing my mind
if someone could help me
thanks all
Basile
ps sorry for my english
- filip.grujcic
- Posts: 822
- Joined: 14 May 2018 08:34
Re: problem in variable management
Hi,
I believe your configuration bits are wrong.
Could you zip and attach your project?
Also, which oscillator are you using?
Kind regards,
I believe your configuration bits are wrong.
Could you zip and attach your project?
Also, which oscillator are you using?
Kind regards,
Filip Grujcic
Re: problem in variable management
Hi
here are my project and the schematic of the board
i use a 20mhz quartz
the code it's a little mess up
it can clean it if you want
thanks
Basile
here are my project and the schematic of the board
i use a 20mhz quartz
the code it's a little mess up
it can clean it if you want
thanks
Basile
- Attachments
-
- Led Mask.zip
- (862.31 KiB) Downloaded 80 times
- filip.grujcic
- Posts: 822
- Joined: 14 May 2018 08:34
Re: problem in variable management
Hello,
I'm not sure what the issue is.
I will have to look into it further, perhaps even order this chip, so I can try on real hardware.
I apologize for the inconvenience.
Kind regards,
I'm not sure what the issue is.
I will have to look into it further, perhaps even order this chip, so I can try on real hardware.
I apologize for the inconvenience.
Kind regards,
Filip Grujcic