Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

PIC16F84 C language example

Hi I am new to Multisim , also to Micro controller. i tried to light led many times with Pic16f84 with C language . Can Plz someone  send me the led  example ,or  guide me ?

0 Kudos
Message 1 of 6
(10,777 Views)

Hello,

 

If you care to look in the samples bundled in Multisim (the blue folder icon next to the "Open" icon), you'll find a few examples with c code in it. Follow these examples to get an understanding of Multisim.

 

I also found a few tutorials online that you can check out. Try the link below for one of them.
http://www.tentuts.com/2012/01/how-to-use-c-language-in-multisim-for.html

http://www.8052.com/tut8051

 

Also look into the MCU manuals for an idea of how to use circuit and MCU cosimulation.
http://www.ni.com/pdf/manuals/371752b.pdf

 

Cheers,

Miguel V
National Instruments
0 Kudos
Message 2 of 6
(10,746 Views)

hi

Miguel 

 

Can u plz give me simple example of Multisim C with Pic16f84 like led blinking or powering led which can simulate in multisim 11. it will be helpful to me

0 Kudos
Message 3 of 6
(10,718 Views)

Here is a simple program I made that turns on specific ports for the PIC mcu.

 

#include "pic.h"
#define bitset(var,bitno)    ((var) |= 1 << (bitno))
#define bitclr(var,bitno)    ((var) &= ~(1 << (bitno))

void initialize(void){
    bitclr(STATUS, RP0);    //set bank 0
    PORTA = 0x00;            //initialize
    PORTB = 0x00;
    bitset(STATUS, RP0);    //set bank 1
    TRISA = 0xFF;            //set port a pins to input
    TRISB = 0x00;            //set port b pins to output
}

void main(){                //main program
    initialize();        //run initialization
    while (1){            //continuous run
        if (RA0 == 0){    //if singal is low then only turn on some port b pins
            PORTB = 0b00111100;
        }
        else{            //otherwise all on    
            PORTB = 0xFF;
        }
    }
}

 

Just connect a VDD source to the MCU, and to the MCLR pin. Also connect a VDD source to a switch. The other side of the switch should connect to the pin RA0 and VSS (place a 10k resistor between VSS and the switch). Make sure the PIC is also powered (VDD and VSS) and connect and LED to all the RB# pins. With the code above, it should work.

 

Cheers,

Miguel V
National Instruments
0 Kudos
Message 4 of 6
(10,696 Views)

Also check out this tutorial for MCU Co-simulation.


http://www.ni.com/white-paper/5629/en

Miguel V
National Instruments
0 Kudos
Message 5 of 6
(10,694 Views)

Hi Miguel V

 

I tried it in Multisim 12 but it's not working before i makeing post here i got one program from the forum that one also not working .is there any setting problem 

 i am attaching my file . 

Can youplease go through the file and guide

0 Kudos
Message 6 of 6
(10,619 Views)