Charaters and MSComm output

Hallo

I have a Celestron telescope that I control using a combination of SkyX and custom control software (Spica), but have some issues with using the Sky to slew(move). It sometimes buggers up the settings of the hand control (or maybe we need to do a Firmware upgrade on HC, and a software upgrade on the SkyX???), but this led me to try and build in some simple slew control for our software (Spica).

Problem!

Tried the test code on telescope - didn't seem to work, but when I tested it between linked PC's, the commstring seemed ok!

Details

The telescope requires the following - for fixed rate RA in + direction (for example) - need to send via RS232:

ā€œPā€ &
chr(2) &
chr(16) &
chr(36) &
chr(rate) &
chr(0) &
chr(0) &
chr(0)

My C++ code uses the following generic command/function:

SlewCommand(16, 36, 6);

whenever the specific slew direction button is pressed down, when it lifts it sends the stop command - much like the hand control interface. With the function being:

//-----------------------------------------------------------------------------------------------------------
//SlewTelescope
void __fastcall SlewCommand(int RADec, int Direction, int Rate)
{
char s[8];
Variant V;

//Enter values into character array
s[0] = 'P';
s[1] = 2;
s[2] = RADec;
s[3] = Direction;
s[4] = Rate;
s[5] = 0;
s[6] = 0;
s[7] = 0;

V = s;

frm_SpicaSetup->msc_Telescope->Output = V; //Output to celestron using MSComm control

}
//------------------------------------------------------------------------------------------------------------------

If possible is my argument correct. Do not have a lot of experience with character strings...

Thanks
Pat
Topic archived. No new replies allowed.