User manual MIKROELEKTRONIKA MIKROBASIC VERSION 5.0
Lastmanuals offers a socially driven service of sharing, storing and searching manuals related to use of hardware and software : user guide, owner's manual, quick start guide, technical datasheets... DON'T FORGET : ALWAYS READ THE USER GUIDE BEFORE BUYING !!!
If this document matches the user guide, instructions manual or user manual, feature sets, schematics you are looking for, download it now. Lastmanuals provides you a fast and easy access to the user manual MIKROELEKTRONIKA MIKROBASIC. We hope that this MIKROELEKTRONIKA MIKROBASIC user guide will be useful to you.
Lastmanuals help download the user guide MIKROELEKTRONIKA MIKROBASIC.
Manual abstract: user guide MIKROELEKTRONIKA MIKROBASICVERSION 5.0
Detailed instructions for use are in the User's Guide.
[. . . ] mikroElektronika
Development tools - Books - Compilers www. mikroe. com
User's manual
BASIC Compiler for Microchip PIC microcontrollers
mikroBASIC
Making it simple
mikro
IN-CIRCUIT
ICD
Develop your applications quickly and easily with the world's most intuitive BASIC compiler for PIC Microcontrollers (families PIC12, PIC16, and PIC18). Highly sophisticated IDE provides the power you need with the simplicity of a Windows based point-and-click environment. With useful implemented tools, many practical code examples, broad set of built-in routines, and a comprehensive Help, mikroBasic makes a fast and reliable tool, which can satisfy needs of experienced engineers and beginners alike.
DEBUGGER
SUPPORTED from V5. 0
mikroBASIC
mikroBASIC - BASIC Compiler for Microchip PIC microcontrollers
making it simple. . .
Reader's note
DISCLAIMER: mikroBasic and this manual are owned by mikroElektronika and are protected by copyright law and international copyright treaty. Therefore, you should treat this manual like any other copyrighted material (e. g. , a book). [. . . ] The purpose of the swap file is to make reading and writing to CF media as fast as possible, without potentially damaging the FAT system. Swap file can be considered as a "window" on the media where user can freely write/read the data, in any way (s)he wants to. Its main purpose in mikroBasic library is to be used for fast data acquisition; when the time-critical acquisition has finished, the data can be re-written into a "normal" file, and formatted in the most suitable way.
Description
Requires Example
Ports must be initialized for FAT operations with CF. See Cf_Fat_Init.
'-------------- Tries to create a swap file, whose size will be 'at least 100 sectors. of start sector over USART sub procedure C_Create_Swap_File size = Cf_Fat_Get_Swap_File(100) if (size) then Usart_Write($AA) Usart_Write(Lo(size)) Usart_Write(Hi(size)) Usart_Write(Higher(size)) Usart_Write(Highest(size)) Usart_Write($AA) end if end sub
page
mikroElektronika: Development tools - Books - Compilers
139
mikroBASIC
mikroBASIC - BASIC Compiler for Microchip PIC microcontrollers
making it simple. . .
Library Examples
The following example writes 512 bytes at sector no. 590, and then reads the data and prints on PORTC for a visual check.
program Cf_example dim i as word dim temp, k as longint main: TRISC = 0 Cf_Init(PORTB, PORTD) do nop loop until Cf_Detect = true Delay_ms(500) Cf_Write_Init(590, 1) address 590 for i = 0 to 511 Cf_Write_Byte(i + 11) next i PORTC = $FF Delay_ms(1000) Cf_Read_Init(590, 1) for i = 0 to 511 PORTC = Cf_Read_Byte Delay_ms(1000) next i end. ' Wait until CF card is inserted
' PORTC is output ' Initialize ports
' Initialize write at sector ' of 1 sector (512 bytes) ' Write 512 bytes to sector (590)
' Initialize write at sector address 590 ' of 1 sector (512 bytes) ' Read 512 bytes from sector (590) ' Read byte and display on PORTC
page
140
mikroElektronika: Development tools - Books - Compilers
mikroBASIC
making it simple. . .
mikroBASIC - BASIC Compiler for Microchip PIC microcontrollers
HW Connection
RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0
40 39 38 37 36 35 34 33
PIC18F452
VCC
11 12 13 14 15 8 MhZ VCC GND OSC1 OSC2 RC0
RD7 RD6 RD5 RD4
30 29 28 27
19 20
RD0 RD1
RD3 RD2
22 21
VCC
RD7 RD6 RD5 RD4 RD3 RD2 RD1 RD0
50 49 25
RB7 RB6 RB5 RB4 RB3 RB2 RB1 RB0
24 48 23 47 22 46 21 45 20 44 19 43 18 42 17 41 16 40 15 39 14 38 13 37 12 36 11 35 10 34 9 33 8 32 7 31 6 30 5 29 4 28 3 27 2 26 1
Compact Flash Card
R25 10K
VCC
page
mikroElektronika: Development tools - Books - Compilers
141
mikroBASIC
mikroBASIC - BASIC Compiler for Microchip PIC microcontrollers
making it simple. . .
EEPROM Library
EEPROM data memory is available with a number of PICmicros. mikroBasic includes library for comfortable work with EEPROM.
Library Routines
Eeprom_Read Eeprom_Write
Eeprom_Read
Prototype Returns Description
sub function EEprom_read(dim Address as word) as byte
Returns byte from specified address. Parameter address is of byte type, which means it can address only 1024 locations. For PIC18 micros with more EEPROM data locations, it is programmer's responsibility to set EEADRH register appropriately. Ensure minimum 20ms delay between successive use of routines Eeprom_Write and Eeprom_Read. Although PIC will write the correct value, Eeprom_Read might return an undefined result.
Requires
Example
take = Eeprom_Read($3F)
page
142
mikroElektronika: Development tools - Books - Compilers
mikroBASIC
making it simple. . .
mikroBASIC - BASIC Compiler for Microchip PIC microcontrollers
Eeprom_Write
Prototype Description
sub procedure EEprom_write(dim Address as word, dim Data as byte)
Writes data to specified address. Parameter address is of byte type, which means it can address only 1024 locations. For PIC18 micros with more EEPROM data locations, it is programmer's responsibility to set EEADRH register appropriately. Be aware that all interrupts will be disabled during execution of Eeprom_Write routine (GIE bit of INTCON register will be cleared). Routine will set this bit on exit.
Requires
Requires EEPROM module. Ensure minimum 20ms delay between successive use of routines Eeprom_Write and Eeprom_Read. Although PIC will write the correct value, Eeprom_Read might return an undefined result.
Example
Eeprom_Write($32)
Library Example
The example writes values at 20 successive locations of EEPROM. Then, it reads the written data and prints on PORTB for a visual check.
program eeprom_test dim i, j as char main: TRISB = 0 for i = 0 to 20 EEprom_Write(i, i + 6) next i for i = 0 to 20 PORTB = Eeprom_Read(i) for j = 0 to 200 Delay_us(500) next j next i end.
page
mikroElektronika: Development tools - Books - Compilers
143
mikroBASIC
mikroBASIC - BASIC Compiler for Microchip PIC microcontrollers
making it simple. . .
Ethernet Library
This library is designed to simplify handling of the underlying hardware (RTL8019AS). However, certain level of knowledge about the Ethernet and Ethernet-based protocols (ARP, IP, TCP/IP, UDP/IP, ICMP/IP) is expected from the user. The Ethernet is a highspeed and versatile protocol, but it is not a simple one. Once you get used to it, however, you will make your favorite PIC available to a much broader audience than you could do with the RS232/485 or CAN.
Library Routines
Eth_Init Eth_Set_Ip_Address Eth_Inport Eth_Scan_For_Event Eth_Get_Ip_Hdr_Len Eth_Load_Ip_Packet Eth_Get_Hdr_Chksum Eth_Get_Source_Ip_Address Eth_Get_Dest_Ip_Address Eth_Arp_Response Eth_Get_Icmp_Info Eth_Ping_Response Eth_Get_Udp_Source_Port Eth_Get_Udp_Dest_Port Eth_Get_Udp_Port Eth_Set_Udp_Port Eth_Send_Udp Eth_Load_Tcp_Header Eth_Get_Tcp_Hdr_Offset Eth_Get_Tcp_Flags Eth_Set_Tcp_Data Eth_Tcp_Response
page
144
mikroElektronika: Development tools - Books - Compilers
mikroBASIC
making it simple. . .
mikroBASIC - BASIC Compiler for Microchip PIC microcontrollers
Eth_Init
Prototype Description
sub procedure Eth_Init(dim byref addrP, dataP, ctrlP as byte, dim pinReset, pinIOW, pinIOR as byte)
Performs initialization of Ethernet card and library. This includes: - Setting of control and data ports; - Initialization of the Ethernet card (also called the Network Interface Card, or NIC); - Retrieval and local storage of the NIC's hardware (MAC) address; - Putting the NIC into the LISTEN mode. [. . . ] GLCD needs to be initialized, see Spi_T6963C_Config.
Spi_T6963C_displayTxtPanel(n)
Spi_T6963C_setGrPanel
Prototype Description Requires Example
sub procedure Spi_T6963C_setGrPanel(dim n as word)
Compute graphic start address for panel number n. GLCD needs to be initialized, see Spi_T6963C_Config.
Spi_T6963C_setGrPanel(n)
Spi_T6963C_setTxtPanel
Prototype Description Requires Example
sub procedure Spi_T6963C_setTxtPanel(dim n as word)
Compute text start address for panel number n. GLCD needs to be initialized, see Spi_T6963C_Config.
Spi_T6963C_setTxtPanel(n)
page
334
mikroElektronika: Development tools - Books - Compilers
mikroBASIC
making it simple. . .
mikroBASIC - BASIC Compiler for Microchip PIC microcontrollers
Spi_T6963C_panelFill
Prototype Description Requires Example
sub procedure Spi_T6963C_panelFill(dim v as word)
Fill full #n panel with v bitmap (0 to clear). GLCD needs to be initialized, see Spi_T6963C_Config.
Spi_T6963C_panelFill(v)
Spi_T6963C_grFill
Prototype Description Requires Example
sub procedure Spi_T6963C_grFill(dim v as word)
Fill graphic #n panel with v bitmap (0 to clear). [. . . ]
DISCLAIMER TO DOWNLOAD THE USER GUIDE MIKROELEKTRONIKA MIKROBASIC
Lastmanuals offers a socially driven service of sharing, storing and searching manuals related to use of hardware and software : user guide, owner's manual, quick start guide, technical datasheets... In any way can't Lastmanuals be held responsible if the document you are looking for is not available, incomplete, in a different language than yours, or if the model or language do not match the description. Lastmanuals, for instance, does not offer a translation service.
Click on "Download the user manual" at the end of this Contract if you accept its terms, the downloading of the manual MIKROELEKTRONIKA MIKROBASIC will begin.