Lapsapbee
Newbie level 2
- Joined
- Sep 29, 2013
- Messages
- 2
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 19
Hi all,
I am new in learning MikcoC. Currently, I wrote a simple coding to turn on the 4 green LEDs for 100ms when the button is being pressed.
I used the microcontroller PIC18F452 and I have configured PORT B as input and PORT D as output.
However, the circuit in my proteus did not function as expected although my coding was built successfully.
I tried it many times already and learnt the tutorial in youtube but the LEDs still cannot light on although I pressed and pressed again.
Here is the coding:
void main()
{
TRISB = 0xFF;
TRISD = 0x00;
ADCON0 = 0x09;
ADCON1 = 0x0E;
PORTD = 0X00;
do {
if (PORTB.F0 == 0) {
{
PORTD = 0xFF;
Delay_ms(100);
PORTD = 0x00;
}
}
}while(1);
}
Please help me to check through whether I have missed out anything. Thank you! :smile:
I am new in learning MikcoC. Currently, I wrote a simple coding to turn on the 4 green LEDs for 100ms when the button is being pressed.
I used the microcontroller PIC18F452 and I have configured PORT B as input and PORT D as output.
However, the circuit in my proteus did not function as expected although my coding was built successfully.
I tried it many times already and learnt the tutorial in youtube but the LEDs still cannot light on although I pressed and pressed again.
Here is the coding:
void main()
{
TRISB = 0xFF;
TRISD = 0x00;
ADCON0 = 0x09;
ADCON1 = 0x0E;
PORTD = 0X00;
do {
if (PORTB.F0 == 0) {
{
PORTD = 0xFF;
Delay_ms(100);
PORTD = 0x00;
}
}
}while(1);
}
Please help me to check through whether I have missed out anything. Thank you! :smile: