PDA

View Full Version : Bug or something else



pedja089
- 7th February 2011, 01:54
I'm used same code on PIC18LF13K50, now i just copy/paste same code for PIC18LF2550
But 1 byte is always zero.
I tried like this


APN_Name var byte[20]
APN_Pass var byte[20]
APN_User var byte[20]


serin2 PC_RX,Baud_Rate,500,PC_Data,[wait("DATA:"),day, month, yr, hour, minut, sek,str dat\4,_
str sms_no\20,_
str apn_name\20,str apn_user\20, str apn_pass\20,_.....
But apn_name[0] always has the value 0.
Then i tried this

serin2 PC_RX,Baud_Rate,500,PC_Data,[.... apn_name[0],apn_name[1],apn_name[2],apn_name[3],apn_name[4],apn_name[5],apn_name[6],apn_name[7],apn_name[8],apn_name[9],apn_name[10],apn_name[11],apn_name[12],apn_name[13],apn_name[14],apn_name[15],apn_name[16],apn_name[17],apn_name[18],apn_name[19],_
str apn_user\20, str apn_pass\20,_...]

Same result.
Then i tried this

serin2 PC_RX,Baud_Rate,500,PC_Data,[.... apn_name[1],apn_name[2],apn_name[3],apn_name[4],apn_name[5],apn_name[6],apn_name[7],apn_name[8],apn_name[9],apn_name[10],apn_name[11],apn_name[12],apn_name[13],apn_name[14],apn_name[15],apn_name[16],apn_name[17],apn_name[18],apn_name[19],apn_name[0],_
str apn_user\20, str apn_pass\20,_...

Now it was expected that apn_name[1] is 0, but its value is now fine,
but apn_name[0] is 0:confused:
I tried to move position of apn_name[0], and its always 0:eek:
I tried to change name of variable apn_name into apn,apn1,apn_1, but always same...
And all data before and after apn_name[0] were received correctly.
Does anybody have idea what is going on:confused:

mister_e
- 7th February 2011, 02:12
It reminds me something, not sure what but, can you try to replace the square bracket with parenthesis within the SERIN2 lines?

something like

serin2 PC_RX,Baud_Rate,500,PC_Data,[.... apn_name(0),apn_name(1)......]EDIT: For testing purpose I would get rid of the Timeout...

Damn I'm rusty

pedja089
- 7th February 2011, 02:36
I did, no matter where I put Apn_name(0),same result...
I have defined some variables, only for testing, and everything is ok, but apn_name(0):mad:
EDIT:
I really have no idea what's going on ...
I tried this

serin2....[....i,apn_name(1)....]
apn_name(0)=i
And its working, but...
speechless:mad:

mister_e
- 7th February 2011, 02:46
What's sending the data to your PIC? Can you sniff it with a Terminal software?

What if you define your array at the top, then add the remaining vars bellow?

pedja089
- 7th February 2011, 02:54
VB6.
Of course, I first check whether VB6 send well.
I shorted pin's 2 and 3 on the serial port, and put a piece of code that displays data from Rx in textbox.
I have not changed anything in the vb6 code when I moved app_name[0].
I just changed the position of the serin2.
Now i will mowe to top of code...

pedja089
- 7th February 2011, 03:07
It does not matter where is the definition of variable, it is always the same.
Now I changed the length of the array, and when I change the length of the array, the problem is moved from one array to another...
So, this to me looks much like a bug...
EDIT:
Now I see that I wrote that I use 18LF2550.
I wrote wrong, it's late so ...
I moved from PIC18LF13K50 to 18LF14K50.
18LF13K50 has 8K of memory, and that was a little to put an ftp and email client on it.
So I switched to PIC18LF14K50 with a 16K memory, and I just copied and compiled code for it...

mister_e
- 7th February 2011, 03:17
Problem solved then?

pedja089
- 7th February 2011, 03:20
It isn't...
If I put apn_name var byte[25], that problem moves to apn_user[0]....

pedja089
- 7th February 2011, 14:58
I tried a few things ...
If I make array of variables with the name of AA, the problem is moved to it. And if I create a variable with a name such as VV, the problem remains the variable apn_name.
I suppose the bug somewhere in the allocation of address variables.
I notice that alphabetical order of names is important, when addresses are assigned to variables...