Hi
i only ask because i do not sure know.
because BoostC makes fail if i set a Byte in a struct in c code icon i change it from Type Byte to Type Int.
Then i allocation the menu.command to a FC byte Variable as Type Byte ( i think i must take a int variable - i will try later this )
This FC Variable i switch and compares to the FC Constante.
But this not right switch in this way.
After i set in Variable Manager the Value each Constante from 0...1 ....2.... explizit '0' ...'1'....'2'..
the switch work fine.
I ask: Which type is this Constante then if i write the value a Byte or Integer?
Is this with Value : 0 a Byte Variable?
is this with Value : '1' a Integer Variable?
i think Byte Type without Strokes, Int Type with Strokes, String Type with Double Strokes - i am right?
because i set in struct the command as a Int then i must set the constant variable explizite as a int constante by strokes ?
.. it works ..
i only what if someone can this continued i am sure
best wishes
Rudi
Solved: Constante Byte or Integer
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: No Hurry - Constante Byte or Integer
x = 0i think Byte Type without Strokes, Int Type with Strokes, String Type with Double Strokes - i am right?
is not the same as
x = '0'
In the second example we are assigning the ASCII value of '0' which is actually 48.
http://www.asciitable.com/
So nothing to do with bytes or ints, just different values.
A byte is one 8-bit data location containing the value 0 - 255, An int is two 8-bit data locations which when combined by the compiler contain the value 0 - 65535.
A string is an array of bytes each containing an ASCII character.
Byte is not valid C syntax try using Type char instead.because BoostC makes fail if i set a Byte in a struct in c code icon i change it from Type Byte to Type Int.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: No Hurry - Constante Byte or Integer
Benj wrote:x = 0i think Byte Type without Strokes, Int Type with Strokes, String Type with Double Strokes - i am right?
is not the same as
x = '0'
In the second example we are assigning the ASCII value of '0' which is actually 48.
http://www.asciitable.com/
So nothing to do with bytes or ints, just different values.
A byte is one 8-bit data location containing the value 0 - 255, An int is two 8-bit data locations which when combined by the compiler contain the value 0 - 65535.
Not sure why BoostC would error on a byte, did you use the constructor char or byte? I think using the word char should work just fine to give you an 8-bit value in your struct.because BoostC makes fail if i set a Byte in a struct in c code icon i change it from Type Byte to Type Int.
Dear Benj,
thank you!
Shame on me! Allways this Bytes - Int in my Head.
I am now going into the corner and ashamed a long round.
Have a nice weekend - i will post no more new post before monday
So long i will stand into the corner
benj you are right, if constructor char BoostC will compile, if constructor Byte BoostC will not work.
i found this:
http://forum.sourceboost.com/index.php?showtopic=5124
struct _makesFail
{
byte test;
} FAILES;
struct _makesOk
{
int test;
char test2[20];
} MAKESOK;
best wishes!
Rudi
..i go into the corner now.
...edit...
btw..
i found this on my way into the corner ...
http://forum.sourceboost.com/index.php?showtopic=4898
edit
Info:
-----
Into the corner there is no pc and i have think fine..
i have think, i must define the BYTE not only for BoostC
because C is not knowing about BYTE..
only:
char
int
float
double
void
that BoostC know what word i mean with BYTE
So i think ..
in many src code from microchips are the struct code wrote with word BYTE..
Code: Select all
struct _makesFail
{
BYTE test;
} FAILES;
And 8bit Variables are In Flowcode with word "MX_UINT8"
so before the struct with BYTE
i make a
Code: Select all
typedef unsigned char BYTE; // this are 8-bit unsigned
Code: Select all
struct _goesAha
{
BYTE test;
} goesAha;
Rudi
For more word and type ..
examples.. in GenericTypeDefs.h
Last edited by Rudi on Fri Jun 27, 2014 8:21 pm, edited 1 time in total.