PDA

View Full Version :

tedroberson
03-10-2010, 05:32 AM
Hi all, I'm new at programing.I come to this forum often and ask for help,thanks to Tracy, MIke and others I get quality answers.I'm a member of sereval forums,I must say that this is one of the best.
·· To prove you can get quality answers, read the reply below·I got for one of my questions.

Hi Tracy.sending my thanks again .
You may not believe this but I figured out that block of code before you had a chance to reply.
The key to the line of your code that open the doors for me·was;(DIRD = %1110. 'need to make the led pins outputs.)The rest was understood.
So my output pins are 15,14,13.they corrospond to IN3,IN4 and IN6.
Therefor; %1110 corrosponds to my outputs.Shifting <<·* and + sets my output pins·· in accordance to the bin #%1110.
·My explination may be a little wacked,But when I read your reply·I was·happy to know that my theory was close.
I'll get there in the near future.

RE : Help problem with line of code
Originally Sent : 3/9/2010 4:41:46 PM GMT by Tracy Allen
The inputs provide the three 0 or 1 bits that you need, but it is convenient to assemble them into one NIBble for the subsequent program. That NIBble should be
%cba0
where a is the bit from IN4, b is from IN3 and c is from IN6. A multiplication by 2 or 4 moves the associated bit one or two places to the left in the binary representation. So %0001 * 2 = %0010 and %0001 * 4 = %0100. The final <<1 is the same as *2. It moves the three bits one place to the left. So, %0cba becomes %cba0.

All that permutation would have been avoided if you had chosen 3 neighboring pins for the INputs.

I'm very happy that the code worked for you. It might help others if you go back and post that success on the public forum. Readers have to be skeptical about solutions posted, not knowing if they are BS or not!

Help problem with line of code
Originally Sent : 3/7/2010 11:01:26 PM GMT by tedroberson said...

Tracy,your program solved my problems but the followering line of code I can't figure out

x = IN4 + (IN3*2) + (IN6*4) << 1.

Looks like you're adding multiplying and shifting bits left.

Please tell me why (in3 is * 2 ) and ( in6 is * by 4).

Thanks, Ted Roberson

\$WMc%
03-10-2010, 09:15 AM
tedroberson

If You would post Your code!!!!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············___\$WMc%___······················ ······ BoogerWoods, FL. USA