• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

help needed with microcontroller newbie and simulation software

Status
Not open for further replies.

yohanevindra

New Member
im jus starting this course in uni where we use the PIC 18F452. we use the PICDEM2 Plus boards and ICD2 debuggers. I want to try and get myself some practice outside of lab hours and also to be able to test code when i write it at home.

Is there any software where I can simulate a PIC on my laptop and not need any additional hardware? in one of my previous posts someone suggested oshonsoft and their PIC18 simulator seems quite good. how do i use it with MPLAB tho?do i write and compile the code in MPLAB and then convert it to HEX?or is there another program I can use.

I thought of buyin the PICDEM board and the debugger, but it can be quite expensive.

are the PICkit2 boards the same?or are they jus debuggers?
 

3v0

Coop Build Coordinator
Forum Supporter
The PICkit2 is a debugger/programmer only.

MPLAB has its own simulator. Just choose MPLAB SIM under debugger and you are ready to go. It does not have the nice high level IO dodads (like LCD) that oshonsoft has but it works.

This will also give you a chance to get used to the MPLAB debugger.

3v0
 

yohanevindra

New Member
so will the PICkit2 be an ok substitue for me to use at home in place of the PICDEM2 plus board?or will PORT and pin allocations change?

so if I need to simulate LEDs and LCDs in terms of simulators, oshonsoft is better?

boards, is there any difference between PICkit2 and PICDEM2 plus?
 

ericgibbs

Well-Known Member
Most Helpful Member
so will the PICkit2 be an ok substitue for me to use at home in place of the PICDEM2 plus board?or will PORT and pin allocations change?

so if I need to simulate LEDs and LCDs in terms of simulators, oshonsoft is better?

boards, is there any difference between PICkit2 and PICDEM2 plus?
hi,
Oshonsoft has graphical indicator modules, for LED's LCD's UART's etc.

You can use the Oshonsoft programs in MPLAB, either the asm or hex codes.

There is a 28day or 30 starts trial version from Oshonsoft.
 

yohanevindra

New Member
so in MPLBAD you hav to specify debugger and stuff. so do i jus neglect that, write my code, build it and then load the HEX code in oshonsoft?

also, LEDs in oshonsoft are on PORTA right?

so if i use oshonsoft all i need is MPLAB, oshonsoft and the required include files?
 

ericgibbs

Well-Known Member
Most Helpful Member
so in MPLBAD you hav to specify debugger and stuff. so do i jus neglect that, write my code, build it and then load the HEX code in oshonsoft?

also, LEDs in oshonsoft are on PORTA right?

so if i use oshonsoft all i need is MPLAB, oshonsoft and the required include files?
hi,
Oshonsoft has its own inbuilt assembler [and Basic] it generates hex files that can be run under Oshonsoft OR the hex file can be 'imported' to MPLAB to enable the programming of the PIC.
You do require the programming hardware, I use PicStart+.

The hex files that MPLAB generates are compatible with Oshonsoft and can be run in the simulator.

A point to note any Basic files you write and compile in Oshonsoft Basic creates an 'asm' file that can be used with MPLAB. It may need a small edit, but its no big deal.

So Oshonsoft and MPLAB are compatible in both directions.:)

The LED's on OS can be selected for any PIC port pin.

The Include files come with MPLAB and are installed when you instal MPLAB
 

Attachments

Last edited:

yohanevindra

New Member
so i found the assembler..so does that mean i can jus copy and paste the assembly code i get?or is there a way to import the numbers into the assembler?

and wht about the include files?how do i insert them into the programs?do i need to keep them in the same directory as the program files will be?i know where the include files are and that wont be a problem.

You do require the programming hardware, I use PicStart+.
when you say you require programming hardware, does that mean to run the simulator properly i need this hardware connected?cant i run a simulation without any hardware?

is there any site or link where i can get a tutorial or help pages to run the simulation?

btw im using the PIC18F452
 

ericgibbs

Well-Known Member
Most Helpful Member
also..is there a way to use a variable resistor with oshonsoft?im using without any hardware...
hi,
Many questions.:)

Is this resistor to vary an input to the PIC's adc.? if yes, the OS has modules to enable the inputs to be varied.OK.

The include files are in MPLAB, you add one include name in the header of your program, like this example

