Help for connecting usr module
Moderator: Benj
Help for connecting usr module
Hi.i have a usr tcp232 and need help for connecting it to the micro.
This are the file.
This are the file.
Re: Help for connecting usr module
Hi to all.
the component I'm used for module is correct?
Program is working but can't recive data from pc.
Thanks for your help.
the component I'm used for module is correct?
Program is working but can't recive data from pc.
Thanks for your help.
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Help for connecting usr module
Hi,
Yes UART (3.3 - 5V RS232) is the correct component.
If it was me, I would use RX interrupt rather than a tight loop as I believe tight loops don't work.
What voltage are you running MCU at?
Yes UART (3.3 - 5V RS232) is the correct component.
If it was me, I would use RX interrupt rather than a tight loop as I believe tight loops don't work.
What voltage are you running MCU at?
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Help for connecting usr module
In that case are you using a lvl shifter for RX of module as signal pins are not 5V compliant?
I use a level shifter for 3V3 Bluetooth even though the supply pin is 5V tolerant like your module.
It has 5K6 from RX of module to ground & 3K3 from RX of module, in series TX of microcontroller.
I think the level shifting within the datasheet of USR module is a bit over kill, but of course that can be used if you feel happier to do so.
If you connect the TX of MCU directly to RX of USR then damage to both, especially USR module are likely to occur.
It should be fine for direct connection from TX of USR module to RX of microcontroller as current will be limited due to high input resistance of microcontroller.
I use a level shifter for 3V3 Bluetooth even though the supply pin is 5V tolerant like your module.
It has 5K6 from RX of module to ground & 3K3 from RX of module, in series TX of microcontroller.
I think the level shifting within the datasheet of USR module is a bit over kill, but of course that can be used if you feel happier to do so.
If you connect the TX of MCU directly to RX of USR then damage to both, especially USR module are likely to occur.
It should be fine for direct connection from TX of USR module to RX of microcontroller as current will be limited due to high input resistance of microcontroller.
Martin
Re: Help for connecting usr module
Thanks. I'm just learning programming and some questions?
How to use RX interrupt?
What format should I send from pc?
How to use RX interrupt?
What format should I send from pc?
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Help for connecting usr module
You're welcome.
Click and give it a suitable name.
Move the UART receive component into the newly created macro for the UART0 RX.
That's it.
As soon as a char is received, then D (which only needs to be byte or string) will contain the value that triggered the interrupt.
Then if you are stuck we can help you to send the data in the correct format.
There could even be forum members or staff that do now the format that could help?
Drag an interrupt icon at the start, double-click on it then selectM.ali wrote:How to use RX interrupt?
Code: Select all
UART0 RX
Code: Select all
Create New Macro
Move the UART receive component into the newly created macro for the UART0 RX.
That's it.
As soon as a char is received, then D (which only needs to be byte or string) will contain the value that triggered the interrupt.
As I don't know the product, you will need to look at the datasheet and see what you need to send.M.ali wrote:What format should I send from pc?
Then if you are stuck we can help you to send the data in the correct format.
There could even be forum members or staff that do now the format that could help?
Martin
-
- Valued Contributor
- Posts: 1208
- Joined: Wed May 31, 2017 11:57 am
- Has thanked: 70 times
- Been thanked: 440 times
Re: Help for connecting usr module
Try something like this -
This receiving from a Bluetooth module on UART on an Arduino (any with a 328p) - note that you'll need to add in a C block at the start of your code - or replace the C block that sleeps the processor with something appropriate for the MCU you are using..
And the interrupt: The full code: (This just echoes the characters received on the UART back to the UART....) (Replace the Bluetooth calls with either UART macros or macros for the device you are using)
Martin
This receiving from a Bluetooth module on UART on an Arduino (any with a 328p) - note that you'll need to add
Code: Select all
#include <avr/sleep.h>
set_sleep_mode(SLEEP_MODE_IDLE);
And the interrupt: The full code: (This just echoes the characters received on the UART back to the UART....) (Replace the Bluetooth calls with either UART macros or macros for the device you are using)
Martin
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Help for connecting usr module
The interrupt and initialise components should not be in a loop as shown in your images.
They should only be accessed once at the very start.
Can you change your flowchart accordingly, then upload it again.
They should only be accessed once at the very start.
Can you change your flowchart accordingly, then upload it again.
Martin
Re: Help for connecting usr module
I did what you said but still do not get the code
I'm going to test the program with just RS232 and if it's working then usr Thanks again for your help
I'm going to test the program with just RS232 and if it's working then usr Thanks again for your help
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Help for connecting usr module
Have you made a 1 sec flasher test to confirm the hardware clock is running at the correct speed?
One issue I see is if you was say sending a "1" then the value of D will be 48 + 1 = 49
So if you want D to be assigned with 1 then you need to use D = D - 48.
The other thing is D will never be greater than 255 as the RX is only receiving bytes so T will never = D
You need to know what your expecting then design the flowchart around that.
For example, currently witch your flowchart you it can only receive a single value from 1 to 255.
So if a number string is sent then you can only receive the numbers 0 to 9
If you want the receive a string value higher than 9 then your current flowchart will not work.
My advice would be to test hardware with single numbers to start with.
Do you have a UART to USB converter?
If so its very easy to send 0 to 9.
If you state what you want to receive and what you want the value to do then I can see if I can assist you further
One issue I see is if you was say sending a "1" then the value of D will be 48 + 1 = 49
So if you want D to be assigned with 1 then you need to use D = D - 48.
The other thing is D will never be greater than 255 as the RX is only receiving bytes so T will never = D
You need to know what your expecting then design the flowchart around that.
For example, currently witch your flowchart you it can only receive a single value from 1 to 255.
So if a number string is sent then you can only receive the numbers 0 to 9
If you want the receive a string value higher than 9 then your current flowchart will not work.
My advice would be to test hardware with single numbers to start with.
Do you have a UART to USB converter?
If so its very easy to send 0 to 9.
If you state what you want to receive and what you want the value to do then I can see if I can assist you further
Martin