Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Robotics Chat


Robotics Chat Specific to discussions about robots and the making of.

Reply
 
Thread Tools Display Modes
Old 26th May 2008, 03:11 AM   (permalink)
Question My first ROBOT

Hi there!
I'm considering to make a line follower and I have made this code:

Code:
list p=16f628
		#include<p16f628.inc>
		__CONFIG  _MCLRE_ON & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
		ERRORLEVEL   -302
		cblock	0x20
			temp 
			temp_s      
  		endc
;******************************************************************
	org 0x00
	goto main
;***********************************INTERRUPT LOOP*****************
	org 0X04
inter:
		movwf 	temp
		swapf 	STATUS,w
		clrf  	STATUS
		movwf	temp_s
		btfsc	PORTB,0x00
		goto	loop1
loop2:
		movlw b'00000101'
		movwf	PORTA
		btfsc	PORTB,0x05
		goto	loop2
		goto	loop_x
		
loop1:		
		movlw 	b'10001000'
		movwf 	PORTA
		btfsc 	PORTB,0x00
		goto  	loop1
loop_x
		bcf   	INTCON,0x01
		bcf	  	INTCON,0x00
		swapf 	temp_s,w
		movwf 	STATUS
		swapf 	temp,w
		retfie

main:
		bsf		INTCON,0x07			;Globel interrupt enable(we are using interr.)
		bsf 	INTCON,0x04	
		bsf		INTCON,0x03			;RB4-RB7 interrupt on change is enabled/ in other words these pins will also work as
								;interrupts and interrupt will occur every time any of these pin changes state
								; i.e.:HIGH to LOW or LOW to HIGH, we can not set it to be on eather one state change  		
		bcf 	INTCON, 0x01		
		bcf		INTCON,	0x00			;Clear RB4-RB7 interrupt flag so, that another interr. can occur.

;**********************************SET UP THE PORTS *****************
		bsf		STATUS,RP0			;switch to BANK 1
		movlw 	b'00100001'	
		movwf 	TRISB				;set RB6 & RB5 as input
		movlw	b'00000000'
		movwf 	TRISA				;setPORT A all output
		bcf 	STATUS,RP0			;back to BANK  0
		movlw 	0x07				;turn comparators off, so HIGH will be simple
								; HIGH rather than +5V (compared to supply) so with the LOW
		movwf 	CMCON				

Loop:

		movlw 	b'00001001'		
		movwf 	PORTA				;set pin 0 of port a HIGH
		goto 	Loop
		END
It runs well on LEDs and hopefuly it will run on motors too. Actually the programme reverse one LED lightning the other on interrupt and ther are two such pairs of LEDs, so when motors will be connected on interrupt the respective motor will be reversed. If you don't follow what I mean than kindly see the video which is posted by "futz" who helped me with the codes and circuit..

Now what I'm confused is about the H bridge, I don't have much time to spend on this robot as my exams are coming, I was wondering that can't I simply connect motors with the PIC via resistors, will that be relaible ?.
I will use photoresistors as sensors (FYI).
__________________
CHRIS

Last edited by c36041254; 26th May 2008 at 03:12 AM.
c36041254 is offline   Reply With Quote
Old 26th May 2008, 03:52 AM   (permalink)
Default

PIC pins are only 20ma, not enough to drive motors.
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 26th May 2008, 04:48 AM   (permalink)
Default

Does this mean I need to attach H bridge or is there any other easier way ?
__________________
CHRIS

Last edited by c36041254; 26th May 2008 at 04:49 AM.
c36041254 is offline   Reply With Quote
Old 26th May 2008, 04:54 AM   (permalink)
Default

You need to attach an H-Bridge, a nice simple one is the L293D or SN754410
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 26th May 2008, 06:02 AM   (permalink)
Default

I was trying to understand the H bridge from Build a 5A H-Bridge motor controller! in which there is a truth table given which explains when motors will run in forward and when in reverse etc., but I think that in my programme I just need to attach each output of PIC to one of the inputs of SN754410 and here the SN754410 will work as simply a current source for motor. Do I understand it right ?

As L293D is only a TTL compatible and not CMOS how can I use it with 16f628 ?
__________________
CHRIS
c36041254 is offline   Reply With Quote
Old 26th May 2008, 12:23 PM   (permalink)
Default

They'll both work with the 16F628, take a look at the Mongoose schematic on my site or read about h-bridges on Robot Room
David Cook - Robot Room: Robotics, Electronics, and Schematics
__________________
Bill
Smart Kits build Smart People

http://www.blueroomelectronics.com
blueroomelectronics is offline   Reply With Quote
Old 27th May 2008, 02:37 AM   (permalink)
Default

I would suggest using the SN754410 as it is very easy to integrate.
Krumlink is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Latest
Robot to robot communication nuttaphong191 Robotics Chat 3 22nd September 2007 04:08 PM
help with a robot magee Robotics Chat 11 25th August 2007 12:00 PM
Robot Efficiency & other Robot stuff williB Robotics Chat 56 1st May 2005 03:35 AM
help with gps robot muhtar Robotics Chat 10 12th November 2004 04:08 AM
My robot. Cyborg Micro Controllers 4 26th May 2004 01:53 PM



All times are GMT. The time now is 04:59 AM.


Electronic Circuits  |  Electronics Wiki
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.