# *Newbie* Multisim 8 PIC LED Simulation

Status
Not open for further replies.

##### New Member
I'm trying to simulate a led circuit using a PIC12C508 (random choice).
Here's a picture of what I have but how do I set the output to high without a program for the microcontroller in Multisim. I get close to 1V from GP0 but need at least 2.4V. I've thought of adding a spdt from source to GP3 and ground but that doesn't work. Just wondering how to control the microcontroller in Multisim 8.
By the way, should I look at getting Multisim version 10 for MCU function?

I'm very new to the practical part of electronics and have ordered both of David Cooks books so understand if I'm very lost.

#### Attachments

• 72.5 KB Views: 2,641
• 73.5 KB Views: 1,113

#### Hakachukai

##### New Member
3 things to check:

#1. How much current can your supply output?
#2. What is the current limit on the output of GP0 ?
#3. Measure the voltage in 3 places:

1. Between Vdd and GND
2. Between GP0 and GND
3. Between the LED and GND

That will tell you alot about what is going on in the circuit.

##### New Member
I've checked in those spots but find I'm getting very little current at GP0. This is why I thought I have it wired wrong, am missing a control switch or am not using Multisim properly.
Here's a few volt measurements, one across PIC and the other across resistor and LED. I believe they should be the same but they are not. I also changed the resistor to 510 ohms...I was too high on the first circuit to trigger the LED.

#### Attachments

• 96.5 KB Views: 990
• 91.4 KB Views: 1,315

#### be80be

##### Well-Known Member
Why all the pins grounded That's not good You have the chip in reset by holding mclr
to ground. The chips not running

Last edited:

##### New Member
They're not suppose to be? I saw it somewhere and thought it was norm....I'm new here.
be80be...thanks for the reason why mclr shouldn't be grounded...explainations are great....but I'm still lost as to why my voltage and therefore amps drop after microcontroller.

Last edited:

#### be80be

##### Well-Known Member
Well it like this I bet your grounding your chip in your code but you didn't post that I would hook it up like this

#### Attachments

• 6.2 KB Views: 803

##### New Member
I haven't made a program code, just trying to simulate microcontrollers in Multisim. I'm wondering if I need to make a program for the microcontroller and run it in Multisim....is that how one controls the simulated microcontroller?
I understand that Multisim version 10 has a MCU function that allows one to run their code in a circuit inside Multisim.

#### be80be

##### Well-Known Member
How it going to do any thing you program it and run it. The program what makes the pins
input output high or low Like this It was for a 12f508 but it will work on your chip
Code:
	list      p=12C508            ; list directive to define processor
#include <p12C508.inc>        ; processor specific variable definitions

__CONFIG   _MCLRE_ON & _CP_OFF & _WDT_OFF & _IntRC_OSC

;***** VARIABLE DEFINITIONS
temp	EQU     0x07        ;example variable definition

;**********************************************************************
ORG     0x1FF             ; processor reset vector

; Internal RC calibration value is placed at location 0x1FF by Microchip
; as a movlw k, where the k is a literal value.

ORG     0x000             ; coding begins here
movwf   OSCCAL            ; update register with factory cal value

start

nop 			  ; example code
movlw	0x00
tris	GPIO               ;sets all pins to out put
movlw   0xFF              ; makes them high
movwf   GPIO              ; leds on

END                       ; directive 'end of program'

Last edited:

##### New Member
Are you saying I can input a program like this into Multisim?

Or are you referring to real world simulation here....cause I'd like to simulate microcontrollers in Multisim first.

#### be80be

##### Well-Known Member
It ill be something like that. It has to be code that will run on the chip and the sim I have used use assemble like that.

##### New Member
Run code in Multisim?

Yes/No?

If yes, where in Multisim? I have version 8.

#### be80be

##### Well-Known Member
Multisim can run code that you make with Hi-tech C I tried it out I do not like it I use this

#### Attachments

• 81 KB Views: 1,123
Last edited:

##### New Member
Okay, I guess I'll have to look deeper into Multisim to find out how to simulate a microcontroller with program code....I need more practice. It's funny cause I'm having a hard time simulating a microcontroller when I've been able to do the same in real world on a BasicX-24. It's a learning process that will pay off.

Thanks for your help be80be ....a push in the right direction....Where in Multisim do I find the function to insert program code?

##### New Member
For others looking for the same function in Multisim, I found this link...it refers to Multisim V10.

The MCU functionality in Multisim enables students, educators and professional users to program MCU's in assembly
or C language within the familiar Multisim environment. The MCU capability can be used with any of Multisim’s
virtual instruments for a complete system simulation, including the microcontroller and all connected analog and digital
SPICE components.

ftp://ftp.ni.com/pub/devzone/pdf/tut_5629.pdf

I've looked for this wizard in Multisim V8, but I don't see it there...need to upgrade I guess.