• AVR Freaks

Hot!ultrasonic sensor

Author
Mousavi
New Member
  • Total Posts : 1
  • Reward points : 0
  • Joined: 2019/02/27 02:53:47
  • Location: 0
  • Status: offline
2019/02/28 13:11:20 (permalink)
0

ultrasonic sensor

Hello, I am  trying to measure distance using an ultrasonic sensor and pic16f90 micro controller. However, when i connect the circuit in breadboard my LCD does not display anything. i have checked and found that my microcontroler gets stuck in the echo high loop. i was hoping for help in initializing the trigger and echo and what could be the reason why my echo never goes high. below is the code that I have written for the exercise. thank you in advance 
#1

2 Replies Related Threads

    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: ultrasonic sensor 2019/02/28 21:32:55 (permalink)
    0
    I don't know if this is the cause of your main problem, but your code is a mixture of absolute code (using CBLOCK) and relocatable code (udata and res)
    This means the variables declared using "udata" are overlaying the addresses of those using "CBLOCK".
    You should only use one or the other.
    Plainly your project is in relocatable mode, so all the variables in the CBLOCK should move into the "udata" block.
     

    Nearly there...
    #2
    qhb
    Superb Member
    • Total Posts : 9998
    • Reward points : 0
    • Joined: 2016/06/05 14:55:32
    • Location: One step ahead...
    • Status: offline
    Re: ultrasonic sensor 2019/02/28 21:40:18 (permalink)
    0
    What oscillator are you trying to use?
    Your config words specify " _HS_OSC", which means it is expecting a crystal between 4 and 20 MHz to be connected to pins 2 & 3 which are RA4 and RA5, so there's no way you can monitor a signal on RA5.
     
     

    Nearly there...
    #3
    Jump to:
    © 2019 APG vNext Commercial Version 4.5