Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ultra sonic distance meter with pic16f84

Status
Not open for further replies.

elnaz

New Member
hello

I have found a simple distance meter on the internet:
**broken link removed**

but the problem is my pic's data output pins are in high z state.and when I connect them to LCD inputs they become high because of the LCD's data pins default state.

I've tried to find project's author "Ed taylor" but it seems that the email address doesnot exist anymore.

Could any one please help me find the way out??
 
I did but when I'm seeing wit moltimeter the pic's output data pins voltage are about .14 to 1.4 volts and when I am testing with oscope I see nothing.It's like I have not conected the probe to a voltage.(air noise) :?:
 
Thanks but I still think that I've done correctly with lcd module and my pic's output datas are almost zero. my circuit schematic is this:
**broken link removed**

and the code listing is here:

**broken link removed**

I have squares light on the second line of my LCD and the first line is off. :?:
 
elnaz said:
I have squares light on the second line of my LCD and the first line is off. :?:

That's what you get if the LCD isn't getting initialised - you will get that with the PIC unplugged (try it and see!).

I'm presuming you've programmed the PIC correctly, and verified it?.

If the PIC oscillator isn't running you will get this effect as well, or if you've wired it up wrong somewhere, it's quite likely to give this effect.

If you have access to a scope try checking it's oscillating, make sure to use a x10 probe - a x1 will probably stop the oscillator anyway.
 
ultra sonic dastance meter with pic16f84

Is it mistake to connect 4Mhz Xtal with two 18 pf capacitors to Ground, like this?
**broken link removed**
 
Re: ultra sonic dastance meter with pic16f84

elnaz said:
Is it mistake to connect 4Mhz Xtal with two 18 pf capacitors to Ground, like this?
**broken link removed**

No, that's how it's supposed to be connected, check the datasheet for details.
 
I've tested some xtals in my circuit with oscope but I can't see 4 Mhz oscillation. I think there is no problem with my xtal because I've tested it with another circuit and it has passed it successfully.
also I've programmed and verified pic,but I still have zero outputs(RB0-RB3)
**broken link removed**
**broken link removed**
 
elnaz said:
I've tested some xtals in my circuit with oscope but I can't see 4 Mhz oscillation. I think there is no problem with my xtal because I've tested it with another circuit and it has passed it successfully.
also I've programmed and verified pic,but I still have zero outputs(RB0-RB3)

Have you set the fuse options correctly?. The default setting for a 16F84 is RC, you need to set it to XT - the source code listing didn't appear to set them for you, although MicroChip recommend that it should.
 
elnaz said:
How can I set the default oscillation to xtal instead RC in my program?

See the CONFIG directive in the MPASM helpfile, you can use it something like this at the start of the source code (which sets for XT oscillator).
Code:
            LIST      P=16F84, F=INHX8M
            include "P16F84.inc"
            __CONFIG 0x3FF9

You can also specify individual fuse settings, but personally I find it easier to just specify the hexadecimal word. Note that the 'line' before the CONFIG is two underscores.
 
I copied your additive lines and pasted in my source code.but using Mpasm assembler I have these two errors:


MPASM 02.15 Released CVAS.ASM 7-18-2004 17:20:27 PAGE 1


LOC OBJECT CODE LINE SOURCE TEXT
VALUE

00001
00002 LIST P=16F84, F=INHX8M
00003 include "P16F84.inc"
00001 LIST
00002 ; P16F84.INC Standard Header File, Version 2.00 Microchip Technology, Inc.
00136 LIST
2007 3FF9 00004 __CONFIG 0x3FF9
00005
00006 #DEFINE BANK0 BCF 3,5
00007 #DEFINE BANK1 BSF 3,5
00008
00000000 00009 INDF EQU 0x00
00000001 00010 OPTN EQU 0x01
00000002 00011 PCL EQU 0x02
00000003 00012 STATUS EQU 0x03
00000004 00013 FSR EQU 0x04
00000005 00014 PORTA EQU 0x05
Error[115] : Duplicate label ("TRISA" or redefining symbol that cannot be redefined)
00000005 00015 TRISA EQU 0x05
00000006 00016 PORTB EQU 0x06
Error[115] : Duplicate label ("TRISB" or redefining symbol that cannot be redefined)
00000006 00017 TRISB EQU 0x06
0000000B 00018 INTCON EQU 0x0B
00019
 
all the registers like trisa, porta, pcl, etc are already defined in the p16f84.inc include file, so you shouldn't define them yourself anymore, remove the register equ lines from your code
 
yes but the value of registers TRISA and TRISB are different with my program's defined values.

so witch ones should be used?
 
The ones in the include file are made by microchip themselves, the p16f84a.inc comes with MPASM, so it is correct...

actually, your values and the ones on the include file are mapped to the same fysical address because they are in another bank...
 
I made two hex files. one with deleting trisa and trisb equ lines and another witch is got with changing trisa ,trisb equ values in pic16f84.inc file to adapt with their values in my source code.

the first one works with IC but with the second one I have the same problem (squares light on second line of LCD).

anyway micro with LCD works but I have zeros showed on LCD instead of proper distances.so I have this doubt maybe deleting those two lines has made this problem :!: :?:
 
do you switch banks when you want to alter the TRIS?
can you attach your sourcecode?
 
Status
Not open for further replies.

Latest threads

Back
Top