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

Sat Jan 18 2020, 03:45 PM
Eric Jones
Eric
Sat Jan 18 2020, 08:49 AM
Elma
norsk porno blogg free african dating sites maria halvorsen porno dating naked brianna porno dating ukraine prywatne porno porno dame iselin porno sex porno no eldre porno gratis porno pa youtube stare filmy porno filme porno cu eleve porno foto finsk porno mamyciu porno porno gratis hd porno maroc world dating teen porno free famely porno fjlmy porno dating norwegian women free svensk porno fri porno film porno gay free porno poland porno suomi porno the best harstad porno senior dating sites canal porno norwegian gay porno porno gradis porno deutsch be2 dating porno bi sex drunk mom porno porno porn porno for kvinner bethany joy lenz dating porno folmy porno gay sex gutte porno tee porno nonne porno emma watson dating porno first time anal retro porno pee porno
Sat Jan 18 2020, 07:24 AM
Charles Halfey
Kind Regards,
Tue Jan 14 2020, 07:08 AM
shubham kharade
when i am trying to simulate the program in Proteus 8 professional, I am getting some errors as cannot find module file dhtxx.md can u help me
Tue Dec 17 2019, 01:44 PM
Devangi
hello..i am programming industrial timer using 8051 with 24lc64 eeprom. i have query in storing the 3 diff value in eeprom with enter button. can anyone share c code ?
Tue Dec 17 2019, 10:30 AM
Andrius
Hello. Can anyone share the code in Bascon and scheme in Proteus?
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.

Downloads

Comments

usb5962
Sat Jan 11 2020, 10:42 AM
elt
Tue Jan 07 2020, 06:53 PM
mg3914697
Tue Jan 07 2020, 12:42 PM
afds43
Sun Dec 29 2019, 05:54 AM
Rupeshpatil
Fri Dec 27 2019, 06:14 PM
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

Online

Guests: 49, Members: 0 ...

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

Members: 38115
Newest member: usb5962
Forum Activity
ExperimenterUK Avatar
Posted By ExperimenterUK
Fri Jan 17 2020, 10:24 PM
We will need the circuit diagram.A Proteus simulat...
Billz Avatar
Posted By Billz
Sat Jan 11 2020, 05:43 PM
hi everyone please attached files are my c code fo...
ExperimenterUK Avatar
Posted By ExperimenterUK
Tue Jan 07 2020, 08:18 PM
Not a stupid question.Setting up "Eclipse" can be...
elt Avatar
Posted By elt
Tue Jan 07 2020, 07:06 PM
So i have just began learning programming micros a...
Billz Avatar
Posted By Billz
Mon Jan 06 2020, 09:22 PM
I think it would be better if you guys try to come...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Jan 06 2020, 12:22 AM
Can you post a circuit diagram and any code you ha...
Billz Avatar
Posted By Billz
Sun Jan 05 2020, 08:17 PM
Need help regarding C code (specifically for PIC 1...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon Dec 30 2019, 06:42 PM
Can you give more details of your problem.
Rupeshpatil Avatar
Posted By Rupeshpatil
Fri Dec 27 2019, 06:21 PM
How to copy program my old microcontroller to new ...
ilylily07 Avatar
Posted By ilylily07
Thu Dec 12 2019, 02:26 PM
wil do.thank you for your advice!