Discussion in "Project Help" started by    cenadius    Aug 19, 2007.
Thu Aug 23 2007, 06:07 PM
#11
well this function can be implemented later on.. because this is the final interface. First you need to write drivers for your peripherals like ADC, keys, Fan and its speed control and 7-segment LED. After you finish the basic building blocks of your project.. you can easily make the final interface.. I hope you got my point. So you can first start with the simplest.. "Fan switching and speed control".
where is your schematic?
 tienduhieu like this.
Fri Aug 24 2007, 12:52 PM
#12
i maybe want add something to my circuit so i remove it first.So can u teach me how to write the code for control the fan speed in manual mode?i need write the code to control fan speed for manual and auto separately or just write 1 can d?


[ Edited Fri Aug 24 2007, 12:54 PM ]
 tienduhieu like this.
Fri Aug 24 2007, 01:44 PM
#13
ok.. i tell you something.. controlling via manual or auto is the later part of your project it will be according to the keys user press.. that is the interface part. But basically you need to write for controlling and switching of FAN first.

And yes i will help you writing it..
So as i told you about PWM, you need a timer (either Timer 0 or Timer 1). and we need to load the timer for 2 different values, One for ON timer and one for OFF time (as explained for PWM square wave).
The value of ON, OFF depends on the mode selected by the user. i.e. If manual then you can have 5 preset values for user to select from and load them according to the selected value.
In automatic mode, i don't know how it suppose to work in auto mode..
So I hope you understood the basic idea.. can you make a simple code to generate a square wave? I will help you to modify it, according to your project waiting for your INPUT
 tienduhieulifeflowers86 like this.
Thu Aug 30 2007, 12:37 PM
#14
sorry for taking so long time to reply u.Do u know what software that can use to draw the circuit schematic?This is the simple code u ask me to do which can get square wave,this program is use to generate 1hz square wave by using timer 1 with duty circle 50%,deration for high low portion of square wave are 0.5 s,T=1s.


[ Edited Thu Aug 30 2007, 12:40 PM ]
 tienduhieu like this.
Thu Aug 30 2007, 12:43 PM
#15
this is my code,why i cannot attch file?i wan attach the file that contain my code but cannot so i have to type it here


ORG 0000
MOV TMOD,#10H ;TIMER 1 IN MODE 1
MAIN: MOV R0,#10 ;COUNTER FOR 10 LOOPING
REPEAT: MOV TH1,#3CH ;MOVE 3CH INTO TH0
MOV TL1,#0B0H ;MOVE B0H INTO TL0
SETB TR1 ;START THE TIMER 1
LOOP: JNB TF1,LOOP ;WAIT FOR TIMER1 OVERFLOW
CLR TR1 ;STOP TIMER 1
CLR TF1 ;CLEAR TIMER 1 OVERFLOW FLAG
DJNZ R0,REPEAT ;IF R0 NOT ZERO GO TO REPEAT
CPL P1.0 ;COMPLEMENT P1.0 TO GET HIGH OR LOW
SJMP MAIN ;RELOAD TH1&TL1
END





[ Edited Thu Aug 30 2007, 01:04 PM ]
 tienduhieulifeflowers86 like this.
Thu Aug 30 2007, 01:04 PM
#16
ok.. but.. i wanted you to make it with timer.. for PWM, the delay should be less otherwise your motor will not run smooth.. you can try connecting an LED to the port to see that.. it will flicker a lot..
where as if you use keep delay smaller like timer in a 13-bit mode.. then you will see a variation in voltage instead of flickering..
I am attaching a sample PWM code for you.. take a look.

MOV R7, #160   ; set pulse width control to dim


The above part of the code will determine the output voltage level. you can test this code.. by changing the value of R7.
 tienduhieu like this.
Thu Aug 30 2007, 01:05 PM
#17
I think there is some problem with the attachment of file.. i need to check that..
By the time.. please try to paste the code..

here is a sample PWM code.. check it..
org 0H
sjmp start
org 0BH
TIMER_0_INTERRUPT:
   JB F0, HIGH_DONE    ; If F0 is set then we just finished the high section of the
LOW_DONE:              ;   cycle so Jump to HIGH_DONE
   SETB F0             ; Make F0=1 to indicate start of high section
   SETB P1.0           ; Turn off LED
   MOV TH0, R7         ; Load high byte of timer with R7 (pulse width control value)
   CLR TF0             ; Clear the Timer 0 interrupt flag
   RETI                ; Return from Interrupt to where the program came from
HIGH_DONE:
   CLR F0              ; Make F0=0 to indicate start of low section
   CLR P1.0            ; Turn on LED
   MOV A, #0FFH         ; Move FFH (255) to A
   CLR C               ; Clear C (the carry bit) so it does not affect the subtraction
   SUBB A, R7          ; Subtract R7 from A. A = 255 - R7.
   MOV TH0, A          ; so the value loaded into TH0 + R7 = 255
   CLR TF0             ; Clear the Timer 0 interrupt flag
   RETI                ; Return from Interrupt to where the program came from 
