Prices
| Support | Download
PIC
Simulator IDE is powerful application that supplies PIC developers with
user-friendly graphical development environment for Windows with integrated
simulator (emulator), Basic compiler, assembler, disassembler and debugger.
PIC Simulator IDE currently supports the following microcontrollers from
the Microchip PICmicro product line: 12F629, 12F675, 16F627, 16F627A, 16F628,
16F628A, 16F630, 16F648A, 16F676, 16F684, 16F688, 16F72, 16F73, 16F74,
16F76, 16F77, 16F737, 16F747, 16F767, 16F777, 16F83, 16F84, 16F84A, 16F87,
16F88, 16F818, 16F819, 16F870, 16F871, 16F872, 16F873, 16F873A, 16F874,
16F874A, 16F876, 16F876A, 16F877, 16F877A.
You
are welcome to download the fully functional evaluation copy of the software
on the downloads
page. PIC Simulator IDE requires a license to operate after the evaluation
period. If you would like to see several original comments I received from
the users of my Simulators, please visit the comments
page
There
are four types of licenses available:
Personal
license for individuals grants right to one single user to use the
program on one home personal computer for non-commercial purposes.
Commercial/educational
license for business companies, educational institutions and individuals
using the software for commercial purposes grants right to the owner to
use the program on one single computer. Multiple licenses are required
for multiple computers with program installations.
Site
license grants right to the institution to use the program on all computers
located on one institution site (the most suitable choice for computer
labs).
Institution
license grants right to the institution to use the program on all computers
on all sites that belong to the institution.
Once
purchased license will be valid for all future versions of the corresponding
application.
Your
personal license is a permanent license that will enable you to use the
software on your personal computer even when you get the new machine in
the future. It is by no means linked to your present computer, but only
to your name.
Pic
Examples
Screenshot
2
Screenshot
3
The
screenshots of individual components:
PIC
BASIC Compiler
PIC
Assembler
Debugger
- Breakpoints Manager
Microcontroller
View
LCD
Module Simulator
PIC
Disassembler
Program
Memory Viewer
EEPROM
Memory Viewer
Hardware
Stack Viewer
Configuration
Bits
Serial
Port Terminal
Interactive
Assembler Editor (1)
Interactive
Assembler Editor (2)
PIC
BASIC Compiler Help Topics
Default
extension for basic source files is BAS. The compiler output is assembler
source file (with ASM extension) that can be translated to binary code
using integrated assembler. Smart editor marks all reserved keywords in
different color, that simplifies debugging process.
Three
data types are supported:
-
Bit (1-bit, 0 or 1)
-
Byte (1-byte integers in the range 0 to 255)
-
Word (2-byte integers in the range 0 to 65,535)
Declarations
may be placed anywhere in the program. All variables are considered global.
The total number of variables is limited by the available microcontroller
RAM memory. Variables are declared using DIM statement:
DIM A
AS BIT
DIM B
AS BYTE
DIM C
AS WORD
It
is also possible to use one-dimensional arrays. For example:
DIM A(10)
AS BYTE
declares
an array of 10 Byte variables with array index in the range [0-9].
It
is possible to make conversions between Byte and Word data types using
.LB and .HB extensions or directly:
DIM A
AS BYTE
DIM B
AS WORD
A = B.HB
A = B.LB
'This statement is equivalent to A = B
B.HB =
A
B.LB =
A
B = A
'This statement will also clear the high byte of B variable
All
special function registers (SFRs) are available as Byte variables in basic
programs. Individual bits of a Byte variable can be addressed by .0, .1,
.2, .3, .4, .5, .6 and .7 extensions:
DIM A
AS BIT
DIM B
AS BYTE
A = B.7
B.6 =
1
TRISA.1
= 0
TRISB
= 0
PORTA.1
= 1
PORTB
= 255
It
is also possible to use symbolic names (symbols) in programs:
SYMBOL
LED1 = PORTB.0
LED1 =
1
There
are three statements that are used for bit manipulation - HIGH, LOW and
TOGGLE. If the argument of these statements is a bit in one of the PORT
registers, then the same bit in the corresponding TRIS register is automatically
cleared, setting the affected pin as an output pin. Some examples:
HIGH PORTB.0
LOW ADCON0.0
TOGGLE
OPTION_REG.4
Constants
can be used in decimal number system with no special marks, in hexadecimal
number system with leading 0x notation and in binary system with leading
% mark. Keywords True and False are also available for Bit type constants.
For example:
DIM A
AS BIT
DIM B
AS BYTE
A = TRUE
B = 0x55
B = %01010101
Five
arithmetic operations (+, -, *, /, MOD) are available for Byte and Word
data types. It is possible to make only one arithmetic operation in one
single statement. Arithmetic operations are allowed only in assignment
statements and all variables in one such statement must be the same data
type or constants. For example:
DIM A
AS WORD
DIM B
AS WORD
A = 123
B = A
* 234
Square
root of a number can be calculated using SQR function:
DIM A
AS WORD
A = 3600
A = SQR(A)
For
Bit data type variables seven logical operations are available. It is possible
to make only one logical operation in one single statement. Logical operations
are allowed only in assignment statements. For example:
DIM A
AS BIT
DIM B
AS BIT
DIM C
AS BIT
C = NOT
A
C = A
AND B
C = A
OR B
C = A
XOR B
C = A
NAND B
C = A
NOR B
C = A
NXOR B
The
GOTO statement uses line label name as argument. Line labels must be followed
by colon mark ":". Here is one example:
DIM A
AS WORD
A = 0
loop:
A = A + 1
GOTO loop
WAITMS
and WAITUS statements can be used to force program to wait for the specified
number of milliseconds or microseconds. It is also possible to use variable
argument of Byte or Word data type. These routines use Clock Frequency
parameter that can be changed from the Options menu. WAITUS routine has
minimal delay and step that also depends on the Clock Frequency parameter.
DIM A
AS WORD
A = 100
WAITMS
A
WAITUS
50
PLEASE
NOTE: When writing programs for real PIC devices you will most likely use
delay intervals that are comaprable to 1 second or 1000 milliseconds. Many
examples in this help file also use such 'real-time' intervals. But, if
you want to simulate those programs you have to be very patient to see
something to happen, even on very powerful PCs available today. For simulation
of 'WaitMs 1000' statement on 4MHz you have to wait the simulator to simulate
1000000 instructions and it will take considerable amount of time even
if 'extremely fast' simulation rate is selected. So, just for the purpose
of simulation you should recompile your programs with adjusted delay intervals,
that should not exceed 1-10ms. But, be sure to recompile your program with
original delays before you download it to a real device.
Access
to EEPROM data memory can be programmed using READ and WRITE statements.
The first argument is the address of a byte in EEPROM memory and can be
a constant or Byte variable. The second argument is data that is read or
written (for READ statement it must be a Byte variable).
DIM A
AS BYTE
DIM B
AS BYTE
A = 10
READ A,
B
WRITE
11, B
Three
standard BASIC statements are supported: FOR-TO-STEP-NEXT, WHILE-WEND and
IF-THEN-ELSE-ENDIF. Here are several examples:
DIM A
AS BYTE
TRISB
= 0
A = 255
WHILE
A > 0
PORTB = A
A = A - 1
WAITMS 100
WEND
PORTB
= A
TRISB =
0
loop:
IF PORTA.0
THEN
PORTB.0 = 1
ELSE
PORTB.0 = 0
ENDIF
GOTO loop
DIM A AS
WORD
TRISB
= 0
FOR A
= 0 TO 10000 STEP 10
PORTB = A.LB
NEXT A
DIM A AS
BYTE
DIM B
AS BYTE
DIM C
AS BYTE
B = 255
C = 2
TRISB
= 0
FOR A
= B TO 0 STEP -C
PORTB = A
NEXT A
IF
statements that are not used for conditional branching must always be used
in connection with ENDIF, even if there is only one statement to be executed
if the condition is satisfied. If there are statements following THEN in
the same line an error is generated. Only GOTO statement (or just line
label name) may be placed in the same line after THEN statement. There
are no limits for the number of nested statements of any kind.
SHIFTLEFT
and SHIFTRIGHT functions can be used to shift bit-level representation
of a variable left and right. The first argument is input variable and
the second argument is number of shifts to be performed. Here are two examples:
TRISB
= 0x00
PORTB
= %00000011
goleft:
WAITMS
250
PORTB
= SHIFTLEFT(PORTB, 1)
IF PORTB
= %11000000 THEN GOTO goright
GOTO goleft
goright:
WAITMS
250
PORTB
= SHIFTRIGHT(PORTB, 1)
IF PORTB
= %00000011 THEN GOTO goleft
GOTO goright
TRISB =
0x00
PORTB
= %00000001
goleft:
WAITMS
250
PORTB
= SHIFTLEFT(PORTB, 1)
IF PORTB.7
THEN goright
GOTO goleft
goright:
WAITMS
250
PORTB
= SHIFTRIGHT(PORTB, 1)
IF PORTB.0
THEN goleft
GOTO goright
ADCIN
statement is available as a support for internal A/D converter. Its first
argument is ADC channel number and the second argument is a variable that
will be used to store the result od A/D conversion. ADCIN statement uses
two parameters ADC_CLOCK and ADC_SAMPLEUS that have default values 3 and
20. These default values can be changed using DEFINE directive. ADC_CLOCK
parameter determines the choice for ADC clock source (0-3). ADC_SAMPLEUS
parameter sets the desired ADC acquisition time in microseconds (0-255).
ADCIN statement presupposes that the corresponding pin is configured as
an analog input (TRIS and ADCON1 register). Here is one example:
DIM V(5)
AS BYTE
DIM VM
AS WORD
DIM I
AS BYTE
DEFINE
ADC_CLOCK = 3
DEFINE
ADC_SAMPLEUS = 50
TRISA
= 0xFF
TRISB
= 0
ADCON1
= 0
FOR I
= 0 TO 4
ADCIN 0, V(I)
NEXT I
VM = 0
FOR I
= 0 TO 4
VM = VM + V(I)
NEXT I
VM = VM
/ 5
PORTB
= VM.LB
Structured
programs can be written using subroutine calls with GOSUB statement that
uses line label name as argument. Return from a subroutine is performed
by RETURN statement. User need to take care that the program structure
is consistent. When using subroutines, main routine need to be ended with
END statement. END statement is compiled as an infinite loop. Here is an
example:
SYMBOL
ad_action = ADCON0.2
SYMBOL
display = PORTB
TRISB
= %00000000
TRISA
= %111111
ADCON0
= 0xC0
ADCON1
= 0
HIGH ADCON0.0
main:
GOSUB
getadresult
display
= ADRESH
GOTO main
END
getadresult:
HIGH ad_action
WHILE
ad_action
WEND
RETURN
Interrupt
routine should be placed as all other subroutines after the END statement.
It should begin with ON INTERRUPT and end with RESUME statement. If arithmetic
operations, arrays or any other complex statements are used in interrupt
routine, then SAVE SYSTEM statement should be placed right after ON INTERRUPT
statement to save the content of registers used by system. ENABLE and DISABLE
statements can be used in main program to control GIE bit in INTCON register.
For example:
DIM A
AS BYTE
A = 255
TRISA
= 0
PORTA
= A
INTCON.4
= 1
ENABLE
END
ON INTERRUPT
A = A - 1
PORTA = A
INTCON.1 = 0
RESUME
DIM T AS
WORD
T = 0
TRISA
= 0xFF
ADCON1
= 0
TRISB
= 0
OPTION_REG.5
= 0
INTCON.5
= 1
ENABLE
loop:
ADCIN 0, PORTB
GOTO loop
END
ON INTERRUPT
SAVE SYSTEM
T = T + 1
INTCON.2 = 0
RESUME
Basic
compiler also features the support for LCD modules. Prior to using LCD
related statements, user should set up LCD interface using DEFINE directives.
Here is the list of available parameters:
LCD_BITS
- defines the number of data interface lines (allowed values are 4 and
8; default is 4)
LCD_DREG
- defines the port where data lines are connected to (default is PORTB)
LCD_DBIT
- defines the position of data lines for 4-bit interface (0 or 4; default
is 4), ignored for 8-bit interface
LCD_RSREG
- defines the port where RS line is connected to (default is PORTB)
LCD_RSBIT
- defines the pin where RS line is connected to (default is 3)
LCD_EREG
- defines the port where E line is connected to (default is PORTB)
LCD_EBIT
- defines the pin where E line is connected to (default is 2)
LCD_RWREG
- defines the port where R/W line is connected to (set to 0 if not used;
0 is default)
LCD_RWBIT
- defines the pin where R/W line is connected to (set to 0 if not used;
0 is default)
LCD_COMMANDUS
- defines the delay after LCDCMDOUT statement (default value is 5000)
LCD_DATAUS
- defines the delay after LCDOUT statement (default value is 50)
LCD_INITMS
- defines the delay for LCDINIT statement (default value is 100)
The
last three parameters should be set to low values when using integrated
LCD module simulator.
LCDINIT
statement should be placed in the program before any of LCDOUT (used for
sending data) and LCDCMDOUT (used for sending commands) statements. Its
argument is used to define the cursor type: 0 = no cursor (default), 1
= blink, 2 = underline, 3 = blink + underline. LCDOUT and LCDCMDOUT statements
may have multiple arguments separated by ','. Strings, constants and variables
can be used as arguments of LCDOUT statement. If '#' sign is used before
the name of a variable then its decimal representation is sent to the LCD
module. Constants and variables can be used as arguments of LCDCMDOUT statement
and the following keywords are also available: LcdClear, LcdHome, LcdLine2Home,
LcdLeft, LcdRight, LcdShiftLeft, LcdShiftRight, LcdLine1Clear, LcdLine2Clear,
LcdLine1Pos() and LcdLine2Pos(). Argument of LcdLine1Pos() and LcdLine2Pos()
statements can be a number in the range (1-40) or Byte data type variable.
The value contained in that variable should be in the same range. Here
are some examples:
DEFINE
LCD_BITS = 8
DEFINE
LCD_DREG = PORTB
DEFINE
LCD_DBIT = 0
DEFINE
LCD_RSREG = PORTD
DEFINE
LCD_RSBIT = 1
DEFINE
LCD_EREG = PORTD
DEFINE
LCD_EBIT = 3
DEFINE
LCD_RWREG = PORTD
DEFINE
LCD_RWBIT = 2
DEFINE
LCD_COMMANDUS = 10000
DEFINE
LCD_DATAUS = 100
DEFINE
LCD_INITMS = 1000
LCDINIT
loop:
LCDOUT "Hello world!"
WAITMS 1000
LCDCMDOUT LcdClear
WAITMS 1000
GOTO loop
DEFINE
LCD_BITS = 8
DEFINE
LCD_DREG = PORTB
DEFINE
LCD_DBIT = 0
DEFINE
LCD_RSREG = PORTD
DEFINE
LCD_RSBIT = 1
DEFINE
LCD_EREG = PORTD
DEFINE
LCD_EBIT = 3
DEFINE
LCD_RWREG = PORTD
DEFINE
LCD_RWBIT = 2
DEFINE
LCD_COMMANDUS = 10000
DEFINE
LCD_DATAUS = 100
DEFINE
LCD_INITMS = 1000
DIM A
AS WORD
A = 65535
LCDINIT
3
WAITMS
1000
loop:
LCDOUT "I am counting!"
LCDCMDOUT LcdLine2Home
LCDOUT #A
A = A - 1
WAITMS 250
LCDCMDOUT LcdClear
GOTO loop
LCD
related statements will take control over TRIS registers connected with
pins used for LCD interface, but if you use PORTA or PORTE pins on devices
with A/D Converter Module then you should take control over ADCON1 register
to set used pins as digital I/O.
You
can setup up to eight user defined charcters to be used on LCD. This can
easily be done with LCDDEFCHAR statement. The first argument of this statement
is char number and must be in the range 0-7. Next 8 arguments form 8-line
char pattern (from the top to the bottom) and must be in the range 0-31
(5-bits wide). These 8 user characters are assigned to char codes 0-7 and
8-15 and can be displayed using LCDOUT statement. After LCDDEFCHAR statement
the cursor will be in HOME position. For example:
LCDDEFCHAR
0, 10, 10, 10, 10, 10, 10, 10, 10
LCDDEFCHAR
1, %11111, %10101, %10101, %10101, %10101,
%10101,
%10101, %11111
LCDOUT
0, 1, "Hello!", 1, 0
The
support for both hardware and software serial communication is also available.
HSEROPEN, HSEROUT, HSERIN and HSERGET statements can be used with PIC devices
that have internal hardware UART. HSEROPEN statement sets up the hardware
UART. Its only argument is baud rate and allowed values are: 300, 600,
1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400 and 56000. If the argument
is omitted UART will be set up for 9600 baud rate. SEROUT statement is
used for serial transmission. HSEROUT statement may have multiple arguments
separated by ','. You can use strings, LF keyword for Line Feed character
or CRLF keyword for Carriage Return - Line Feed sequence, constants and
variables. If '#' sign is used before the name of a variable then its decimal
representation is sent to the serial port. HSERIN statement can be used
to load a list of Byte and Word variables with the values received on serial
port. This statement will wait until the required number of bytes is received
on serial port. HSERGET statement have one argument that must be a Byte
variable. If there is a charcter waiting in the receive buffer it will
be loaded in the variable, otherwise 0 value will be loaded. Here are some
examples:
DIM I
AS BYTE
HSEROPEN
38400
WAITMS
1000
FOR I
= 20 TO 0 STEP -1
HSEROUT "Number: ", #I, CrLf
WAITMS 500
NEXT I
DIM I AS
BYTE
HSEROPEN
19200
loop:
HSERIN I
HSEROUT "Number: ", #I, CrLf
GOTO loop
DIM I AS
BYTE
HSEROPEN
19200
loop:
HSERGET I
IF I > 0 THEN
HSEROUT "Number: ", #I, CrLf
WAITMS 50
ENDIF
GOTO loop
On
all supported PIC devices you can use software serial communication routines
with SEROUT and SERIN statements. The first argument of both statements
must be one of the microcontroller's pins, and the second argument is baud
rate: 300, 600, 1200, 2400, 4800 or 9600. For SEROUT statement then follows
the list of arguments to be sent to serial port. You can use strings, LF
keyword for Line Feed character or CRLF keyword for Carriage Return - Line
Feed sequence, constants and variables. If '#' sign is used before the
name of a variable then its decimal representation is sent to the serial
port. SEROUT statement uses SEROUT_DELAYUS parameter that can be set by
DEFINE directive and has default value of 1000 microseconds. This defines
the delay interval before a character is actually sent to the port and
it is used to increase the reliability of software SEROUT routine. For
HSERIN statement then follows the list of Byte and Word variables to be
loaded with the values received on serial port. This statement will wait
until the required number of bytes is received on serial port. Some examples:
DEFINE
SEROUT_DELAYUS = 5000
SEROUT
PORTC.6, 1200, "Hello world!", CrLf
DIM I AS
BYTE
loop:
SERIN PORTC.7, 9600, I
SEROUT PORTC.6, 9600, "Number: ", #I, CrLf
GOTO loop
It
is possible to use comments in basic source programs. The comments must
begin with single quote symbol (') and may be placed anywhere in the program.
Lines
of assembler source code may be placed anywhere in basic source program
and must begin with ASM: prefix. For example:
ASM:
NOP
ASM:LABEL1:
MOVLW 0xFF
BASIC
compiler has no optimization abilities. Its assembler output has all necessary
comment lines, that makes this compiler very useful for educational purposes,
also. This is not the final release of integrated PIC BASIC compiler
PIC
Programmer
PIC
programmers and PIC programming are the main topics on many web sites.
This page is the result of my intention to give my contribution to those
efforts and to help the users of my PIC Simulator IDE and its integrated
basic compiler get some basic information how to put the generated HEX
code into a real PIC chip.
The
PIC programmer and PIC programming software that is presented here has
been tested by now with the following models: 16F84A-20, 16F628-20, 16F874-20.
It is firmly believed that all 16F devices from Microchip PICmicro product
line (16F627, 16F628, 16F72, 16F73, 16F74, 16F76, 16F77, 16F83, 16F84,
16F870, 16F871, 16F872, 16F873, 16F874, 16F876, 16F877) can be programmed
using this equipment. The reports regarding the models you have personally
tested will be appreciated.
Oshon
PIC Programmer software is very easy to use and works on all Windows platforms
(including Windows XP). It is free software and you can download it here
-
download. PIC Simulator
IDE should also be installed on your PC prior to using the programming
software.
Oshon
PIC Programmer uses PC's parallel port to communicate with programming
hardware. The programming hardware should meet the following requirements:
-
Pins 18-25 of parallel port connector should be connected to GND line on
the programmer
-
Pin 4 (D2) should control (turn on/off) VDD voltage on VDD pin of PIC chip
-
Pin 5 (D3) should control VPP (programming high) voltage on MCLR pin of
PIC chip
-
Pin 3 (D1) should control CLOCK line on RB6 pin of PIC chip
-
Pin 2 (D0) should control DATA line on RB7 pin of PIC chip
-
Pin 10 (ACK) should be controlled by the DATA line (RB7 pin of PIC chip)
The
polarity of the responses of all these signals can be inverted by the software,
and should not affect the hardware design. It is required that programmer
has its own power supply with two voltage levels: 13V for MCLR pin (programming
voltage) and 5V for the rest of hardware.
There
are many PIC programming hardwares all over the Internet that meet these
requirements. I present here the schematics of one simple design that I
personally use to program my PIC chips. This schematics is also available
from the Hardware menu of the programming software.
15V
to 25V will do for this circuit. Many people connect 2 x 9V batteries together.
| 31-May-2004
Helmut Schiretz, Electronics Engineering Technician, Canberra Australia
By the way Don, As well as MPASM and such programs as FPP, and PicProg877,
I'm using OshinSofts Basic IDE & Simulator for PIC and their Oshin
Pic Programmer. The Pic Programmer works well with your DT001
and DT106 set up for a 16F877,
the only changes needed are to the hardware settings, Invert D2 Invert
D3 Non-Invert D1, D0 and ACK |
| 2-Dec-2003
Robert Crooks Leicestershire UK Hi there, Thanks for the prompt way
that you have dealt with my order, I got the thing ordered and registered
in 5 hours total. Great service guys. Better service from Downunder than
here in the UK.Regards Bob |
Software
Download:
Downloads
PIC
Examples
Comments
About
the Author
Support:
If
you need additional support on the above product, and you can't find the
information you need in the documentation, then please contact support
at the address below:
This
product is from: OshonSoft
http://www.oshonsoft.com
oshon AT oshonsoft.com
Back
To Top