<alessandro.cofanelli@...> wrote:
>
> I've downloaded and read the whole manual.
> My troubles are?
>
> Can the 4 com ports be all used at the same moment?
> Is the micro fast enought to calculate 4 different PIDs (for 4
> motors) with a max delay of 10 milliseconds?
>
> What my application have to do is:
>
> read the analog value of input 1
> Calculate the pid
> Send the correcting value by com1
>
> read the analog value of input2
> Calculate the pid
> Send the correcting value by com1
>
> read the analog value of input3
> Calculate the pid
> Send the correcting value by com2
>
> read the analog value of input4
> Calculate the pid
> Send the correcting value by com2
>
> All the 4 tasks have to be completed in a total time interval of 10
> Milliseconds.
For your first question: yes and no. The serial ports are hardware
UARTs and the OS handles serial port byte receive and transmit out of
the buffers at hardware native speed. So you could dump data into each
output buffer -- one buffer at a time -- and have a bunch of data
queued up in the buffers which will be transmitted in the background.
There's no command to toss data out on all the buffers simultaneously
and have them transmit in sync. Data reception is similar, though it
might get tough to handle a lot of interrupts rather than poll the
buffers looking for input. Anyway, based on your pseudocode you were
looking for fire-and-forget serial ports, which is close enough to the
reality here.
Doing something in 10 milliseconds is another tough one, same as
OOPic. We can do 360 instructions in that timeframe. That means,
assuming no other overhead, you have 90 BASIC instructions for each
PID. The analog reading will take 1 to 2 instructions, but you don't
have much room for doing any software filtering. I don't know how
complex your PID routine is going to be.
So it *may* be possible. It all depends on how much calculation you
actually need to do. Each part of the calculation (addition, copying a
variable, etc) will take an instruction, but there is no penalty for
floating point calculations.
If you're not sure, you could take advantage of the 30 day money back
guarantee and just try it.
However, it might be worth it to learn a little C or assembly and
write native code for a microcontroller, as several have already
mentioned. You'll definitely have enough elbow room for calculations
if you go that route. The downside is having to roll your own routines
for just about everything.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment