• 0
Sign in to follow this  
JColvin

UART mode on the PmodMAXSONAR

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

Share this post


Link to post
Share on other sites

1 answer to this question

Recommended Posts

  • 0

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this