Bean's 16 output PWM Code Questions
I have a question about how I can up·the baud rate on Bean's SX28 16 ouput PWM code? Also with a 50mhz resonator what is the max baud rate that can be acheived?
This question may be more for Bean, does the code require constant updates to the pwm·outputs for 1 output change or once set can you update any of the outputs independently. This has come up because I don't see that each output has it's own address.
Hardware question: would there be a problem using 3 sx28's on one board with all 3 running a 50mhz resonator, would there be any interferance between them?
Thanks Guys!
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (DigitalDj) : 3/12/2008 2:47:46 AM GMT
This question may be more for Bean, does the code require constant updates to the pwm·outputs for 1 output change or once set can you update any of the outputs independently. This has come up because I don't see that each output has it's own address.
Hardware question: would there be a problem using 3 sx28's on one board with all 3 running a 50mhz resonator, would there be any interferance between them?
Thanks Guys!
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (DigitalDj) : 3/12/2008 2:47:46 AM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
What I plan on doing is the 3 sx28's and like you did use seperate resonators for each. Once I get some VB6 code worked out for the serial communications and the proto working I may need some input on designing a board.
I just need to get the baud rate up for what I want to do!
Thanks for all the help!
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (DigitalDj) : 3/12/2008 11:54:11 PM GMT
I used the SX48's because I needed "tons" of I/O lines. As a matter of fact, one SX48 is doing nothing else but generating 18 different PWM outputs. Data exchange between both SX48's is done via a parallel interface (8 bit data, 4 bit address, 1 bit strobe). Three more port B inputs are used to trigger interrupts to control the PWM modes.
The other SX48 handles various timing tasks, controls the other SX48 via the parallel interface, and the interrupt lines. It also handles serial communication with a PC.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Greetings from Germany,
G
However, in practice, a higher baud rate's timing will prob. be thrown off by the ISR, esp. since this program wants to receive, what, 20 bytes, if you include the address header and the 16 bytes of PWM targets.
If it were me, I would use an ISR based serial routine, rather than SX/B's built-in serial function. There are numerous examples; see esp. Nuts/Volts 143, 144 for examples of ISR serial routines.
That said, you will then need to (possibly) make some adjustments to the PWM ISR routine -- the ISR will run much faster (more often) so that it can handle a higher-baud serial function. At 50mhz you should be able to do bauds up to the 100k range, presuming you still have the overhead in the ISR for the PWM. If you go really high-baud, and you are not using all 16 channels of PWM, you might consider cutting some of the channel code out of the ISR.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
In using a multi-tasking approach that lets you do "standard" serial while at the same time doing other timed tasks, the maximum baud rate with a 50 MHz resonator would be in the neighborhood of 250 K bits per second.
If you were willing to temporarily suspend other operations while you were doing serial work, that speed could increase to somewhat more than double that.
That said, certain situations can be contrived that would tolerate 1 Mega bit per second, but that takes some of the generality away.
Under special circumstances, and not using "standard" serial format (as in dropping the start and stop bits) I have been able to get several hundred SX's to serial among themselves very reliably at 10 Mega bits per second.
So the answer to your question about maximum baud rate is very dependent on what you are trying to do, and also very much on what ELSE the micro has to do.
Cheers,
Peter (pjv)
Thanks for all of the info!
Kevin
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