this is my first project..
i'm confuse bcoz some of the coding didn't work when i'm running it..
this is my sample coding...hope someone can help me to expain to me why it happened..
main(){
int cnt, value, Junc;
set_tris_a(0); /* set port_a to be outputs */
set_tris_b(0); /* set port_b to be outputs */
port_a = 0; /* initialize All port_b outp/uts to be zero */
port_b = 0; /* initialize All port_b outp/uts to be zero */
value = 0x01;
while( TRUE )
{ /* forever loop using WHILE construct */
cnt = 1;
value = 0x01;
while ( cnt<9 )
{
for ( ;Junc; )
{
if (port_b = 0x10)
port_a =0x0E;
Delay_MS(8000);
if (port_b = 0x01)
port_a =0x0E;
Delay_MS(2000);
if (port_b = 0x00) <<--/* this coding it didn't work when im running
port_a =0xFF; it..only working when i removed the if
Delay_MS(2000); statement */
}
why it happened???help me...
i'm confuse bcoz some of the coding didn't work when i'm running it..
this is my sample coding...hope someone can help me to expain to me why it happened..
main(){
int cnt, value, Junc;
set_tris_a(0); /* set port_a to be outputs */
set_tris_b(0); /* set port_b to be outputs */
port_a = 0; /* initialize All port_b outp/uts to be zero */
port_b = 0; /* initialize All port_b outp/uts to be zero */
value = 0x01;
while( TRUE )
{ /* forever loop using WHILE construct */
cnt = 1;
value = 0x01;
while ( cnt<9 )
{
for ( ;Junc; )
{
if (port_b = 0x10)
port_a =0x0E;
Delay_MS(8000);
if (port_b = 0x01)
port_a =0x0E;
Delay_MS(2000);
if (port_b = 0x00) <<--/* this coding it didn't work when im running
port_a =0xFF; it..only working when i removed the if
Delay_MS(2000); statement */
}
why it happened???help me...