More questions about a usb PSC and a BS2P40
Capt. Quirk
Posts: 872
The "SEROUT" commands to the Parallax Servo Controller makes my 3 channels of an ADC0834 output choppy.
My Mecha-tronic Fuel Injection project uses (2) MAX 6675's and 3 channels (3-10k pots) of ADC0834 data to drive and adjust as necessary, 2 servos. It's absolutley necessary for my TPS (10k pot) to have a constant output to keep track of the throttle as it's opening, so that it can feed data to the (2) servos that are· controlling the fuel supply·to each cylinder.
Right now, the SEROUT commands for the PSC causes a large·delay in the program (it's set @38400 buad). So when the throttle is opened, the servos don't react right away and the ADC's output "Leap Frogs" uncontrollably from one extreme to the other and of course the servos do too. (As soon as the TPS changes, the servos need updating and then it causes the problem)
I knew SEROUT was a time hog, but I didn't expect it to affect my program to this degree. Also I wasn't able to control my servos without the PSC because each of the·MAX6675's required a 170ms delay.
....Does anybody have any suggestions on how to format my program to give priority to my TPS and the servos? or am I trying to use the PSC for something it wasn't meant to do? I have already tried a "IF-THEN" routine to control the flow of the program based on a change of the TPS, without success. (As soon as the TPS changes, the servos need updating and then it causes the problem) And I have eliminated the possibility that the MAX6675's or any other portion of the program is causing the problem too.
...Also, I originally started with the SX28 and SX52, but as I was running out of time and so I purchased the BS2P-40 to help me finish my project on time. I also have a Propeller, but insufficient experience with SPIN to finish this project in a reasonable amount of time.
I was thinking of·trying Jon Williams last Nuts n Volts Column #143: "Control Virtually Anything...Virtually"
But it uses the same baud and chip
Thanks
Bill
Post Edited (Capt. Quirk) : 6/30/2007 3:36:37 AM GMT
My Mecha-tronic Fuel Injection project uses (2) MAX 6675's and 3 channels (3-10k pots) of ADC0834 data to drive and adjust as necessary, 2 servos. It's absolutley necessary for my TPS (10k pot) to have a constant output to keep track of the throttle as it's opening, so that it can feed data to the (2) servos that are· controlling the fuel supply·to each cylinder.
Right now, the SEROUT commands for the PSC causes a large·delay in the program (it's set @38400 buad). So when the throttle is opened, the servos don't react right away and the ADC's output "Leap Frogs" uncontrollably from one extreme to the other and of course the servos do too. (As soon as the TPS changes, the servos need updating and then it causes the problem)
I knew SEROUT was a time hog, but I didn't expect it to affect my program to this degree. Also I wasn't able to control my servos without the PSC because each of the·MAX6675's required a 170ms delay.
....Does anybody have any suggestions on how to format my program to give priority to my TPS and the servos? or am I trying to use the PSC for something it wasn't meant to do? I have already tried a "IF-THEN" routine to control the flow of the program based on a change of the TPS, without success. (As soon as the TPS changes, the servos need updating and then it causes the problem) And I have eliminated the possibility that the MAX6675's or any other portion of the program is causing the problem too.
...Also, I originally started with the SX28 and SX52, but as I was running out of time and so I purchased the BS2P-40 to help me finish my project on time. I also have a Propeller, but insufficient experience with SPIN to finish this project in a reasonable amount of time.
I was thinking of·trying Jon Williams last Nuts n Volts Column #143: "Control Virtually Anything...Virtually"
But it uses the same baud and chip
Thanks
Bill
Post Edited (Capt. Quirk) : 6/30/2007 3:36:37 AM GMT
Comments
I haven't finished going thorough all of your posted code, but I did notice something that gave me problems in the past when using the PSC. If you try to issuue consecutive SEROUT commands, it produces unprdictable results. The two instructions to set the channel and ramp values for the second SEROUT command may not be long enough to allow the PSC to process the first command or it misses the beginning of the second (??). I have had to put a "PAUSE 1" statement between consecutive SEROUT commands when driving several servos/moters. A 1ms delay between the commands should not adversly effect what you're trying to do in the code.
Good luck with your project, Steve
The (2) "PAUSE 170" statements·after the "SHIFTIN" in each of the max6675 routines were absolutley necessary. The quality of the data reduces below 170 ms·and below 100 ms·it no longer operates.
So, now it seems the answer is modifying the Max6675 "SHIFTIN" statements to work with less of PAUSE. Is there any "BS2P" series tricks that might help.
Post Edited (Capt. Quirk) : 6/30/2007 6:56:42 AM GMT