SYSTEM değişkenleri nedir?

Başlatan Maxim, 26 Haziran 2009, 08:28:01

Maxim

bazı kodlarda böyle bir "system" eklemesi görüyorum ,
millet neden böyle birşey yapıyor ,bilen varmı ? anlamı nedir ?

Dim test1 As Word SYSTEM

OG

Türkçe;

veya http://rapidshare.com/files/251248503/97765004.jpg

Alıntı YapIntuitive Variable Handling
The compiler handles it's SYSTEM variables intuitively, in that it only creates those that it requires. Each of the compiler's built in library subroutines i.e. print, rsout etc, require a certain amount of SYSTEM RAM as internal variables. Previous versions of the compiler defaulted to 26 RAM spaces being created before a program had been compiled. However, with the 12-bit core device compatibility, 26 RAM slots is more than some devices possess.

Try the following program, and look at the RAM usage message on the bottom STATUS bar.

DIM WRD1 AS WORD                  ' Create a WORD variable i.e. 16-bits

Loop:
 HIGH PORTB.0                    ' Set bit 0 of PORTB high
 FOR WRD1= 1 TO 20000 : NEXT     ' Create a delay without using a library call
 LOW PORTB.0                     ' Set bit 0 of PORTB high
 FOR WRD1= 1 TO 20000 : NEXT     ' Create a delay without using a library call
 GOTO Loop                       ' Do it forever

Only two bytes of RAM were used, and those were the ones declared in the program as variable WRD1.

The compiler will increase it's SYSTEM RAM requirements as programs get larger, or more complex structures are used, such as complex expressions, inline commands used in conditions, Boolean logic used etc. However, with the limited RAM space available on some PICmicro devices, every byte counts.

There are certain reserved words that cannot be used as variable names, these are the system variables used by the compiler.

Alıntı YapON_INTERRUPT
.
.
.
.
Precautions

Because a hardware interrupt may occur at any time, It cannot be fully guaranteed that a SYSTEM variable will not be disturbed while inside the interrupt handler, therefore, the safest way to use a HARDWARE interrupt is to write the code in assembler, or to implement a SOFTWARE interrupt using the ON INTERRUPT directive. This will guarantee that no system variables are being altered. Alternatively, the assembler code may be viewed in order to ascertain whether any system variables are being used. Some of these are: -

PP0, PP0H, PP1, PP1H, PP2, PP2H, PP3, PP3H, PP4, PP4H, PP5, PP5H, PP6, PP6H, PP7, PP7H, GEN, GENH, GEN2, GEN2H, GEN3, GEN3H, GEN4, GEN4H, GPR, BPF.

If an unrecognised or undeclared variable name is seen within the interrupt handler's assembler code, then it will be a SYSTEM variable, and the program may fail, either subtly or disastrously.

Alıntı Yap
PIC Microcontroller Devices

.
.
.
Programming Considerations for 12-bit Devices

Because of the limited architecture of the 12-bit core PICmicro microcontrollers, programs compiled for them by PROTON+ will be larger and slower than programs compiled for the 14-bit core devices.

The two main programming limitations that will most likely occur are running out of RAM memory for variables, and running past the first 256 word limit for the library routines.

Even though the compiler arranges its internal SYSTEM variables more intuitively than previous versions, it still needs to create temporary variables for complex expressions etc. It also needs to allocate extra RAM for use as a SOFTWARE-STACK so that the BASIC program is still able to nest GOSUBs up to 4 levels deep.

Some PICmicro devices only have 25 bytes of RAM so there is very little space for user variables on those devices. Therefore, use variables sparingly, and always use the appropriately sized variable for a specific task. i.e. BYTE variable if 0-255 is required, WORD variable if 0-65535 required, BIT  variables if a true or false situation is required. Try to alias any commonly used variables, such as loops or temporary stores etc.

As was mentioned earlier, 12-bit core PICmicro microcontrollers can call only into the first half (256 words) of a code page. Since the compiler's library routines are all accessed by calls, they must reside entirely in the first 256 words of the PICmicro code space. Many library routines, such as BUSIN, are quite large. It may only take a few routines to outgrow the first 256 words of code space. There is no work around for this, and if it is necessary to use more library routines that will fit into the first half of the first code page, it will be necessary to move to a 14-bit core PICmicro instead of the 12-bit core device.

Alıntı Yap
USBIN
.
.
.
Upon exiting the USBIN command, system variable PP2 will contain the amount of bytes received. In order to use PP2, it will need to be declared within the BASIC program as a SYSTEM type variable: - DIM PP2 AS BYTE SYSTEM



Alıntı Yap
USBPOLL
Syntax

USBPOLL

Overview

Poll the USB interface in order to keep it attached to the bus. For 16-bit core devices only.
Notes
If the commands USBIN or USBOUT are not used within a program loop, the interface will drop off the bus, therefore issue the USBPOLL command to stop this happening. This command should be issued at least every 10ms if using a HID interface and at least once every 5ms for a CDC interface.

Upon exiting the USBPOLL command, the state of the bus can be checked via the USB variable __USB_DEVICE_STATE. This variable resides in bank 4 of the PICmicro (as do all of the USB variables), which means that bank switching will take place whenever it is accessed. For this reason, the USBPOLL library subroutine loads this variable into one of the compiler's system variables which reside in access RAM. The variable it uses is named PP0.

If variable PP0 is to be used in the BASIC program, you will need to bring it to the compiler's attention by issuing the following define within you DIM list: -

DIM PP0 AS BYTE SYSTEM

Several states are declared within the USBDEFS.INC file located within the compiler‘s INC\USB_18 folder. These are: -

DETACHED_STATE            0
ATTACHED_STATE            1
POWERED_STATE             2
DEFAULT_STATE             3
ADDRESS_PENDING_STATE     4
ADDRESS_STATE             5
CONFIGURED_STATE          6

Example
' Wait the for USB interface to be recognised and attached
REPEAT
USBPOLL
UNTIL PP0 = 6

The USBPOLL command is only required for Full Speed USB interfaces used by 16-bit core devices.

Download the Microchip PICDEM FSUSB demo board's documentation and C source code for more information concerning the firmware used by the compiler. www.microchip.com

Alıntı YapLINETO
.
.
.
The LineTo command uses the compiler's internal system variables to obtain the end position of a previous Line command. These X and Y coordinates are then used as the starting X and Y coordinates of the LineTo command.

For this reason, you must ensure that a LineTo command follows a Line command, so that the X and Y position variables are not destroyed by any subsequent commands. As shown in the above example, loading and assigning variables is permitted so long as they do not alter system variables PP3 or GENH. You can find this out by examining the ASM file produced.
FORUMU İLGİLENDİREN KONULARA ÖM İLE CEVAP VERİLMEZ.

muhittin_kaplan

Hocam Bu TR kitabın Adı Nedir..

OG

http://www.infogate.org/proton.htm

Proton Help Türkçesi, fakat biraz eski kalmış, sanırım v2 zamanından, yeni komutları bulamıyabiliyorsunuz.
FORUMU İLGİLENDİREN KONULARA ÖM İLE CEVAP VERİLMEZ.

gcolak