Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
I guess that you are programming in C. You might be much quicker to convert the integer into hexadecimal and to send that.What I'm doing is to convert the integer to ASCII character before transmitting, but the conversion process is taking too much time to perform.
I guess that you are programming in C. You might be much quicker to convert the integer into hexadecimal and to send that.
The dsPIC will be storing numbers in 16 bit registers, so the range is 0 - 65535, but it is stored as binary 00000000000000 to 1111111111111111
If you have a number stored like that and you are changing it to decimal, there are loads of calculations to be done. To change it to hexadecimal it only needs splitting into groups of 4 bits. That should be a lot faster than it can be transmitted by the USART anyhow.
You need to give far more details, saying it takes 'too much time' is really pretty meaningless.
I have written a dsPIC program to output a PWM corresponding to a sinewave. Now I would like to get some variables from this program and transmit them using UART to PC for analysis/plotting in Matlab or an other software. I have already succeeded to convert a variable to a string and transmit this string using UART to PC and then reading it using Tera Term. But I'm limited in the frequency that I can sample this variable to send to UART, mainly because of the baud rate of UART and of the conversion process from an integer to string is a bit lengthy. This will get problematic if I need to output more variables for analysis, like 4 different variables which each need to be converted to string and transmitted. Now I was thinking to as least decrease the conversion time by eliminating the conversion, if possible, and instead send an integer directly from the dsPIC development board to the PC.
It's still rather vague - how fast are you wanting to send the data, and how fast are your sample times?.
Instead of converting the string to decimal ASCII, how about converting it to HEX ASCII instead, makes it a little shorter, and MUCH faster to convert - convert to decimal in the PC if you need to.