Discussion in "New Ideas regarding projects" started by    coolmirza143    Nov 26, 2010.
Mon Nov 29 2010, 02:47 pm
#31
ok you are mentioning that it is better to use port addresses instead of using sbit????
Mon Nov 29 2010, 02:55 pm
#32


ok you are mentioning that it is better to use port addresses instead of using sbit????

coolmirza143




no,, i dont know how to call that.. hehe lol

what IN trying to say is u may also use that to make your code short...

instead of declaring sbit for 8times in 1 port it can be declare in one line
like
#define level P0 for port zero.. hehe lets wait for the others i dont know how to call that.. i just learned that in some example code.. hehe.. try it also..
Mon Nov 29 2010, 03:08 pm
#33
@romel i dont think it is possible if coz i am defining seperate variable for each pin like level1=P0^0;

level2=P0^1;

so how it is possible to define these in one line????

# define level P0 ....it will not work for me coz i wanna use each bit separately.....
Mon Nov 29 2010, 03:25 pm
#34


@romel i dont think it is possible if coz i am defining seperate variable for each pin like level1=P0^0;

level2=P0^1;

so how it is possible to define these in one line????

# define level P0 ....it will not work for me coz i wanna use each bit separately.....

coolmirza143



u can also use that.. here are the equivalents to your sbit.

P0.0 = 0x01
P0.1 = 0x02
P0.2 = 0x04
P0.3 = 0x08
P0.4 = 0x10
P0.5 = 0x20
P0.6 = 0x40
P0.7 = 0x80


if u want to check the P0.5 if it is high then u can say like this
let say u use this #define level P0

if(level==0x20) // meaning P0.5 is high
 /* your condition here */



it is the same if u say
sbit level5=P0^5


[ Edited Mon Nov 29 2010, 03:29 pm ]
Mon Nov 29 2010, 04:11 pm
#35
@ Romel,

Firstly the main intention should be fulfilled i.e solution to the problem.
In later stages code can be optimized.
The Programmer writes the code a/c to his understanding towards the problem not towards the length of the code, r unwanted varibles and all..
Mon Nov 29 2010, 04:25 pm
#36
@ Kiran I agree.....

first i will test my code on hardware , will check my logic and then will change or modify code in necessary ........
Mon Nov 29 2010, 04:33 pm
#37


@ Romel,

Firstly the main intention should be fulfilled i.e solution to the problem.
In later stages code can be optimized.
The Programmer writes the code a/c to his understanding towards the problem not towards the length of the code, r unwanted varibles and all..

kirangowle



hi kirang
it's just a suggestion and it happened that mirza ask me if possible in that way so what i did is explained how it does..

i did not criticized the way he did the code because I am also not an expert in programming I only just a beginner in this field..

do u agree with me mirza?


[ Edited Mon Nov 29 2010, 05:03 pm ]
Tue Nov 30 2010, 09:13 am
#38
@romel Don't Blackmail me
coz i know a russian scholar said never trust weeping girl....

beside that i agree both of u.......
Tue Nov 30 2010, 11:30 am
#39


@romel Don't Blackmail me
coz i know a russian scholar said never trust weeping girl....

beside that i agree both of u.......

coolmirza143



waheheh lol.. hekhkehke
do u know pacman>?? hehe
Tue Nov 30 2010, 11:39 am
#40
ya i know and i played it a lot better to use Pravin's thread about games

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Bobbyerilar
Thu Mar 28 2024, 08:08 am
pb58
Thu Mar 28 2024, 05:54 am
Clarazkafup
Thu Mar 28 2024, 02:24 am
Walterkic
Thu Mar 28 2024, 01:19 am
Davidusawn
Wed Mar 27 2024, 08:30 pm
Richardsop
Tue Mar 26 2024, 10:33 pm
Stevencog
Tue Mar 26 2024, 04:26 pm
Bernardwarge
Tue Mar 26 2024, 11:15 am