start:
	MOV TMOD,#00H
	SETB TR0           ; turn on timer 0
	SETB EA            ; Enable Interrupts
	SETB ET0           ; Enable Timer 0 Interrupt
	MOV R7, #160      ; set pulse width control to dim
LOOP:
   SJMP LOOP          ;go to LOOP
   END


[ Edited Thu Aug 30 2007, 01:08 PM ]
 tienduhieulifeflowers86 like this.
Tags PWMpulse width modulation8051 PWM codePWM sample code
Thu Aug 30 2007, 01:08 PM
#18
ok,thanks,but how u see the delay in my code?actually i found this code from book and modify it so i no very understand,and do u know what software that can use to draw the circuit schematic?
 tienduhieu like this.
Thu Aug 30 2007, 01:13 PM
#19
you can use orcad for making schematic.. but is not a free software... the schematic u showed me is made in protel. you can use the same software. or try some free software on internet like eagle.
 tienduhieu like this.
Thu Aug 30 2007, 01:54 PM
#20
Can u explain the function of this PWM code?why we need control output voltage level?The output voltage will affect which part of function of hardware?i not very understand,i am sorry that i only know ask question but i try to learn all this thing through doing this assignment,so i do it all by my own.
 tienduhieulifeflowers86 like this.

Get Social

Information

Powered by e107 Forum System

Conversation

Thu Nov 21 2019, 12:30 PM
raj2555
how to interface 8051 microcontroller with NRF24L01+ module
ExperimenterUK
Sat Oct 12 2019, 10:23 PM
Log in.. then post your code in the 8051 forum
Sat Oct 12 2019, 10:18 AM
Bhadra Sajikumar
i am doing a countdown timer with 8051 for my project, unfortunately our professor had to take a leave of absence before he could teach us most of it.. can someone explain the .asm code of it for me?
Mon Sep 23 2019, 07:37 AM
Nathaniel
I am doing a project for my schools wireless security system with cameras,sensors and spot lights using 8051 micro controller, could you help me out with the design and its source code.
Wed Sep 18 2019, 08:48 PM
Caryn Kover
Thank you for your time,
ExperimenterUK
Mon Aug 05 2019, 07:09 PM
@Ismail ..post in forum, give details
Mon Aug 05 2019, 04:33 PM
Ismail balghmi
Hello. Please I won't download
ExperimenterUK
Wed Jul 24 2019, 12:47 AM
@BUSTER123 Please post in the forum
Tue Jul 23 2019, 06:13 PM
BUSTER123
hello! newbie here. i am kind of a guy who hates using ready - made existing libraries, so this helped a lot as i was trying to control and write to a character lcd display. however, i can't figure out how to set the cursor position. for example, i want to set it to the 5th column in the first row, so position 5. so according to the table, i am sending 10000101 on the 8 data lines of the lcd (register select pulled low). the cursor does not move there however. and i cant move the cursor left or right too. is it something wrong that i am doing? thank you.
ExperimenterUK
Thu Jul 11 2019, 07:55 PM
@ramos https://www.theengineeringprojects.com/2017/09/l298-motor-driver-library-proteus.html

Downloads

Comments

pyxus
Sat Dec 14 2019, 12:31 PM
Istika
Thu Dec 12 2019, 12:04 PM
nabiha_anaya
Sun Dec 08 2019, 09:16 AM
ananyagupta
Tue Dec 03 2019, 07:53 AM
wells
Mon Nov 25 2019, 08:25 PM
auwal
Tue Nov 19 2019, 03:13 PM
ANKITPATEL
Mon Nov 18 2019, 11:00 AM
Casmir
Wed Nov 13 2019, 06:25 AM

Online

Guests: 33, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 05:37 AM

Members: 38110
Newest member: pyxus
Forum Activity
ilylily07 Avatar
Posted By ilylily07
Thu Dec 12 2019, 02:26 PM
wil do.thank you for your advice!
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Dec 12 2019, 07:13 AM
Something like this ?https://www.bing.com/videos/s...
ExperimenterUK Avatar
Posted By ExperimenterUK
Thu Dec 12 2019, 06:58 AM
The layout is a bit different, but it is the same ...
ilylily07 Avatar
Posted By ilylily07
Thu Dec 12 2019, 04:38 AM
https://i.imgur.com/6S5FcwF.png right now im follo...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Dec 10 2019, 04:49 PM
ilylily07 Avatar
Posted By ilylily07
Sun Dec 08 2019, 01:24 PM
Hi .im humbly ask for your advice as i wrongly pur...
nabiha_anaya Avatar
Posted By nabiha_anaya
Sun Dec 08 2019, 09:19 AM
My teacher assign me a project on "voice control h...
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Nov 29 2019, 04:24 AM
" Is it possible to interface a fingerprint scanne...
ilylily07 Avatar
Posted By ilylily07
Thu Nov 28 2019, 03:50 PM
You will not find any code for an 8051 as no one w...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Nov 26 2019, 05:44 PM
You will not find any code for an 8051 as no one w...