liupengjian
New Member
Now, I am working on a 16F877 programming project using C.
The program is something like that:
int8 i=0;
main()
{
do{
sendPollPkt(i)
i++;
delay_ms(100);
if(i==MaxPCID)
{i=0;}
}while (true)
}
On the other side, a VB program running on a PC will receive the Polling Pkt.
I load the program to the IC chip and run, it runs well, but whenever I shut down the power on the PCB, the program stops. However, when I start the program again, the sendPollPkt() starts from the last time I stops it. ie. if i=9 when shut down the circuit board's power, and then starts, the i will be 10 and continues to run.
I want to know how can the PIC can "remember" the value even though the power is down? The code should runs from the beginning right?
Thanks for any advice.
The program is something like that:
int8 i=0;
main()
{
do{
sendPollPkt(i)
i++;
delay_ms(100);
if(i==MaxPCID)
{i=0;}
}while (true)
}
On the other side, a VB program running on a PC will receive the Polling Pkt.
I load the program to the IC chip and run, it runs well, but whenever I shut down the power on the PCB, the program stops. However, when I start the program again, the sendPollPkt() starts from the last time I stops it. ie. if i=9 when shut down the circuit board's power, and then starts, the i will be 10 and continues to run.
I want to know how can the PIC can "remember" the value even though the power is down? The code should runs from the beginning right?
Thanks for any advice.