Hi,
RD is just a name that you created which points to same memory adress (PortA) and bit at that adress (.3) as PortA.3 does.
So RD[i] is then the same thing as PortA.3[i] but why are you doing it? What's the intended purpose of the [i] part of it?
What will happen is that the first time thru the loop (when i=0) you will set PortA.3 high - which I think is all you want to do, but please correct me if that's not the case. Next time (when i=1) you'll set PortA.4 high. Next time (when i=2) you'll set PortA.5 high and so on. When i is 23456 you will set a bit, which 23456 bits "away" from PortA.3 in the memory map....
Look at sextion 7.6.5 in the PBP3 manual for more details on array indexing, which is what you're doing effectively.
I think you'll see the potential issue with this and the fact that it worked before is just pure luck as far as I can see.
/Henrik.




Bookmarks