RenesasT
Full Member level 2
Hello All,
After long time, have a great day all.
I need your help. All suggestion would be greatful for me.
I am using renesas controller, I am taking data in Port lets say port 1 which is of 8 bits,
I am taking status of 3 sensors , which could be either high or low. i.e 0 or 1.
The sensors A, B, C are connected to port 1.0, 1.1,1.2 respectively.
I am reading port in 8 bit variable as sensor.
I am writing below program
Its like P1.7P1.6P1.5P1.4P1.3P1.2P1.1P1.0
It is working. Now thing is that. Now I need like P1.7P1.6P1.5P1.4P1.3P1.1P1.0P1.2 in the sensor.
What to write for that?
suppose Port 1=0x01 (00000001) , then I need sensor value as 0x02(00000010).
If Port 1=0x06(00000110), then I need sensor value as 0x05 (00000101).
Please help me.
After long time, have a great day all.
I need your help. All suggestion would be greatful for me.
I am using renesas controller, I am taking data in Port lets say port 1 which is of 8 bits,
I am taking status of 3 sensors , which could be either high or low. i.e 0 or 1.
The sensors A, B, C are connected to port 1.0, 1.1,1.2 respectively.
I am reading port in 8 bit variable as sensor.
I am writing below program
Code:
sensor=P1;
Its like P1.7P1.6P1.5P1.4P1.3P1.2P1.1P1.0
It is working. Now thing is that. Now I need like P1.7P1.6P1.5P1.4P1.3P1.1P1.0P1.2 in the sensor.
What to write for that?
suppose Port 1=0x01 (00000001) , then I need sensor value as 0x02(00000010).
If Port 1=0x06(00000110), then I need sensor value as 0x05 (00000101).
Please help me.