![]() |
Re: SONAR Sensor Software Driver
Quote:
|
Re: SONAR Sensor Software Driver
Quote:
SPEAKING OF MOUNTING IT ON FOAM: be careful how you mount it to the foam. Just putting a block of foam behind the unit and screwing it down through the foam doesn't work: the screws transmit the vibration from the frame directly to the sonar unit. You must mount the unit to the foam, then mount the foam to the robot's frame. This gives isolation. |
Re: SONAR Sensor Software Driver
Quote:
In my defense: Gdeaver's post didn't show up on a search. Anyway: The code to measure the pulse is very cool, but that new sensor also gives an analog voltage at 10 mV/inch - just a simple analog input and you're done... Don |
Re: SONAR Sensor Software Driver
This may just be on one of those days again but how do you hook up the vex sonar sensor to the EDU robot.
|
Re: SONAR Sensor Software Driver
Quote:
Other than that you hook it up to the same digital output and interrupt input as used on the Vex. |
Re: SONAR Sensor Software Driver
I was compiling SONAR_0.3 using MPLAB C18 and it was not successful.
Followings are the errors detected from the codes in sonar.c. At function initialize_sonar() 1) SONAR_OUTPUT_CONFIG = OUTPUT -->symbol 'TRISJbits' has not been defined -->struct or union object designator expected -->lvalue required 2) SONAR_OUTPUT = 0 -->symbol 'LATJbits' has not been defined -->struct or union object designator expected -->lvalue required At function ping_sonar () 3) SONAR_OUTPUT = 1 -->symbol 'LATJbits' has not been defined -->struct or union object designator expected -->lvalue required 4) SONAR_OUTPUT = 0 -->symbol 'LATJbits' has not been defined -->struct or union object designator expected -->lvalue required I thought maybe the problem lies with the definition in sonar.h for both SONAR_OUTPUT_CONFIG and SONAR_OUTPUT (see following 2 lines) # define SONAR_OUTPUT rc_dig_out16 # define SONAR_OUTPUT_CONFIG digital_io_16 It seems to me that the define statements is referring to the hardware part or maybe the MPLAB C18 compiler is unable to read it? Would anyone reading this can share which compiler they use and how to go about solving this problem? pls help. Thank you. :) |
Re: SONAR Sensor Software Driver
I have managed to solve the previous post questions.
At present, I have modify the software code for my project application. I am using a PIC18F452 microcontroller for the ping sensor. Everything works fine until programming the USART code. The hyper terminal characters does not change when the distance of the object changes. Can you help me? I have a very close deadline to meet. Follow is the code i added prior to Mike's codes: #include <p18f452.h> // version 1.1 #include <usart.h> #include "sonar.h" /* Set configuration bits * - set HS oscillator * - disable watchdog timer * - disable low voltage programming */ #pragma romdata CONFIG _CONFIG_DECL(_CONFIG1H_DEFAULT & _OSC_HS_1H, _CONFIG2L_DEFAULT, _CONFIG2H_DEFAULT & _WDT_OFF_2H, _CONFIG3H_DEFAULT, _CONFIG4L_DEFAULT & _LVP_OFF_4L, _CONFIG5L_DEFAULT, _CONFIG5H_DEFAULT, _CONFIG6L_DEFAULT, _CONFIG6H_DEFAULT, _CONFIG7L_DEFAULT, _CONFIG7H_DEFAULT); #pragma romdata int i; int distance; void main(void) { int i=0; Initialize_Sonar(); Ping_Sonar(); Hardware_Interrupt_Sonar(); Timer_Interrupt_Sonar(); Get_Sonar_Distance(); OpenUSART (USART_TX_INT_OFF & USART_RX_INT_ON & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_HIGH, 129); // open USART with baud of 9600 while(i<10) { putrsUSART("A"); putrsUSART(distance); putrsUSART("B"); i++; } } |
Re: SONAR Sensor Software Driver
Im not sure if im right about this but try this...
I put the whole thing in an endless loop.. Code:
#include <p18f452.h> // version 1.1Good Luck |
Re: SONAR Sensor Software Driver
I think you may have overlooked this section in the readme:
Quote:
I'm not familiar with your application but give this a shot. Note that I added comments about adding a time delay. It may take up to 50mS for the sonar to find an object. ] Code:
#include <p18f452.h> // version 1.1 |
Re: SONAR Sensor Software Driver
I've been trying to get this working today on the FRC Robot Controller. I've never programmed interrupts before though, so I'm at a stand-still as to what to do. I think I have the initialization for the pin driven interrupt done correctly, but I'm at a complete loss for how to get the timer working. Any help would be appreciated.
|
Re: SONAR Sensor Software Driver
Quote:
|
Re: SONAR Sensor Software Driver
Yes, I'm using MPlab to program. I got my default code from kevin.org, it is his camera code version 2.1.
Thanks for your help! |
Re: SONAR Sensor Software Driver
Quote:
Code:
else if (PIR2bits.TMR3IF && PIE2bits.TMR3IE) // timer 3 interrupt? |
Re: SONAR Sensor Software Driver
oooh I think it may be that when I added your code to InterruptHandlerLow() I didn't reset the interrupt flag within the two "else if" statements. I'll add that tonight and see if it works. Thanks!
|
Re: SONAR Sensor Software Driver
Hey guys,
Version 0.3 of this software DOES NOT work with Kevin Watson's PWM driver. I'm guessing its a dependancy on Timer 3. So, dont use it, or fix it. --Tom |
| All times are GMT -5. The time now is 22:14. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi