| View previous topic :: View next topic |
| Author |
Message |
ijazx
Joined: 21 Feb 2008 Posts: 5
|
Posted: Sat Feb 23, 2008 7:40 am Post subject: New Ultrasonic Find range |
|
|
Hi, here is my project.... See this circuitry before?
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 |
|
ijazx
Joined: 21 Feb 2008 Posts: 5
|
Posted: Sat Feb 23, 2008 8:02 am Post subject: |
|
|
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 |
|
BrunoG Site Admin
Joined: 22 Nov 2005 Posts: 636
|
Posted: Mon Mar 03, 2008 2:11 am Post subject: |
|
|
Hi,
I moved your topic to this more appropriate section.
it is not easy to see what are U2 and U4 ICs on your circuit _________________ BrunoG, Administrator |
|
| Back to top |
|
ijazx
Joined: 21 Feb 2008 Posts: 5
|
Posted: Sat Mar 22, 2008 5:13 am Post subject: |
|
|
| is the IC 4066 |
|
| Back to top |
|
|