Hello all,
My problem is as follows:
I have taken an example code for Hexapod from here:
http://www.lynxmotion.com/images/files/eh3r220.bas
I am trying to use it for my hex. This example code is written in Basic syntax and is
used for Bot Board / BASIC Atom 28
I am using OOPic and C style code, so I have a problem with rewriting DEC to C style in
this line of code:
serout p15,i38400,["#",RRHH,RRHH2,"P",DEC HipH_Pulse(0),"#",RRHV,RRHV2,"P",DEC
HipV_Pulse(0),
Here http://lynxmotion.net/viewtopic.php?t=3597 I've got an answer, what this DEC is:
The "DEC" modifier tells the compiler that you wish to output the value as Decimal ascii
values not as a simple binary value.
In my code, I am using something like this, where SSC is oserialL object:
SSC.String=("#"+RRHH+RRHH2+"P"+ (something instead of DEC should be
here)HipH_Pulse(0)+"#"+RRHV+RRHV2+"P" ... etc
RRHH and RRHH2 are constants, HipH_Pulse(0) is a function.
I have tried classical C approach using printf:
printf("#%02dP%04d", RRHH, HipH_Pulse(0));
but compiler returned: Cannot find identifier 'printf'
The rest of the code I have already rewritten to OOPic. No problems there.
Has anybody any ideas how can this DEC be rewritten in OOPic C style?
Thank you for your replies. Your help will be greatly appreciated.

(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )
--- In o...@yahoogroups.com, selyanko@... wrote:
>
> Hello all,
>
> My problem is as follows:
> I have taken an example code for Hexapod from here:
> http://www.lynxmotion.com/images/files/eh3r220.bas
>
> I am trying to use it for my hex. This example code is written in
Basic syntax and is used for Bot Board / BASIC Atom 28
>
> I am using OOPic and C style code, so I have a problem with
rewriting DEC to C style in this line of code:
>
> serout p15,i38400,["#",RRHH,RRHH2,"P",DEC
HipH_Pulse(0),"#",RRHV,RRHV2,"P",DEC HipV_Pulse(0),
>
> Here http://lynxmotion.net/viewtopic.php?t=3597 I've got an answer,
what this DEC is:
>
> The "DEC" modifier tells the compiler that you wish to output the
value as Decimal ascii values not as a simple binary value.
>
> In my code, I am using something like this, where SSC is oserialL
object:
>
> SSC.String=("#"+RRHH+RRHH2+"P"+ (something instead of DEC should be
here)HipH_Pulse(0)+"#"+RRHV+RRHV2+"P" ... etc
>
> RRHH and RRHH2 are constants, HipH_Pulse(0) is a function.
>
> I have tried classical C approach using printf:
> printf("#%02dP%04d", RRHH, HipH_Pulse(0));
>
> but compiler returned: Cannot find identifier 'printf'
>
> The rest of the code I have already rewritten to OOPic. No problems
there.
>
> Has anybody any ideas how can this DEC be rewritten in OOPic C style?
>
> Thank you for your replies. Your help will be greatly appreciated.
>
Try STR$(HipH_Pulse)
You may have a problem with the fact that STR$ always includes leading
zeros. See Chapter 13 of the ooPIC Programmer's Guide.
Richard

(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )