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.

[SOLVED] MPLAB IDE and Hi-Tech C Compiler Problem

Status
Not open for further replies.

xpress_embedo

Advanced Member level 4
Joined
Jul 5, 2011
Messages
1,154
Helped
161
Reputation
396
Reaction score
189
Trophy points
1,353
Location
India
Activity points
10,591
Hello!!! I am using MPLAB IDE along with Hi-tech C Compiler to use the PIC16F877A
I am trying to write a program to give some delay in Timer0 Mode.
But My Problem is that.

while(INTCONbits.TMR0IF == 0); //This Statement Works Fine
but when i reset the TMR0IF bit it doesnt work

means
INTCONbits.TMRR0IF = 0; //This gives no error but doesn't produce any effect

Here is the Image of My Problem
Problem.PNG
 

Let me ask you a question dude. Where have you provided the delay in the for which the timer 0 should run & get reset? How much time are you expecting the timer0 to run? Please do explain it.

Regards,
Jerin Johns.
 

Let me ask you a question dude. Where have you provided the delay in the for which the timer 0 should run & get reset? How much time are you expecting the timer0 to run? Please do explain it.

Firstly i am not getting what you want to know from me...
Actually i am writing some other code, where i need to generate a 1sec pulse.... and in that code i have encountered the same problem...
So i switched to a simple program and found that my TMR0IF flag is not reset when i use the statement
INTCONbits.TMR0IF == 0;

but when i use INTCON = 0x00;
then it works fine...
I want to know what's the problem in using this statement INTCONbits.TMR0IF = 0

Hope you understand
 

I'm not quite sure but from the image and your last post I think the problem is you should use

INTCONbits.TMR0IF = 0;

instead of

INTCONbits.TMR0IF == 0;

to reset TMR0IF.
 
I'm not quite sure but from the image and your last post I think the problem is you should use

INTCONbits.TMR0IF = 0;

instead of

INTCONbits.TMR0IF == 0;

to reset TMR0IF


Thanks alot...
That was a silly mistake done by me.... due to copy paste issue.
Thanks for very good observation
 

I have also made plenty of such equally annoying mistakes. :lol:

This does underline the grave importance of EXTREME carefulness in playing with real electronics projects (not limited in the electronics domain indeed).
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top