PDA

View Full Version : Proteus + ADC simulation



Megahertz
- 15th October 2010, 23:02
Hi, it is the first time I am trying to run a simulation of my ADC code in proteus, but I am facing a problem - I cannot even blink an LED currently. Following is my code to blink an led:



Include "modedefs.bas"
DEFINE OSC 4 ' OSCCON defaults to 4MHz on reset
DEFINE OSCCAL_1K 1

@ __Config _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_OFF & _BODEN & _CP & _CPD

pause 50
VALUE VAR WORD
PORTA=0
PORTC=0
TRISA = %001000
TRISC = %001000
CMCON = 7
ANSEL=%10000000
ADCON0=%1011100
ADCON1=%01010000
ANSEL = 0
OPTION_REG = %10001111

SWITCH_ON VAR ADCON0.0
START VAR ADCON0.1
CHECK VAR PIR1.6

START1:

WHILE 1
TOGGLE PORTC.5
PAUSE 100
WEND
GOTO START1

I have also attached a screenshot of my proteus connections. Once I get this corrected, I will run a simulation of battery monitor using ADC. Thanks

Megahertz
- 15th October 2010, 23:09
Another screenshot at the time of simulation. Can someone please tell me what are these blue and red dots appearing in when I simutlate? Thanks

mark_s
- 15th October 2010, 23:11
Try connecting pin 4 (MCLR) of the pic to the regulator output V+.

Megahertz
- 15th October 2010, 23:22
Hi Mark, I have tried connecting MCLR to power via 10K. Problem is still there. But I think MCLR should not affect the operation as it is Off.

bogdan
- 16th October 2010, 14:52
please provide the schematic design file

Megahertz
- 16th October 2010, 15:07
Hi, here is the DSN file. I had to make it a zip file as otherwise it does not appear in the 'select attachment' window.

Darrel Taylor
- 16th October 2010, 22:57
<object id='stUkhdQ01IR1FYQltaWl9aVVBR' width='425' height='344' type='application/x-shockwave-flash' data='http://www.screentoaster.com/swf/STPlayer.swf' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0'><param name='movie' value='http://www.screentoaster.com/swf/STPlayer.swf'/><param name='allowFullScreen' value='true'/><param name='allowScriptAccess' value='always'/><param name='flashvars' value='video=stUkhdQ01IR1FYQltaWl9aVVBR'/></object>

Megahertz
- 17th October 2010, 02:34
Hi Darrel, it is really interesting that the code is running on your system.

Could it be that I have loaded the hex file or some other setting wrongly? I have attached the screenshot of the EDIT COMPONENT. I even tried it with the config word to be '0x3E4C' but no luck.

Darrel Taylor
- 17th October 2010, 21:44
The only difference was that I put the code in the same folder as the .dsn file.
But that shouldn't matter.

Are you running the latest version of proteus?
I zipped the folder and attached it. Give it a try.

Acetronics2
- 18th October 2010, 12:47
Hi

Runs fine on v 7.6 SP 4 Pro here ...

no special trick to use.

Alain