kgavionics
Full Member level 3
- Joined
- Jun 12, 2012
- Messages
- 167
- Helped
- 7
- Reputation
- 14
- Reaction score
- 11
- Trophy points
- 1,298
- Location
- Alberta.Canada
- Activity points
- 2,482
Hi guys
i'm still learning C and i have a little issue when i run my program in hardware.
i have this little code to count from 0 to 255 and send the count to portb.
when i use either Proteus or Pic simulator,every thing works fine and i can see the leds flushing.The problem comes when i burn the hex file to my pic18f452.The Led are always ON.
It seems the the delay function is not working on hardware.Can someone help me please?
i'm still learning C and i have a little issue when i run my program in hardware.
i have this little code to count from 0 to 255 and send the count to portb.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <p18f452.h>
#pragma config OSC = HS
#pragma config WDT = OFF
#pragma config LVP = OFF
void main(void)
{
unsigned char z;
TRISB = 0;
for(z=0;z<=255;z++)
PORTB = z;
Delay10KTCYx(255);
while(1);
}
when i use either Proteus or Pic simulator,every thing works fine and i can see the leds flushing.The problem comes when i burn the hex file to my pic18f452.The Led are always ON.
It seems the the delay function is not working on hardware.Can someone help me please?
Last edited: