isis 7 simulation problem

Status
Not open for further replies.

normad

Member
hey guys im trying to simulate a pic16f877a on the proteus simulator.. the simulation was working just fine but when i kept making my main function longer it just stopped working and i cant figure out why.. if theres no obvious reason ill post the code..

i have a while(1) {} loop in the main function and in it i have three if() {} statements. These if statements are turned on and off by flags controlled by interrupts. as for interrupts im using timer1 timer 2 and portB interrupt on change. All of them work fine. But when i added the third if() {} that doesnt seem to work. The control part of that flag works fine. But when i checked by messing around with the code it seems the while(1) loop has stopped. and it starts again on an interrupt only. isnt a while loop supposed to loop regardless of interrupts? is this a limitation of the simulator? compiler or pics itself? or is my code wrong?
i cant test it on the hardware yet as my hardware isnt ready yet. id like to know if anyone had any related experience.
and if it matters ive turned off my watchdog timer
 
Never had an issue like this with Proteus and I use it quite a bit in work, you will have to post your code along with the version of Proteus installed.

When you say it "stopped working" did you mean it didn't process the new code or it didn't even run the code that was previously working before extending the main function?

It is good practise to seperate blocks of code into functions anyway.

I presume you are using C to compile? HiTech or another? Also post version used for compilation and MPLAB version, and versions of any other 3rd party compilation tools if necessary.

Regards

Wilksey
 
yeah im using mplab with hitech-c 9.8. and ISIS 7 professional.. well then i guess its something wrong with my code.. ill get back to it and if i cant figure that out i'll post the code thanks a lot..
what happens is something like this..

main() {

while(1) {

if(on) {
//do stuff
}
}

interrupt() {

if(TMR2ON) {
on = 1;
}

}

now the interrupt is changing the on bit from 0 to 1 but the while loop doesnt execute.. its as if the pic has gone to sleep.. and is woken up by an interrupt.. im beggining to wonder if its the name of my bit variable 'on'
 
hehe exactly.. i spent half the day trying to figure that.. thanks nyways.. i did clear the interrupt but later when i put another condition inside it ive put the clearing command inside the condition :$ thats why it froze only after a while..
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…