![]() | ![]() | ![]() |
| | #46 |
|
oh! i have got that link
| |
| |
| | #47 |
|
In page 3 it is stated what happens if the body passes infront of the sensor, so what i want to know is how much output voltage does the sensor output if there is a body passing in front of the sensor. i need that output voltage so that i can make ADC and turn on the LED. In page 5 it says output mv(2)= 3900, does it mean it output 3.9 volts. if that is the case will i be correct to say if the ouput voltage is creater than 2.5 volts it means there is motion detected hence i can turn on the LED and the code will still be the same as that one where i used the light sensor.
| |
| |
| | #48 |
|
Why not test it out? You want USART, so get that working, then send the ADC value to your computer and adjust from there | |
| |
| | #49 |
|
hi birdman0_0 i think before monday i will show you the code i wrote using USART its because im still working on how to turn a unipolar stepper motor clockwise and anti clockwise direction. Besides that i have to read about USART and understand how it works
| |
| |
| | #50 |
|
No rush my friend | |
| |
| | #51 |
|
please take a look at this link Jones on Stepping Motor Types it says to rotate the unipolar motor continuously, we just apply power to the two windings in sequence. Assuming positive logic, where a 1 means turning on the current through a motor winding. in the code below i have applied this sequence :Winding 1a 1000100010001000100010001 Winding 1b 0010001000100010001000100 Winding 2a 0100010001000100010001000 Winding 2b 0001000100010001000100010 but the motor does not rotate as animated GIF of figure 1.2 . what is wrong with the code Code:
;Author : LEBOHANG MAPHOTHOANE
;PROGRAM FUNCTION:turning motor
list P=16F877a
include "P16F877a.inc"
__config 0x3D18
;errorlevel -302, -207;suppress message 302 from the list
;Declarations:
CBLOCK 20h ; Temporary storage
pos
dc1
dc2
delay
ENDC
org 0x0000
goto Start
;Program Start:
Start
call Init ;sets the values of ADCON0 and ADCON1
;initialize porta
Main
;clockwise
movlw b'0001'
movwf PORTB
call wait
clrf PORTB
movlw b'0100'
movwf PORTB
call wait
clrf PORTB
movlw b'0010'
movwf PORTB
call wait
clrf PORTB
movlw b'1000'
movwf PORTB
call wait
clrf PORTB
goto Main
wait movlw 4 ; Outer loop iteration count
movwf dc1
dl1 clrf dc2 ; Initialize inner loop
dl2 nop
nop
decfsz dc2,F
goto dl2
decfsz dc1,F
goto dl1
return
;Subroutines:
Init
clrw ; Zero.
movwf PORTB ; Ensure PORTB is zero before we enable it.
bsf STATUS,RP0 ; Select Bank 1
movlw 0xF0 ; Set port B bits 0-3 as outputs
movwf TRISB ; Set TRISB register.
bcf STATUS,RP0 ; Select Bank 0
return
END
| |
| |
| | #52 |
|
Does anything happen when you run the program in hardware?
| |
| |
| | #53 |
|
the program when i built it on Mplab it says zero errors.I used ISIS 7 Professional to construct circuit diagram and when i run it, the motor do not rotate the way i want it to rotate, it rotates one step about 30 degrees and it stops, but i want it to rotate continuously until i stop it
| |
| |
| | #54 |
| | |
| |
| | #55 |
|
I used 5volts to power motor and pic16f877a
| |
| |
| | #56 |
i have figured the problem, the delay subroutine was not correct. now that i have corrected the delay subroutine at lest it can turn 180 degrees clockwiseCode: ;Author : LEBOHANG MAPHOTHOANE
;PROGRAM FUNCTION:turning motor
list P=16F877a
include "P16F877a.inc"
__config 0x3D18
;errorlevel -302, -207;suppress message 302 from the list
;Declarations:
CBLOCK 20h ; Temporary storage
dc1
ENDC
org 0x0000
goto Init
;Program Start:
;Start
; call Init ;sets the values of ADCON0 and ADCON1
;initialize porta
wait movlw 5 ; Outer loop iteration count
d11 movwf dc1
decfsz dc1,F
goto $-1
return
;Subroutines:
Init
clrw ; Zero.
movwf PORTB ; Ensure PORTB is zero before we enable it.
bsf STATUS,RP0 ; Select Bank 1
movlw 0xF0 ; Set port B bits 0-3 as outputs
movwf TRISB ; Set TRISB register.
bcf STATUS,RP0 ; Select Bank 0
Main
clockwise
;1-----------------------
movlw b'0001'
movwf PORTB
call wait
movlw b'0100'
movwf PORTB
call wait
movlw b'0010'
movwf PORTB
call wait
movlw b'1000'
movwf PORTB
call wait
; goto Main
end
| |
| |
| | #57 |
|
im looking forward know to have the input from the computer rotating the motor whereby i will use USART
| |
| |
| | #58 |
|
Which program are you going to use on the computer?
| |
| |
| | #59 |
|
birdman0 i want to make a simple comuter interface which looks like that one on the picture. if i click the box (clockwise) then the motor must rotate clockwise or if i click anticlockwise then the motor must rotate anticlockwise. im not sure which programing software i must use between visual studio C++ or axampp to make such interface. i have read about USART and how to send data through rs232 cable.i think these two diagrams can easily explain to you what im trying to say. i want to control the motor on the circuit board using computer where by connection between the computer and the circuit board is made by rs232 serail cable
| |
| |
| | #60 |
|
Computer causes an Rx interrupt, then makes the pic do a forward or reverse loop based on what you chose.
| |
| |
|
| Tags |
| control, home, light, smart, system |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| Guys this is my home made 2.1 Home Theater System | pasanlaksiri | Electronic Projects Design/Ideas/Reviews | 40 | 11th November 2009 05:07 AM |
| Traffic light control system with timer display | hocklin12 | Electronic Projects Design/Ideas/Reviews | 6 | 7th May 2009 09:10 PM |
| smart traffic light: HELP! | Crystal86 | Electronic Projects Design/Ideas/Reviews | 3 | 22nd January 2009 04:17 PM |
| smart home using blue tooth | jayanthi | Electronic Projects Design/Ideas/Reviews | 4 | 4th September 2008 04:29 PM |
| traffic light control system | samcheetah | Electronic Projects Design/Ideas/Reviews | 3 | 3rd May 2004 07:30 PM |