Code:
	list      p=16F628A           
	#include <p16F628A.inc>
	errorlevel  -302  , -207        

	__CONFIG   _CP_OFF & _DATA_CP_OFF & _LVP_OFF & _BOREN_OFF & _MCLRE_ON & 	 _WDT_OFF & _PWRTE_ON & _INTOSC_OSC_NOCLKOUT 

		org 0x000		; processor reset vector
		goto    main              ; go to beginning of program

		org 0x004		; interrupt vector location
		nop
		retfie
No, you do not require a programmer to be attached when running OS.

You will need a programmer of some type if you want to program a PIC for real world use.

Have you installed either MPLAB or Oshonsoft.???
 
Last edited:

yohanevindra

New Member
sorry about all these questions!!!

yeah..basically i want to vary the input to the AD converter so that I can display it on the LEDs or something like that. which module do you use to change the inputs to the ADC?

the include files are in the MPLAB directory right? and then do i hav to copy the include files to the directory also?and as you showed jus include them in the header right?

i'll b using it jus to test out my code before i go to the lab where i will then program the PIC.

yeah..i've installed both MPLAB and OS. now only thing is I have to figure out how to use OS properly..

any online resources?
 

ericgibbs

Well-Known Member
Most Helpful Member
sorry about all these questions!!!

yeah..basically i want to vary the input to the AD converter
You can do that

so that I can display it on the LEDs or something like that. which module do you use to change the inputs to the ADC?
and that

the include files are in the MPLAB directory right?
Yes

and then do i hav to copy the include files to the directory also?
No

and as you showed jus include them in the header right?
Yes

i'll b using it jus to test out my code before i go to the lab where i will then program the PIC.
OK

yeah..i've installed both MPLAB and OS. now only thing is I have to figure out how to use OS properly..
Ask I will try to help also read the OS documentation.

any online resources?
hi,
Depends for resources you need, let me know.
 
Last edited:

yohanevindra

New Member
well..basically need resources on familiarising myself with OS and also knowing the modules which can be used for variable resistors and stuff like that...

i guess i should get programming and try out a few programs...

the first program i wanna test needs the variable resistors..how do i get those?

is it a big disadvantage not being able to debug C at the C level?so basicall using C would mean that i have to write the code in MPLAB and then create a hex file or a asm file?

so basic flow of stuff to do would be,
1. write code in MPLAB
2. Build (?)
3. load program in OS using either asm or hex(?) - any alterations needed in the files?
 
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
well..basically need resources on familiarising myself with OS and also knowing the modules which can be used for variable resistors and stuff like that...

i guess i should get programming and try out a few programs...

the first program i wanna test needs the variable resistors..how do i get those?

is it a big disadvantage not being able to debug C at the C level?so basicall using C would mean that i have to write the code in MPLAB and then create a hex file or a asm file?

so basic flow of stuff to do would be,
1. write code in MPLAB
2. Build (?)
3. load program in OS using either asm or hex(?) - any alterations needed in the files?
hi,
When you have OS running look at the tools menu and click on them to see whats available.

Make your mind up which programming language you want to use.:)
 

yohanevindra

New Member
ok..i went thro the list of tools, and i cant see anything resemblin variable resistors or ADC input...

also..in the course at uni we wil be using assembly and C... :) not my choosing..lol

EDIT: do you mean to change the ADC inputs thro the microcontroller viewer? is that it?
 
Last edited:

ericgibbs

Well-Known Member
Most Helpful Member
ok..i went thro the list of tools, and i cant see anything resemblin variable resistors or ADC input...

also..in the course at uni we wil be using assembly and C... :) not my choosing..lol
Pity you didnt say that you had to use C in your 1st post.

Everything you have downloaded has been a waste of time!

Someone else will advice you regarding C programming.:)
 

yohanevindra

New Member
WHAT?????ohhhh...damn...

so programming with C cant be done with MPLAB and OS?then wht do you use?

i have visual studio and i've previously had Context on my laptop
 

yohanevindra

New Member
WHAT?????ohhhh...damn...

so programming with C cant be done with MPLAB and OS?then wht do you use?

i have visual studio and i've previously had Context on my laptop
 
Status
Not open for further replies.

EE World Online Articles

Loading
Top