Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How to see the values of the variable counter using Proteus?

Status
Not open for further replies.

muganga

Newbie level 6
Joined
May 10, 2007
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,384
I trying simulate the following code. I did not find option: PIC CPU SOURCE CODE...just REGISTERS, DATAMEMORY, PROGRAM MEMORY AND STACK.
I want assist what values the variable counter get during running the program.
Is it possible use proteus??

#include <16C77.h>
#use delay(clock=4000000)
#include <lcd.c>


#int_TIMER0
void TIMER0()
{
int counter;
set_timer0(0);
if(counter == 15)
{
counter++;
}
}



void main() {
setup_timer_0(RTCC_INTERNAL| RTCC_DIV_256|RTCC_8_BIT); //clock interno; prescaler; 8bits
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);

lcd_init();
lcd_gotoxy(1,1);
lcd_putc("teste");

}


tks

fernando
 

setup_timer_0(rtcc_internal|rtcc_div_256);

Yes it is possible in Proteous
instead of loading *.HEX Load *.COF file onto your chip
this will show your source code and Variables too
Remember if your variable is global then it sustain a permanent value Locals are created and destroyed
timely.
 

setup_timer_0(rtcc_internal|rtcc_div_1);

thank you very much for information...
I did what you sugest but I could not see the variable counter..
do you know why?


#include <16C77.h>
#use delay(clock=4000000)
#include <lcd.c>


#int_TIMER0
void TIMER0()
{
int counter;
set_timer0(0);
if(counter == 15)
{
counter++;
}
}



void main() {
setup_timer_0(RTCC_INTERNAL| RTCC_DIV_256|RTCC_8_BIT); //clock interno; prescaler; 8bits
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);

lcd_init();
lcd_gotoxy(1,1);
delay_ms(100000);
lcd_putc("Welcome to EGYPT");

}

thanks again

muganga
 

proteus step

Proteus is just a waste of time.....
 

proteus step by step

Thank you for reply..so..what is the best software to simulate a circuit?

tks

muganga
 

proteus +step

where is your init timer code?


also why you do this

if(counter == 15)
{
counter++;
}

do you want to do it like this
if(counter == 15)
{
counter = 0;
}


hock
 

Re: proteus step by step

clock = 4Mhz

4/4*256*256 = 0,065536 s

15*0,065536 = 1seg

if I have an overflow 15 times that means I have 1 seg. In this way I can count 1 seg and I want display on lcd.

tks

muganga
 

Re: proteus step by step

but your code is wrong.
it will never increment the counter as in the begining count = 0 and hence the condition IF count == 15 will never be true ans count ++ will never work. the count will remain 0x00.

hock
 

Re: proteus step by step

I change the code and know it is working..

for someone who are learning interruption..see below the code...


#include <16C77.h>
#use delay(clock=4000000)
#include <lcd.c>

int counter;
int seg=0;
int value;

#int_TIMER0
void TIMER0()
{
counter++;
if(counter == 15)
{
counter=0;
seg++;
}
}



void main() {

setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256|RTCC_8_BIT);
enable_interrupts(INT_RTCC);
enable_interrupts(GLOBAL);

while (1)
{
lcd_init();
lcd_gotoxy(1,0);
printf(lcd_putc,"\f tempo : %i segundos",seg);
delay_ms(200);
}
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top