mImoto
Full Member level 4
Hello,
I have this two doubts and I don't know where to find an answer.
First:
I would like that if pcfg_temp is different from 0b00000111 or different from 0b00001110 or different from 0b00000100 or different from
0b00000010 then something happens. I have used the following coding but I am not sure.
if (pcfg_temp != ( (0b00000111) || (0b00001110) || (0b00000100) || (0b00000010) ) )
{
.....
}
My doubt is that the result of (0b00000111) || (0b00001110) || (0b00000100) || (0b00000010) ) is boolean so maybe this is not the correct way. Any suggestion?
And second:
void function()
{
union READ_DATA tris_desired;
union READ_DATA tris_now;
union READ_DATA bidir_now;
union READ_DATA tris_final;
union READ_DATA error_final;
BYTE tris_temp = 0x00;
BYTE port_id = 0x00;
BYTE pin_id = 0x00;
tris_desired.ReadData = 0x00;
tris_now.ReadData = 0x00;
bidir_now.ReadData = 0x00;
tris_final.ReadData = 0x00;
error_final.ReadData = 0x00;
....
}
If I use this then the compiler works ok but if I use instead->
void function()
{
union READ_DATA tris_desired;
union READ_DATA tris_now;
union READ_DATA bidir_now;
union READ_DATA tris_final;
union READ_DATA error_final;
tris_desired.ReadData = 0x00;
tris_now.ReadData = 0x00;
bidir_now.ReadData = 0x00;
tris_final.ReadData = 0x00;
error_final.ReadData = 0x00;
BYTE tris_temp = 0x00;
BYTE port_id = 0x00;
BYTE pin_id = 0x00;
....
}
The compiler tells me that tris_temp, etc are not declared ¿why?.
Thanks a lot in advance,
mimoto
I have this two doubts and I don't know where to find an answer.
First:
I would like that if pcfg_temp is different from 0b00000111 or different from 0b00001110 or different from 0b00000100 or different from
0b00000010 then something happens. I have used the following coding but I am not sure.
if (pcfg_temp != ( (0b00000111) || (0b00001110) || (0b00000100) || (0b00000010) ) )
{
.....
}
My doubt is that the result of (0b00000111) || (0b00001110) || (0b00000100) || (0b00000010) ) is boolean so maybe this is not the correct way. Any suggestion?
And second:
void function()
{
union READ_DATA tris_desired;
union READ_DATA tris_now;
union READ_DATA bidir_now;
union READ_DATA tris_final;
union READ_DATA error_final;
BYTE tris_temp = 0x00;
BYTE port_id = 0x00;
BYTE pin_id = 0x00;
tris_desired.ReadData = 0x00;
tris_now.ReadData = 0x00;
bidir_now.ReadData = 0x00;
tris_final.ReadData = 0x00;
error_final.ReadData = 0x00;
....
}
If I use this then the compiler works ok but if I use instead->
void function()
{
union READ_DATA tris_desired;
union READ_DATA tris_now;
union READ_DATA bidir_now;
union READ_DATA tris_final;
union READ_DATA error_final;
tris_desired.ReadData = 0x00;
tris_now.ReadData = 0x00;
bidir_now.ReadData = 0x00;
tris_final.ReadData = 0x00;
error_final.ReadData = 0x00;
BYTE tris_temp = 0x00;
BYTE port_id = 0x00;
BYTE pin_id = 0x00;
....
}
The compiler tells me that tris_temp, etc are not declared ¿why?.
Thanks a lot in advance,
mimoto