Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Tools
Old 11th October 2009, 04:05 AM   #46
Default

oh! i have got that link
lebohangmaphothoane is offline  
Old 11th October 2009, 04:47 AM   #47
Default

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.
lebohangmaphothoane is offline  
Old 13th October 2009, 12:01 AM   #48
Default

Why not test it out? You want USART, so get that working, then send the ADC value to your computer and adjust from there
__________________
Mike
My website: www.ElectroBird.net
birdman0_o is online now  
Old 14th October 2009, 01:24 AM   #49
Default

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
lebohangmaphothoane is offline  
Old 14th October 2009, 02:06 AM   #50
Default

No rush my friend
__________________
Mike
My website: www.ElectroBird.net
birdman0_o is online now  
Old 15th October 2009, 04:34 AM   #51
Default

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
lebohangmaphothoane is offline  
Old 15th October 2009, 01:07 PM   #52
Default

Does anything happen when you run the program in hardware?
__________________
Mike
My website: www.ElectroBird.net
birdman0_o is online now  
Old 16th October 2009, 03:07 AM   #53
Default

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
lebohangmaphothoane is offline  
Old 16th October 2009, 03:10 AM   #54
Default

Light control system for smart home-circuit.jpg The circiut diagram looks like this. can u try it and upload my code and see if it will work
lebohangmaphothoane is offline  
Old 16th October 2009, 03:13 AM   #55
Default

I used 5volts to power motor and pic16f877a
lebohangmaphothoane is offline  
Old 17th October 2009, 03:26 AM   #56
Default

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 clockwise
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                 
               
                 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
lebohangmaphothoane is offline  
Old 17th October 2009, 03:28 AM   #57
Default

im looking forward know to have the input from the computer rotating the motor whereby i will use USART
lebohangmaphothoane is offline  
Old 17th October 2009, 06:01 AM   #58
Default

Which program are you going to use on the computer?
__________________
Mike
My website: www.ElectroBird.net
birdman0_o is online now  
Old 5th November 2009, 02:37 AM   #59
Default

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
Attached Thumbnails
Light control system for smart home-cpu.jpg   Light control system for smart home-cpu1.jpg  
lebohangmaphothoane is offline  
Old 5th November 2009, 02:40 AM   #60
Default

Computer causes an Rx interrupt, then makes the pic do a forward or reverse loop based on what you chose.
__________________
Mike
My website: www.ElectroBird.net
birdman0_o is online now  
Reply

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



All times are GMT. The time now is 01:50 AM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker