View previous topic :: View next topic |
Author |
Message |
hacker007
Joined: 11 Apr 2004 Posts: 44 Location: Slovenia
|
Posted: Sat Jan 29, 2005 5:43 pm Post subject: GET command speedup |
|
|
Hi Josef.
Can you help me speed up following code:
Code: | Dim Bbuuff(40) As Byte
For Ax = 1 To 40
Get #ffg , Ab
Bbuuff(ax) = Ab
Next Ax |
and
Code: | Seek_to = Seek(#ffg) + 120
Seek #ffg , Seek_to |
I do this for about 40x per second and it is slow. How to read an array in one piece. How about seek command to shift it 120 places...
Thank you,
Rok Rodic _________________ www.rodic.si - Medicine, electronics - home automation system ROSA, homemade stuff, programming... |
|
Back to top |
|
|
TyuTyu
Joined: 10 Apr 2004 Posts: 7 Location: Hungary
|
Posted: Sun Jan 30, 2005 9:36 am Post subject: |
|
|
from help:
*******************************************
Action
Reads a byte from the hardware or software UART.
Reads data from a file opened in BINARY mode.
Syntax
GET #channel, var
GET #channel, var , [pos] [, length]
*******************************************
in my code:
*******************************************
Get #2 , Img_buf(1) , Segl2 , Segw1
*******************************************
and it works
TyuTyu |
|
Back to top |
|
|
oe9vfj
Joined: 17 Jun 2004 Posts: 269 Location: Austria, Hard
|
Posted: Mon Jan 31, 2005 12:35 pm Post subject: |
|
|
Hi Rok,
You can read every amount of bytes (up to 65535) to SRAM with the
way posted in the previous mail.
Get #FileNumber, Variable [, [Position] , Length]
If you want to read from the current file-position, you can ommit the postion in this way:
GET #Filenumber, Variable, , Length
for example:
GET #10, ByteArray(1), , 100 ' fill 100 elements of a byte array
GET #10, WordArray(1), , 100 ' fill 50 elements of a word array
GET #10, LongArray(1), , 100 ' fill 25 elements of a Long array
For variable you can use the first or any other element of an array like ByteArray(1)
For length you have to insert the desired length in Bytes.
But take care, that the length don't exceed the Array, otherwise next variables in SRAM will be overwritten.
There is no special function for change the file-pointer with an offset value. Read the current value to a LONG-Variable, add the offset to the variable and pass this changed position to the SEEK command.
An own routine would not save a lot of cpu-time, because it have to do exact the same procedure I described above.
BTW: If the next command after a SEEK Position is a GET command, you can pass the position direct to the GET command, so you don't need an extra SEEK Position command. _________________ regards Josef
DOS - File System for BASCOM-AVR on http://members.aon.at/voegel
Last edited by oe9vfj on Mon Feb 07, 2005 3:36 pm; edited 1 time in total |
|
Back to top |
|
|
hacker007
Joined: 11 Apr 2004 Posts: 44 Location: Slovenia
|
Posted: Sun Feb 06, 2005 8:35 am Post subject: |
|
|
Thank you both. _________________ www.rodic.si - Medicine, electronics - home automation system ROSA, homemade stuff, programming... |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|