for PIC18 only !
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thank you gents for your replies.
Unfortunately for me I’m dealing with a old application which employs a PIC16F876A and needs an upgrade to be able to handle a larger number of records.
The code space is not a problem so I guess I will have to figure a way to get around this problem.
Basically I receive a 8 bytes decimal number which is the total number of records. What I’m planning to do is create two loops.
First I will separate the incoming Big_number in Big_number_low (last four bytes (max 9999)) and Big_number_high (first four MS bytes (max 9999)).
The code in my last post should change to:
For index_1=0 to Big_number_low
HSEOUT [sentence(index_1)]
Next
For index_2=0 to Big_number_high
For index_3=0 to 9999
HSEROUT [sentence(index_3)]
Next
Next
I’m wandering if this will do or I need to look deeper into the problem.
Any comments will be appreciated.
Regards,
Nick
Not sure how you're going to get a 1,000,000 element array with a PIC ...
Even with PBP 2.50
Not enough RAM.Code:For index =0 to big_number Hserout [record(index),13,10] Pause 100 Next
<br>
DT
Thank you gents for your replies.
I’m sorry for not making it clear. I’m receiving each sentence one at the time and send them out. My problem is that I know how many I will receive (Big_number) and I need to keep track on how many I send out to match the Big_number. So it gets down to only handling a 6digi number.
Unfortunately for me I’m dealing with a old application which employs a PIC16F876A and needs an upgrade to be able to handle a larger number of records.
The code space is not a problem so I guess I will have to figure a way to get around this problem.
Basically I receive a 8 bytes decimal number which is the total number of records. What I’m planning to do is create two loops.
First I will separate the incoming Big_number in Big_number_low (last four bytes (max 9999)) and Big_number_high (first four MS bytes (max 9999)).
The code in my last post should change to:
For index_1=0 to Big_number_low
HSEOUT [sentence(index_1)]
Next
For index_2=0 to Big_number_high
For index_3=0 to 9999
HSEROUT [sentence(index_3)]
Next
Next
I’m wandering if this will do or I need to look deeper into the problem.
Any comments will be appreciated.
Regards,
Nick
Last edited by Nicmus; - 25th January 2008 at 02:36. Reason: To clarify the problem
How are you going to get a 1,000,000 element array with a PIC?
Not enough RAM.Code:For index_1=0 to Big_number_low HSEROUT [sentence(index_1)] Next
<br>
DT
Hi Darrel,
I’m sorry for not presenting the complete picture.
I’m reading a .txt file from a USB media. The first line of this file gives me the total number of records in the file.
I’m reading the records one by one in a big loop:
Read Big_number
For index = 0 to Big_number
Read record
HSEROUT [record}
If index => Big_number then quit
Next
It all works fine if Big_number is limited to word size.
Now the requirement changed for larger number of records so I thought that your trick might apply here.
At the time I did that because I did not know, and I still don’t, to detect EOF.
Trying to read the device over the EOF will freeze the system.
Thank you for your interest.
Nick
That makes things a bit easier ...Code:big_number VAR WORD[2] ; 32-bit variable ASM ;---[load a 32-bit constant into a 32-bit variable]----------------- MOVE?CN macro Cin, Nout MOVE?CW Cin & 0xFFFF, Nout ; Low Word MOVE?CW (Cin >> 16), Nout + 2 ; High Word endm ENDASM ;------------------------------------------------------------------- @ MOVE?CN 1000000, big_number WHILE (big_number[1] > 0) OR (big_number[0] > 0) Read record HSEROUT [record] big_number[0] = big_number[0] - 1 IF big_number[0] = $ffff THEN big_number[1] = big_number[1] - 1 WEND
Last edited by Darrel Taylor; - 25th January 2008 at 10:09. Reason: Changed AND to OR
DT
Bookmarks