This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Tuesday, March 11, 2008

[oopic] How to interpret Basic DEC statement in OOPic C style?

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.



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:

http://docs.yahoo.com/info/terms/

No comments: