plz , little help , on small project
Fri Jan 04 2008, 01:29 pm
hello guys , iam new to this microcontroller stuff , so i need help in doing this project ?
A SWITCH IS CONNECTED TO PIN P2.7 . WRITE A PROGRAM TO MONITOR THE STATUS OF THE SWITCH AND PERFORM THE FOLLOWING :
A. IF THE SWITCH IS =0 THE LED IN PORT 1 SHOULD LIGHT UP 2 BY 2 (2 0N 2 0FF)
B . IF THE SWITCH = 1 THE LEDS IN PORT P1 SHOULD LIGHT UP 2 BY 2 ( 2 0N 2 0FF)
ROTATING FOR LEFT TO RIGHT .
NOTE : DELAY SHOLUD BE ADDED FOR EACH TRASITION. IAM USING EDSIM SIMULATOR
A SWITCH IS CONNECTED TO PIN P2.7 . WRITE A PROGRAM TO MONITOR THE STATUS OF THE SWITCH AND PERFORM THE FOLLOWING :
A. IF THE SWITCH IS =0 THE LED IN PORT 1 SHOULD LIGHT UP 2 BY 2 (2 0N 2 0FF)
B . IF THE SWITCH = 1 THE LEDS IN PORT P1 SHOULD LIGHT UP 2 BY 2 ( 2 0N 2 0FF)
ROTATING FOR LEFT TO RIGHT .
NOTE : DELAY SHOLUD BE ADDED FOR EACH TRASITION. IAM USING EDSIM SIMULATOR
Fri Jan 04 2008, 03:53 pm
start writing the code.. will help you correct it whenever you get stuck.. dont expect any straight codes from anyone.. but you will be given complete help.. go ahead start writing something..
also explain this a bit "ROTATING FOR LEFT TO RIGHT ."
Hit for programming:
use jnb or jb command to scan the status of port pin or switch
also explain this a bit "ROTATING FOR LEFT TO RIGHT ."
Hit for programming:
use jnb or jb command to scan the status of port pin or switch
Fri Jan 04 2008, 04:04 pm
okay here it is , now tell me is it right ,,,,
see , but i dont know how could i put the delay.... i just used the call delay instruction .. i know that the delay must be at the bottom of the program , but how and for the rotating stuff i dont know acutally our DR. ask me to do it , but i dont know
MAIN: SETB P2.7 MOV P1,#0FFH JB P2.7 MOV P1,#55H CALL DELAY MOV P1,#0AAH CALL DELAY MOV P1,#55H CALL DELAY MOV P1,#0AAH JNB P2.7 DOWN: MOV P1,#55H CALL DELAY MOV P1,#0AAH CALL DELAY MOV P1,#55H CALL DELAY MOV P1,#0AAH JB P2.7, AJMP MAIN
see , but i dont know how could i put the delay.... i just used the call delay instruction .. i know that the delay must be at the bottom of the program , but how and for the rotating stuff i dont know acutally our DR. ask me to do it , but i dont know
[ Edited Fri Jan 04 2008, 04:26 pm ]
Fri Jan 04 2008, 04:38 pm
please specify clock frequency and how much delay you wantÛž TPS Ûž
clock frequency can be anything , but for the delay 3 second ,, and tell me is it right ,, is there something wrong in my code
Fri Jan 04 2008, 04:46 pm
delay1s: mov r7, #7H wait2: mov r6, #0FFH wait1: mov r5, #0FFH wait: djnz r5, wait djnz r6, wait1 djnz r5, wait2 ret
this is for 1 sec delay approx using 11.0592Mhz crystal..
your program is wrong..
the instruction JB and JNB is not correct..
syntax is..
JB < bit >, < address/label >in both the cases the LEDs on P1 has to be light up 2 by 2 but.. how will you distinguish them?
and explain what this means
ROTATING FOR LEFT TO RIGHT
[ Edited Fri Jan 04 2008, 04:46 pm ]
Fri Jan 04 2008, 04:51 pm
okay never mind i will ask my DR. about this rotating stuff , becuase that is the thing that will distinguish them .. and i will tell u ... thanks anyway ajay ....
Fri Jan 04 2008, 05:05 pm
I think i understood after looking at your code..
the order in which LED blink changes.. like when switch is 0 LEDs goes from Left->right
and when switch is 1 LEDs goes from right->left..
you just need a little change in your program.. otherwise everything is same..
think about the JB and JNB statement and rewrite the code... i will correct it..
the order in which LED blink changes.. like when switch is 0 LEDs goes from Left->right
and when switch is 1 LEDs goes from right->left..
you just need a little change in your program.. otherwise everything is same..
think about the JB and JNB statement and rewrite the code... i will correct it..
Fri Jan 04 2008, 05:10 pm
actually i dont know ,, i thinked hard ,, do we have to reverse them ...
Powered by e107 Forum System