08-04-2011 10:38 AM
I'm not new to multisim but for the PIC microcontroller, I am...for this problem, we were asked to produce an output that can count how many times a button has been pressed, and that we should use the OPTION register, togther with the TMR0 module, we have performed this in the lab and i confirmed that the following code is indeed working in actual...but in Multisim, it cannot be simulated....earlier experiments were succesfully simulated but for this experiment, Multisim just keeps on "freezing", or "not responding", and i end up with no simulation results....
list p=16F84A ; list directive to define processor
#include <p16F84a.inc> ; processor specific variable definitions
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
;**********************************************************************
;VARIABLE DEFINITIONS
INT_VAR UDATA 0x0C
limit EQU .10
;**********************************************************************
RESET_VECTOR CODE 0x0000 ; processor reset vector
goto start ; go to beginning of program
MAIN_PROGRAM CODE
start:
; remaining code goes here
movlw b'10111000' ;increment at high to low, counter,1:2 prescaler
OPTION
Banksel TRISB
clrf TRISB ; All pins of PORTB are set to output.
movlw b'00010010'
movwf TRISA
ClearContents
banksel PORTB ; Access Bank 0
clrf PORTB
clrf PORTA
clrf TMR0 ;Clearing the contents of TMR0
clrwdt
;------------------------------------------------------------------------
Push_Button
movf TMR0,w
xorlw limit
btfsc STATUS,Z
goto ClearContents
goto Display
Display
movf TMR0,w
call LookUp
movwf PORTB
goto Push_Button
;------------------------------------------------------------------------
LookUp
addwf PCL,f ; PCL is program counter latch
retlw 0x02 ; 0 code decimal equivalent
retlw 0x9E ; 1
retlw 0x24 ; 2
retlw 0x0C ; 3
retlw 0x98 ; 4
retlw 0x48 ; 5
retlw 0xC0 ; 6
retlw 0x1E ; 7
retlw 0x00 ; 8
retlw 0x18 ; 9
;------------------------------------------------------------------------
END ; directive 'end of program'
Also, we used the MPLAB IDE version 8.33 in creating this program, and using the .hex file it created to be placed on the PIC16F84A of multisim.I also can't to seem to find a 4MHz crystal oscillator, but there were two 40MHz crystal oscillator, so I assumed the first one to be a typor error.
The attachment below is the schematic diagram we used during this experiment.
03-11-2012 03:59 PM
Hello Mito,
Is this still a running issue?
If yes, can you then send me the user database your using?
04-11-2012 06:38 AM
hello!! i just wanted to ask if u solved ur problem?
i have also multisim and i want to use a PIC16f873 oder PIC16f877 but it doesnt comes in the database