PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : اموزش ساخت کتابخانه در بسکام



هنرفر
16-10-2009, 21:27
با سلام اگر کسی می دونه چجوری میشه در بسکام کتابخانه ساخت لطفا کمک کنه

kavir
17-10-2009, 03:11
سلام
من خیلی وقته بسکام گذاشم کنار ولی توی راهنماش یه چیزایی گفته
دوم اینکه راه درست C هست و شک نکنید :wink:
[align=left:02e6b2d645]Creating your own LIB file



A library file is a simple ASCII file. It can be created with the BASCOM editor, notepad or any other ASCII editor.

When you use BASCOM, make sure that the LIB extension is added to the Options, Environment, Editor, "No reformat extension".

This will prevent the editor to reformat the LIB file when you open it.





The file must include the following header information. It is not used yet but will be later.

copyright = Your name

www = optional location where people can find the latest source

email = your email address

comment = AVR compiler library

libversion = the version of the library in the format : 1.00

date = date of last modification

statement = A statement with copyright and usage information



The routine must start with the name in brackets and must end with the [END].



The following ASM routine example is from the MYLIB.LIB library.



[test]

Test:

ldd r26,y+2 ; load address of X

ldd r27,y+3

ld r24,x ; get value into r24

Inc r24 ; value + 1

St x,r24 ; put back

ldd r26,y+0 ; address of Y

ldd r27,y+1

st x,r24 ; store

ret ; ready

[END]





After you have saved your library in the LIB subdirectory you must compile it with the LIB Manager. Or you can include it with the LIB extension in which case you don’t have to compile it.





About the assembler.

When you reference constants that are declared in your basic program you need to put a star(*) before the line.



'basic program

CONST myconst = 7





'asm lib

* sbi portb, myconst





By adding the *, the line will be compiled when the basic program is compiled. It will not be changed into object code in the LBX file.

When you use constants you need to use valid BASIC constants:



Ldi r24,12

Ldi r24, 1+1

Ldi r24, &B001

Ldi r24,0b001

Ldi r24,&HFF

Ldi r24,$FF

Ldi r24,0xFF



Other syntax is NOT supported.





See also

$EXTERNAL







Example

$regfile = "m48def.dat"

$crystal = 4000000

$baud = 19200

Config Com1 = Dummy , Synchrone = 0 , Parity = None , Stopbits = 1 , Databits = 8 , Clockpol = 0





'In order to let this work you must put the mylib.lib file in the LIB dir

'And compile it to a LBX

'-------------------------------------------------------------------------

'define the used library

$lib"mylib.lbx"

'you can also use the original ASM :

'$LIB "mylib.LIB"



'also define the used routines

$external Test



'this is needed so the parameters will be placed correct on the stack

Declare Sub Test(byval X Asbyte , Y Asbyte)





'reserve some space

Dim Z As Byte





'call our own sub routine

Call Test(1 , Z)



'z will be 2 in the used example

End
[/align:02e6b2d645]