This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

crashing when update P2 port

Hi All,
I have a problem with this code:
This simple code sends 0-255 with 9600 baudrate to pc and P2 port
My problem is in loop runtime . program crashes when arrived to line :P2=i.
so we see '0' only on hyperterminal .
I changed type of 'i' to int , but the result remains .
All The Best
Aziz


#include <w78e65.H>
#include <stdio.h>
main()
{
unsigned char i;
TMOD=0x20;
SCON=0x52;
TH1=0xfa;
TR1=1;
for(i=0;i<=255;i++)
{
printf("%d",i);
P2=i;
}
}
/**************************************/

0