Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:40 17 Sep 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : data in library

Author Message
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 11:51pm 27 Dec 2015
Copy link to clipboard 
Print this post

Hello,

Here is the begining of a code: (MM V5.0)

'LB-LOGGER.BAS
'PROGRAMBA:
DIM MD(12),I
DATA 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
FOR I = 1 TO 12: READ MD(I): NEXT I

when I put it into library, I have got:

>run
[LIBRARY] For I = 1 To 12: Read MD(I): Next I
Error: No DATA to read

Without using the library the code works well.
Where did I make a mistake?

drk

 
Geoffg

Guru

Joined: 06/06/2011
Location: Australia
Posts: 3303
Posted: 12:36am 28 Dec 2015
Copy link to clipboard 
Print this post

From the user manual page 16:
  Quote  You can use READ commands in the library but they will default to reading DATA statements in the main program memory. If you want to read from DATA statements in the library you must use the RESTORE command before the first READ command. This will reset the pointer to the library space.

Don't worry that you did not see it. There is a lot in the manual to adsorb.

Geoff
Geoff Graham - http://geoffg.net
 
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 12:58am 28 Dec 2015
Copy link to clipboard 
Print this post

Hi Geoff,
Many thanks, the bad thing is, that I trasanslated the manual to hungarian...
I forget it...Sorry
The hungarian translation (to practice he hungarian ):

• A könyvtárban használhatjuk a READ parancsot, de ez az alapértelmezés szerint a program memóriában elhelyezett DATA utasításban szereplő adatokat olvassa. Ha mégis a könyvtárban szereplő DATA adatait akarjuk kiolvasni, akkor az első READ parancs használata előtt a RESTORE parancsot kell kiadni. Ez a mutatót a könyvtár területre állítja.

Many thanks again
drk
 
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 01:23am 28 Dec 2015
Copy link to clipboard 
Print this post

I have a newer problem:
The beginning of a program in the library:

restore
DIM MD(12),I
DATA 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
FOR I = 1 TO 12: READ MD(I): NEXT I

'++++++[ DATE,TIME <> 64B KONVERZIOK]++++++++++++++++++++++++++++++++++
SUB DTESZT
LOCAL K%
? DATE$: ? TIME$
PERCEK(K%): ? GETDATM$(K%): ? GETTIMM$(K%)
MPERCEK(K%): ? GETDATS$(K%): ? GETTIMS$(K%)
END SUB
'
'XXXXXX[ PERC ALAPU KONVERZIO ]XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'******[ CALCULATE THE MINUTES SINCE MIDNIGHT 1ST JAN 2014 ]***********
FUNCTION GETMINS%(YR, MTH, DAY, HR, MIN)
GETMINS% = (YR - 14) * (365 * 24 * 60) + ((YR - 13) \ 4) * (24 * 60)
GETMINS% = GETMINS% + (MD(MTH) * (24 * 60))

I've got a error message:

[LIBRARY] GETMINS% = GETMINS% + (MD(MTH) * (24 * 60))
Error: Variable not declared

By my opinion the MD() is a global variable
Without transferring the program to the library it operates well.

Any help?

drk





 
drkl

Senior Member

Joined: 18/10/2015
Location: Hungary
Posts: 102
Posted: 01:53am 28 Dec 2015
Copy link to clipboard 
Print this post

Hi.
I answer to myself, here is the solution

SUB MM.STARTUP
LB_INIT
END SUB
SUB LB_INIT
RESTORE
DIM MD(12)
DATA 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334
FOR I = 1 TO 12: READ MD(I): NEXT I
END SUB

drk
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025