www.micro-examples.com
Microcontroller circuits and source code examples
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 

New Ultrasonic Find range

 
Post new topic   Reply to topic    www.micro-examples.com Forum Index -> General Discussion About PIC Microcontrollers
View previous topic :: View next topic  
Author Message
ijazx



Joined: 21 Feb 2008
Posts: 5

PostPosted: Sat Feb 23, 2008 7:40 am    Post subject: New Ultrasonic Find range Reply with quote

Hi, here is my project.... See this circuitry before? Embarassed

But this circuitry cannot response well.... I have no ideal to troubleshoot it. Is it not stable? But i think "distortion" is just the sub question.... I already troubleshoot this circuitry long times ago....
Still left two weeks to complete this project, so i hope that from this forum can guide me..... thanks!




Notice that this two sensor is Ultrasonic Transceiver sensor.... Each sensor can function as transmit and received the signal....


The PIC is send the pluses 40 kHz for the Pin 35....


Here is the source code.

Back to top
View user's profile Send private message Send e-mail MSN Messenger
ijazx



Joined: 21 Feb 2008
Posts: 5

PostPosted: Sat Feb 23, 2008 8:02 am    Post subject: Reply with quote

DEFINE OSC 20

DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 2
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 3
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANOUS 2000
DEFINE LCD_DATAUS 50

T1_LOWERBYTE VAR WORD
T1_UPPERBYTE VAR WORD
TOF VAR WORD
DISTANCE VAR WORD
SENSOR_OLD VAR BYTE
SENSOR_NEW VAR BYTE
LOOP_CNT VAR BYTE

TRISA=%11110111
TRISB=%00000000
CMCON=%00000011
CVRCON=%11000110

INTCON=0
LCDOUT $FE,1
PAUSE 500

START:

T1CON=%00000000
PIR1.0=0

IF CMCON.7=1 THEN PORTA.1=1

SENSOR_OLD=PORTA.4

T1CON=%00000001
GOSUB SEND40K
TMR1L=0
TMR1H=0
PAUSEUS 1300

SENSOR_NEW=PORTA.4

IF SENSOR_NEW!=SENSOR_OLD THEN GOTO START

REPEAT
IF CMCON.7=1 THEN
T1CON=%00000000
GOTO CALCULATE_DIST
ENDIF
UNTIL PIR1.0=1

IF PORTA.4=0 THEN
LCDOUT $FE,1
PAUSE 500
LCDOUT "Object is out of range from RIGHT sensor!"

ELSE
LCDOUT $FE,1
PAUSE 500
LCDOUT "Object is out of range from LEFT sensor!"

ENDif
pause 1000
GOTO START

CALCULATE_DIST:
T1_LOWERBYTE=TMR1L
T1_UPPERBYTE=TMR1H
TOF=T1_LOWERBYTE + (T1_UPPERBYTE*256)
DISTANCE=TOF/29
IF PORTA.4=0 THEN
LCDOUT $FE,1
PAUSE 500
LCDOUT "RIGHT sensor(in mm)"
LCDOUT $FE,$C0
LCDOUT "= ",dec distance

else
LCDOUT $FE,1
PAUSE 500
LCDOUT "LEFT sensor(in mm)"
LCDOUT $FE,$C0
LCDOUT "= ",dec distance

ENDIF
PAUSE 100
GOTO START

SEND40K:
FOR LOOP_CNT =10 TO 0 STEP -1
PORTB=%00000100
PAUSEUS 11
PORTB=%00000000
PAUSEUS 10
NEXT LOOP_CNT
RETURN
Back to top
View user's profile Send private message Send e-mail MSN Messenger
BrunoG
Site Admin


Joined: 22 Nov 2005
Posts: 636

PostPosted: Mon Mar 03, 2008 2:11 am    Post subject: Reply with quote

Hi,

I moved your topic to this more appropriate section.

Arrow it is not easy to see what are U2 and U4 ICs on your circuit
_________________
BrunoG, Administrator
Back to top
View user's profile Send private message Send e-mail
ijazx



Joined: 21 Feb 2008
Posts: 5

PostPosted: Sat Mar 22, 2008 5:13 am    Post subject: Reply with quote

is the IC 4066
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    www.micro-examples.com Forum Index -> General Discussion About PIC Microcontrollers All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group