can check for me what wrong with my programming? cannot run in mikroC PRO

Status
Not open for further replies.

lazyhut

Member level 1
Joined
Feb 14, 2011
Messages
33
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,467
can check for me what wrong with my programming? cannot run in mikroC PRO
No reaction when i pressed the switch..it suppose will display in LCD..
can you check my coding uploaded? The coding cannot run in mikroC PRO
THANKS..

ICIC16F877A
compiler:MikroC PRO 3.2

download:
View attachment test.txt
 
Last edited:

instead of #define, try using the port directly
 

I think tou need to read
You are using PORTA to read the input state (smoke) of the pin , this in not correct, the input register is PINA, PINB...
The PORTA sets the pull-up resistor when the pin is set as input.
The above article explains everything.

instead of #define, try using the port directly
What is wrong with using define?

Alex

---------- Post added at 15:46 ---------- Previous post was at 15:30 ----------

Sorry , I think you are using PIC, if this is the case ignore what I wrote, they are valid for AVR mcu.
You should include in your message the mcu you are using.

Alex
 



sorry about that, i dint mention clearly..im using PIC16F877A.
 



your program has been compiled in mikroC pro and it is displaying initial lcd strings (i.e; testing and 0...9).... i didnt check the subroutine... but i think the term shown below can cause a run time error.....

void setting()
{
while(sw1); //no semicolon required
{ // add braces at starting and close at end as you are considering a case i,e; when sw1 is pressed do so...
Delay_ms(100);
lcd_out(1,1,"Setting Number1 ");
x=0x30;
counter=1;
.........................
.............
.........;

similarly check other subroutines ..... if your compiler mikro C doesn't run this try reinstalling it...
 


but i replace while(!sw1) it will shown in lcd display..zzz
 

Have you setup ANSEL/H ?
 

This must be set to define input type Analog or Digital



---------- Post added at 16:11 ---------- Previous post was at 15:59 ----------

On the A it may be controlled via ADCON1 and/or CMCON
 

This must be set to define input type Analog or Digital



---------- Post added at 16:11 ---------- Previous post was at 15:59 ----------

On the A it may be controlled via ADCON1 and/or CMCON

it is work with adding ADCON1..thanks
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…