cancel
Showing results for 
Search instead for 
Did you mean: 

writing to an array

bleumers_j
Associate II
Posted on November 14, 2003 at 03:50

writing to an array

8 REPLIES 8
bleumers_j
Associate II
Posted on October 30, 2003 at 12:15

Hi,

I'm trying to generate assemblercode for st7lite29 that reads serial data and save it to an array.

The receivng-data part works fine, but i have troubles writing it to the array

begin:

inc _count

; Receive serial data (works fine)

; Save data to array at location '_count'

btjt $0000,#7,loop ;other data to come? --> goto begin

If someone has an idea how i can do this, i'd be very happy to know.

Greets,

Johan.
sjo
Associate II
Posted on October 30, 2003 at 17:08

use index addressing with a buffer eg.

clr X

loop

call receive data ; receive data in A

ld (buffer,X), A

inc X ; ready for next byte

cp X, #10 ; received 10 bytes yet ?

jrne loop ; get next byte

Hope this helps

sjo
bleumers_j
Associate II
Posted on October 31, 2003 at 06:59

Thanks Sjo,

You have helped me very much. I have inserted your code and it works fine.

greets!
bleumers_j
Associate II
Posted on November 13, 2003 at 09:04

Hi again,

When i write more than 13 datavalues into this array, the data is corrupted.

Maybe it is because the variable buffer should be declared and the data is stored into registers that are used for other variables.

Anyone an idea how to solve this.

Greets.
sjo
Associate II
Posted on November 13, 2003 at 09:14

Make sure you declare a large enough buffer eg.

.buffer dsb 20 ; 20 byte array

Regards

sjo
bleumers_j
Associate II
Posted on November 13, 2003 at 10:27

Hi,

Thanks for your fast repy. I now have declared an array with 50 places. And this works.

But I need more spaces, and my memory space does not to be large enough. Maybe I can rearrange the memory space. I hope to have an array with 512 data places.

I'll try to change de lkf file to make this possible...

greets.

sjo
Associate II
Posted on November 13, 2003 at 12:59

Remember the flite29 only has 384bytes of ram (128 is stack).

It sounds like you need to change the way you are doing things or get a bigger micro with more ram.

Regards

sjo
bleumers_j
Associate II
Posted on November 14, 2003 at 03:50

I'm looking for a way to decrease the amount of data that has to be stored. This can't be difficult.

Thanks!