Jump to content
  • 0

UART mode on the PmodMAXSONAR


JColvin

Question

Hi,

 

How do you get the UART mode on the PmodMAXSONAR to work correctly? While using the provided demo code, I am able to get the PWM and Analog modes to report correct distances, but I seem to be having trouble to get the UART version to work. What pin(s) should I be using?

 

Thanks,

James

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

To get the UART working on the PmodMAXSONAR you need to connect the "RX" pin on the Pmod to the "RX" pin to the microcontroller.  To find out what pin that is, you need to go to the "Board_data.c" file for your microcontroller (NOT the board defs file that the MAXSonar library suggests).

 

To find this file (since the library doesn't tell you where it is) you need to open up the original mpide folder when you first installed mpide.  Mine is called "mpide-0023-windows-20130715", so yours likely has a similar name.  Within this folder, open up the "hardware" folder, then the "pic32" folder, then the "varients" folder, and then find whichever microcontroller board you happen to be using and open up the "Board_data.c".  

 

Since the demo code is using the Serial port 1, this means we are using UART2.  So, search the document (via Control+F or Command+F or whatever is appropriate) for "U2RX".  The associated number with the U2RX is the pin that we need to define the RXpin as in the demo code and the pin we will connect the RX pin from the PmodMAXSONAR to.

 

Let me know if you have any questions.

 

Thanks,

 

James

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...