Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

16f84 and Led with multisim.

Hello.
I've downloaded demo version of multisim 10.
I try a basic circuit with a 16f84.
Vdd is connected to pins 4 and 14.
Vss is connected to pin 5.
Crystal associated with 27pF capacitors and Vss are connected to pins 15 and 16.
Then I got
pin RA2 --- 330ohm resistor --- led (1.66v) --- vss 0v.
The program works perfectly in mplab.
Bit 2 of trisa is low, bit 2 of porta is high and ... led is not lighting.
Using probes, I measure :
before resistance : 1.77v/323uA
before led : 1.66v/323uA
What's going wrong ?
Tanks.
0 Kudos
Message 1 of 24
(10,921 Views)
Please post your MS File along with your program so that we can examine it for any type of errors.
Kittmaster's Component Database
http://ni.kittmaster.com

Have a Nice Day
0 Kudos
Message 2 of 24
(10,906 Views)
Hello.

Here come the msf and asm files.

Thanks for your help.


0 Kudos
Message 3 of 24
(10,878 Views)
Up
0 Kudos
Message 4 of 24
(10,848 Views)

Are you getting a warning message in the RESULTS tab simular to what I have pasted below?

 Multisim  -  2008-04-29 20:31:09
-----------------------------Building: Project: Led-----------------------------
led1.asm
Message[302] D:\LED1.ASM 99 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Assembler results:  0 - Errors, 1 - Warnings

I do not understand why I am getting this error message as it appears that the bank select protocol has been followed in the program. I will try to do some more investingating of this. I am not very experienced in programming but I will try everything I know. I will have to examine this carefully and it may take a little bit to get back to you.

Kittmaster's Component Database
http://ni.kittmaster.com

Have a Nice Day
0 Kudos
Message 5 of 24
(10,839 Views)

Just to update. I have not yet made much progress on figuring out what is happening with this, but I have a few more ideas to try. I will keep you posted if I find something, but like I said I am not a proficient Assembly language programmer so it will take me a while to decipher this situation. If someone else on the forum is more experienced in programming and would like to take a crack at this please do so and let this user and myself know what you can find.

Thanks for your patience

Kittmaster's Component Database
http://ni.kittmaster.com

Have a Nice Day
0 Kudos
Message 6 of 24
(10,809 Views)
Hi,

Sorry it took me so long to figure out the problem. First of all, i think i made some minor changes in your asm code but if i remember correctly it worked pretty good. But just in case i have attached all my files with this post, so you can use them to try to understand it. So after some time i also got stuck on finding the problem cause i was so sure my asm code was correct and still i was only getting 1.67 V out of the pin and only 331 µA of current. This was to low because the led has an on current of 5 mA minimum. Also the voltage drop over the led is 1.67 V so thats where that voltage comes from.

So what did we miss? We missed that we need to use pull up resistors when using a LED. So try it out with your circuit and perhaps also look at mine.
PORTB of most pic processors has got internal pull up resistors so he can drive LED's directly. I also made a small adjustment in my code to make the led go on and off depending on an input (PortA pin 0).

Let me know if your problem is solved. And again sorry it took me so long, i didn't understand what could be the problem because the code i wrote was correct. And i could not see the problem in the circuit.
Kind Regards,

Joris Donders
National Instruments
EMEIA GTM Lead for Semiconductor
www.ni.com/semiconductor
0 Kudos
Message 7 of 24
(10,597 Views)

Hi there Joris D.  I was trying to help with this situation, but I failed to see the pull-up resistor problem you found due to being thrown off track by another problem I encountered that I thought was causing the original situation.

Your circuit seems to work fine, but when I make a change to the code and re-build it I get the following error messages:

Multisim  -  2008-05-16 22:45:48
--------------------------Building: Project: LEDdriver--------------------------
LED.asm
Message[302] D:\LED.ASM 14 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Message[302] D:\LED.ASM 16 : Register in operand not in bank 0.  Ensure that bank bits are correct.
Assembler results:  0 - Errors, 2 - Warnings

The only thing I did was to delete the "f" from one of the "bsf" statements and then retype it back. I then ran the circuit and it asked me if I wanted to re-build due to the code being out of date. That is is when I get the warning messages above.

Could you please explain to me why these warnings are popping up since it would seem the code is correct and the circuit does apparently function as it should now. I have Multisim  Power Pro 10.0.1 build 343 (which is the latest version).

Thanks so much for any information you can provide.

Kittmaster's Component Database
http://ni.kittmaster.com

Have a Nice Day
0 Kudos
Message 8 of 24
(10,578 Views)
Hi,

Those errors are actually just warnings saying that you need to pay attention to the bank bits that they are set correctly. TRISA and some other registers are only in bank 1 and you need to set RP0 to 1 in order to select it after that you can manipulate TRISA and go back to bank0. So those warnings will always be there just to make sure you pay attention because you need to changes banks once or more during your program. If the correct bank is not set and you do a manipulation you could write to a completly other register, which can be dangerous for your program.

So don't worry about those warnings, i'm not sure if you are able to ignore them in multisim. But i know i always got these warnings also when doing assembly programing in school a year ago. I once asked somebody why they occur and they told me it's normal and then they showed me how i could ignore them in the program i was using for assembly back then. I hope this helps you understand. If you have other questions feel free to ask.
Kind Regards,

Joris Donders
National Instruments
EMEIA GTM Lead for Semiconductor
www.ni.com/semiconductor
0 Kudos
Message 9 of 24
(10,537 Views)
Thanks for you response and I understand what you are saying about this, but I would like to discuss this further  with you directly if that is posssible due to the fact there are things that I cannot divulge on the forum. Let me know if this would be acceptable and how to contact you. My e-mail is lacy@cwv.net if you would like to send me an e-mail to kick this off.
 
Thanks for your explaination and I hope to talk to you soon.
Kittmaster's Component Database
http://ni.kittmaster.com

Have a Nice Day
0 Kudos
Message 10 of 24
(10,508 Views)