nandana
Newbie level 4
- Joined
- Dec 21, 2010
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,339
I want to turn on LEDs on portb of 16f628A. I wrote following code. I need to make my program as following.
1. Turn off led (00000000)
2. After 1sec turn on PORTB.F1 (00000010)
3. then After 1sec turn on PORTB.F2 (00000110)
4. then After 1sec turn on PORTB.F3 (00001110)
5. then After 1sec turn on PORTB.F4 (00011110)
then loop back to Turn off led
but when simulating using isis,,,
every time only one LED is turning on. it is look like following
1. Turn off led (00000000)
2. After 1sec turn on PORTB.F1 (00000010)
3. then After 1sec turn on PORTB.F2 (00000100)
4. then After 1sec turn on PORTB.F3 (00001000)
5. then After 1sec turn on PORTB.F4 (00010000)
then loop back to Turn off led
could you please some one help me to solve this !! Why I cant Access Individual Bit without changing others.e
Edited
I have attached all files including isis.
I am using Mikroc pro for PIC v5.6.1
1. Turn off led (00000000)
2. After 1sec turn on PORTB.F1 (00000010)
3. then After 1sec turn on PORTB.F2 (00000110)
4. then After 1sec turn on PORTB.F3 (00001110)
5. then After 1sec turn on PORTB.F4 (00011110)
then loop back to Turn off led
but when simulating using isis,,,
every time only one LED is turning on. it is look like following
1. Turn off led (00000000)
2. After 1sec turn on PORTB.F1 (00000010)
3. then After 1sec turn on PORTB.F2 (00000100)
4. then After 1sec turn on PORTB.F3 (00001000)
5. then After 1sec turn on PORTB.F4 (00010000)
then loop back to Turn off led
could you please some one help me to solve this !! Why I cant Access Individual Bit without changing others.e
Edited
I have attached all files including isis.
I am using Mikroc pro for PIC v5.6.1
Code:
void main(void)
{
CMCON=0x07;
TRISB = 0x01;
do
{ PORTB=0;
Delay_ms(1000);
PORTB.F1=0;
Delay_ms(1000);
PORTB.F2=1;
Delay_ms(1000);
PORTB.F3=1;
Delay_ms(1000);
PORTB.F4=1;
Delay_ms(1000);
} while(1);
}
Attachments
Last edited: