Discussion in "Project Help" started by    alex4ever    Jan 4, 2008.
Fri Jan 04 2008, 01:29 pm
#1
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
Fri Jan 04 2008, 03:53 pm
#2
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
Fri Jan 04 2008, 04:04 pm
#3
okay here it is , now tell me is it right ,,,,

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:35 pm
#4
please specify clock frequency and how much delay you want
Fri Jan 04 2008, 04:38 pm
#5


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
#6
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
#7
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
#8
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..
Fri Jan 04 2008, 05:06 pm
#9
okay
Fri Jan 04 2008, 05:10 pm
#10
actually i dont know ,, i thinked hard ,, do we have to reverse them ...

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am
ktaletrryp
Fri Apr 26 2024, 10:55 pm
Robertrip
Fri Apr 26 2024, 11:20 am
ArnoldDiant
Fri Apr 26 2024, 03:53 am
RodneyKnorb
Thu Apr 25 2024, 07:08 pm
Williamjef
Thu Apr 25 2024, 02:08 pm