Arrays look simple enough, but there's something I'm obviously missing. I took the code right out of the help and tried to print out some elements, but they all come out zero.
Also, I forgot to mention, I printed out some other variables before and after trying to print out tst1,tst2,and tst3. The others printed out properly, tst1-3 were all zero.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ORG 0
goto BASPROGRAMSTART
ORG 4
retfie
;********************************************************************************
;Start of program memory page 0
ORG 5
BASPROGRAMSTART
;Call initialisation routines
call INITSYS
;Start of the main program
;Dim TestVar(5)
;TestVar = 1, 2, 3, 4
movlw low TESTVAR
movwf FSR0L
movlw high TESTVAR
movwf FSR0H
;tst2 = TestVar(2)
movlw low(TESTVAR+2)
movwf AFSR0
movlw high(TESTVAR+2)
movwf AFSR0_H
movf INDF0,W
movwf TST2
As you can see, the array is not initialized with the values as it was in the first program, so something is wrong with the compiler or the 16f1939 chipdata file the compiler uses.
Trying several chips in the chipdata folder-
everything I tried in the 16f series worked up to and including 16f946.
Starting with 16f1454, trying several at random, none seemed to work.
In other words, anything from this year, (dated 3/25/2013), is not working.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Bump. So, has this problem been recognized by someone? Is it on someone's to do list? Did I screw up the first post so bad that the problem was misunderstood and being ignored? Should I try to find what's causing the problem in the compiler myself? Is anyone out there?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Arrays look simple enough, but there's something I'm obviously missing. I took the code right out of the help and tried to print out some elements, but they all come out zero.
The code:
The results:
What's the secret to getting arrays to work?
Also, I forgot to mention, I printed out some other variables before and after trying to print out tst1,tst2,and tst3. The others printed out properly, tst1-3 were all zero.
Obviously, I didn't provide enough information about the problem, so
I've narrowed down my problem with arrays.
If I assemble this program-
Then, in the asm file I get-
and everything is good.
If I change to the chip I am actually working on-
then I get
As you can see, the array is not initialized with the values as it was in the first program, so something is wrong with the compiler or the 16f1939 chipdata file the compiler uses.
Trying several chips in the chipdata folder-
everything I tried in the 16f series worked up to and including 16f946.
Starting with 16f1454, trying several at random, none seemed to work.
In other words, anything from this year, (dated 3/25/2013), is not working.
Bump. So, has this problem been recognized by someone? Is it on someone's to do list? Did I screw up the first post so bad that the problem was misunderstood and being ignored? Should I try to find what's causing the problem in the compiler myself? Is anyone out there?
I would have done it this way.
chip 12F683, 4
Dim TestVar(5)
TestVar(1) = 1
TestVar(2) = 2
TestVar(3) = 3
TestVar(4) = 4
tst2 = TestVar(2)
or
for i = 1 to 4
TestVar(i) = i
next
Never tried TestVar and a list of numbers myself.