-
1 Attachment(s)
Proteus + ADC simulation
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:
Code:
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
-
1 Attachment(s)
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
-
Try connecting pin 4 (MCLR) of the pic to the regulator output V+.
-
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.
-
dsn file
please provide the schematic design file
-
1 Attachment(s)
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.
-
It blinks fine here.
<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>
-
1 Attachment(s)
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.
-
1 Attachment(s)
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.
-
Hi
Runs fine on v 7.6 SP 4 Pro here ...
no special trick to use.
Alain