Moderator: ikalogic
ssm14293 wrote:yes its C.
im a newbie...
and i WAS using uVision...
now im using MikroC for 8051
i jus wana kno how to give high to P0.026832683
is this correct:
P0 = 0x80
or im doing the other way round26832683
thanx for your reply...
awaiting help...
if ( a == 1 & P1 == 0x80){
P0 = 0x00;
}
if ( a == 1 & ( b == 1, c == 1, d == 1)){
P0 = 0x88;
}
ssm14293 wrote:thnx man!!
one more thing...
im writing it in normal english:
if a = 1 and P1.0 = 1 then P0.0 = 1
is this the correct way26832683
- Code: Select all
if ( a == 1 & P1 == 0x80){
P0 = 0x00;
}
and i wana say that:
if a = 1 and (b = 1 or c = 1 or d = 1) then P0.5 = 1 and P0.0 = 1
is this correct268326832683
- Code: Select all
if ( a == 1 & ( b == 1, c == 1, d == 1)){
P0 = 0x88;
}
Thankx!!
if ( (a == 1) && (P1 == 0x80)){
P0 = 0x00;
}
if ((a == 1) && ( ( b == 1) || (c == 1)||(d == 1) )){
P0 = 0x88;
}
if (P3 == 0x01 ){ //if P3.0 = 1 then proceed
delay_ms ( 200 ); //delays 0.2 sec
if ( P3 = 0x01 ){ //if P3.0 = 0 then proceed (LITES TURN ON)
b = 1 //stores 1 to var b
P0 = 0x20; //P0.5 (IR.E for LITE) = 1
delay_ms ( 800 ); //delays 0.8 sec
P0 = 0x00; //P0.5 = 0
delay_ms ( 500 ) //delays 0.5 sec
P0 = 0x20; //P0.5 = 1
delay_ms ( 800 ); //delays 0.8 sec
P0 = 0x00; //P0.5 = 0
}else { //else ( P3.1 = 0 ) after delay then proceeds
(FAN TURNS ON)
c = 1 //stores 1 to var c
P0 = 0x20; //P0.5 = 1
delay_ms ( 500 ); //delays 0.5 sec
P0 = 0x00; //P0.5 = 0
delay_ms ( 500 ) //Delays 0.5 sec
P0 = 0x20; //P0.5 = 1
delay_ms ( 500 ); //delays 0.5 sec
P0 = 0x00; //P0.5 = 0
}
ssm14293 wrote:one more thing, if i wanna take an inputs at perfect delays of lets say 500ms by an IR.Receiver at P1.0 what shud the code be26832683
same goes for output, is this the correct way for output26832683
- Code: Select all
if (P3 == 0x01 ){ //if P3.0 = 1 then proceed
delay_ms ( 200 ); //delays 0.2 sec
if ( P3 = 0x01 ){ //if P3.0 = 0 then proceed (LITES TURN ON)
b = 1 //stores 1 to var b
P0 = 0x20; //P0.5 (IR.E for LITE) = 1
delay_ms ( 800 ); //delays 0.8 sec
P0 = 0x00; //P0.5 = 0
delay_ms ( 500 ) //delays 0.5 sec
P0 = 0x20; //P0.5 = 1
delay_ms ( 800 ); //delays 0.8 sec
P0 = 0x00; //P0.5 = 0
}else { //else ( P3.1 = 0 ) after delay then proceeds
(FAN TURNS ON)
c = 1 //stores 1 to var c
P0 = 0x20; //P0.5 = 1
delay_ms ( 500 ); //delays 0.5 sec
P0 = 0x00; //P0.5 = 0
delay_ms ( 500 ) //Delays 0.5 sec
P0 = 0x20; //P0.5 = 1
delay_ms ( 500 ); //delays 0.5 sec
P0 = 0x00; //P0.5 = 0
}
void main() {
unsigned short a, b, c ; //declares variable a - c
//HID SENSITIVITY CONTROL
if (P3 == 0x01){ //if P3.0 = 1 then proceeds
a = 20; //Sets the time b/w intervals to 0.020 sec
}
if (P3 == 0x02){ //if P3.1 = 1 then proceeds
a = 25; //Sets the time b/w intervals to 0.025 sec
}
if (P3 == 0x04){ //if P3.2 = 1 then proceeds
a = 30; ////Sets the time b/w intervals to 0.030 sec
}
}
P0 = 0x01;
delay_ms ( 10 );
P0 = 0x00;
delay_ms ( 10 );
ssm14293 wrote:one more thing bro...i want to loop this command until P1.0 = 0
how should i do dat26832683
- Code: Select all
P0 = 0x01;
delay_ms ( 10 );
P0 = 0x00;
delay_ms ( 10 );
while(P1.0 == 1){
..
..your code to loop..
..
}
Users browsing this forum: No registered users and 3 guests