|
PPICBASIC is a micro-controller developed by COMFILE Technology and is programmed in a form of the BASIC language. Because that most of micro-controllers is programmed in the Assembly (or C) language, even though you spend lot of time to learn how to use it, you still need much more time to obtain . This is why we introduce PICBASIC to market. PICBASIC has BASIC interpreter inside of a microcontroller on board so that you can program micro controller in a form of the BASIC language with ease. |
|
|
A PICBASIC module has two major components, a PICmicro microchip and an EEPROM. User's program is stored in the EEPROM after being converted into Áß°£ÇüÅÂ. the EEPROM is non-volatile storage and can retain memory even without electric power. The PICmicro microchip contains PICBASIC interpreter translating and executing user's program inside of the EEPROM. |
|
|
|
<< PICBASIC PB-1S >> |
<< PICBASIC PB-2S >> |
|
To program a
PICBASIC module, you should connect the PICBASIC module to your PC first. |
|
|
When you need to revise a program which is already written in PICBASIC module, you just simply re-connect the PICBASIC cable to PC, and revise the program on PICBASIC studio. The program is stored at EEPROM, which keeps its data even at power-off state. |
|
PICBASIC studio is Integrated Development Environment for PICBASIC. It includes Compiler, Editor, Debugger and etc and has similar usage as a word processor and is compatible with Microsoft Windows 98/ME/NT/2000/XP. You can get it from COMFILE program CD provided with PICBASIC products or download from download section of www.comfile.co.kr |
|
|
PICBASIC
series ha various type of PICBASIC moudes and have PBM series and PB
series. PBM series is advanced PICBASIC modules which have extra instruction,
floating point operation, handing string etc. |
PB series |
EEPROM |
SRAM |
I/O ports |
Function |
PB-1B |
2K |
96 Byte |
16 |
22 PIN |
PB-1S |
4K |
96 Byte |
16 |
22 PIN, A/D 8chennel |
PB-2S |
8K |
96 Byte |
27 |
34 PIN, DIP package |
PB-2H |
16K |
96 Byte |
27 |
Equivalent with PB-2S except 20Mhz of execution speed |
PB-3B |
4K |
80 Byte |
21 |
One chip type |
PB-3H |
4K |
80 Byte |
29 |
One chip type |
PBM series |
EEPROM |
SRAM |
I/O ports |
Function |
PBM-R1 |
62K |
8K Byte |
32 |
Floating point operation, String, Hardware RS232C, Mathematical function |
PBM-R5 |
64K |
32K Byte |
34 |
12bits A/D, Built-in RTC and battery, Floating point operation, String, Hardware RS232C, Mathematical function |
** Make certain that PICBASIC recognize all Lower-case letter as Capital letter in compiling. |
||||||||||||||
|
||||||||||||||
- Byte : 8bit number
without sign (0~255) Byte
variable is a type of 8bit number without sign and reserves 8bits (1byte)
of memory space. Therefore, its expression range is 0~225. The name of variable
must be start with English character. the name of Command and Function
cannot be used as variable name. Variable
definition must be placed in the first part of program according to
the following format. |
||||||||||||||
|
||||||||||||||
|
||||||||||||||
|
||||||||||||||
|
||||||||||||||
You can also define Byte type one-dimensional array up to 65535 elements in PICBASIC. DIM
A(20) AS BYTE
¡® Define 20 of A array Parameter of array
starts from 0. Therefore, when 20 elements are defined, you can use
from 0 to 19. Because that PB modules have limited size of data memory,
maximum definition range of array is same as size of data memory. i.e.,
PB-1S has 96bytes of data memory. Therefore, it is possible to use array
up to 96bytes. You cannot use array as parameter of array as follows. |
||||||||||||||
|
||||||||||||||
|
||||||||||||||
Constant is invariant value while a program operates. PICBASIC provides a function allowing user to definite several constants like array. This function is very useful to handling a lot of data. You can use data defined as constant array as array in program. The following example shows how to definite/use constant array. CONST BYTE DATA1
= (31, 25, 102, 34, 1, 0, 0, 0, 0, 0, 65, 64, 34)
CONST INTEGER DATA1
= (6000, 3000, 65500, 0, 3200)
CONST BYTE DATA1
= (31, 25, 102, 34, 1, 0, 0, 0, 0, 0, 65, 64, 34,
CONST BYTE DATA1 = (¡°I LOVE PICBASIC 2000¡±, 13, 10, 0) The difference between common array and constant array is that data defined as constant array shall be recorded in program memory when it is downloaded into a PICBASIC module. General array is recorded in data memory (SRAM) and is not conserved after RESET. But, constant array remains in program memory even after RESET. |
||||||||||||||
|
||||||||||||||
|
||||||||||||||
Expression in PICBASIC forms as follows.
I
= 0 '
Input 0 to variable I You can use Byte/Integer variable, constant and function as an operator.If a destination variable is Byte type, the result of an operation is stored in the form of Byte type even though the result exceeds 255. (Make sure that value exceeding 8bits is cut.) However, if a destination variable is Integer type, the result of an operation is stored in the form of Integer type. The following table shows operators available in PICBASIC.
DIM S1 AS SINGLE Logical/MOD operation is not available with Single variable/constant. PB
series module doesn't provide Floating point number operation. |
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
||||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||
|
|
||||||||||||||||
|
|
The
first example of application with PICBASIC is temperature-sensing with
digital themistor DS1620. |
|
|
<< Temperature-sensing circuit with DS1620 >> |
Description
of circuit |
Temperature |
Binary code |
Hexadecimal code |
+125 |
0 11111010 |
00FA |
+25 |
0 00110010 |
0032 |
+0.5 |
0 00000001 |
0001 |
0 |
0 00000000 |
0000 |
-0.5 |
1 11111111 |
01FF |
-25 |
1 11001110 |
01CE |
-55 |
1 10010010 |
0192 |
Source
program |
DIM
TH AS INTEGER |
'
Declaration?br>
' Send instruction code to DS1620 ' Read 9 bits of temperature data ' Display the data on LCD |
|
SGN module has dedicated module for Dynamic interfacing method, which is commonly used in handling Seven Segmnets. Therefore, users can display data on SGN by sending data to Dynamic moule through RS232C.SGN can display character, special mark, etc as well as digit. |
|
<< SGN(Seven Segment Network) ¸ðµâ >> |
|
<<Circuit for connection between PICBASIC module and SGN module>> |
Instruction Format for interfacing with SGN |
|
Because
a SGN module operates in 5V level of RS232C, there's no need of extra
conversion circuit to interface with a PICBASIC module at 9600 baud
rate. Each SGN module has unique ID code. The ID code, which can be
set with DIP S/W on the back of SGN module, is useful in using several
SGN modules on one line. |
Source Porgram |
LOOP:
SEROUT 8,30,0,1,[&HE0,1,&H31] '
Digit 1 |
|
DS1302
is Clock & Calender chip revising time data such as second, minute,
hour, date, month and year (including leap year) automatically. |
|
|
DS1302
has internally several data areas. Each area contains and revises each
of time data (second, minute, hour, year, month, day, date). |
|
This is order of transmission. Transmission will perform in order of command, address and data by SHIFTOUT instruction. (SHIFTIN instruction is used to read data while SHIFTOUT is used to write data.) |
|
The
following example program is for initializing SECOND area (address 0)
by supplying power, and reading data of SECOND area, and displaying
the data on a LCD. |
DIM
I AS BYTE |
|
Copyright
¨Ï 2000 COMFILE Technology
All rights reserved. |