??? 02/08/05 11:26 Read: times |
#86883 - Read the cpu data! Responding to: ???'s previous message |
My memory is a little hazy on this - but when you read P2, you're reading the pin values, when you write P2 your write to the output register. So the way around your problem is to keep a copy of the value you write to P2 in a memory location or a register. mov P2,my_p2 ... ... ... ... mov a,my_p2 push a ... ... ... pop a mov my_p2,a DATA my_p2: ds 1 I seem to recall some warning about what you're mentioning in some doc I read many moons ago. Checkout the 'bibles' on this site. Also, a similar problem can happen when you read/write the ports. Say you want to flash a led, so you read the port, xor the bit in question and output back to the port. What happen if the output of the port is loaded so that a '1' values doesn't actually read as a '1' - the logic will not work. So when updating output bits, don't use a read/write method. Again, keep a copy of the bits you want to write, manipulate this copy, then write out to the port. Hope this clears things up! |
Topic | Author | Date |
P2:R0 as memory pointer | 01/01/70 00:00 | |
Read the cpu data! | 01/01/70 00:00 | |
P2 readback | 01/01/70 00:00 | |
Re | 01/01/70 00:00 | |
Thank you all | 01/01/70 00:00 | |
Interesting | 01/01/70 00:00 | |
very well described | 01/01/70 00:00 | |
This is NOT in the | 01/01/70 00:00 | |
ch3 pg 6 | 01/01/70 00:00 | |
none of them | 01/01/70 00:00 | |
more | 01/01/70 00:00 | |
An experiment - AT89C8252 | 01/01/70 00:00 | |
not necessarily | 01/01/70 00:00 | |
sure not necessarily | 01/01/70 00:00 | |
talking about memory | 01/01/70 00:00 | |
MOVX multiplexed with P2 SFR data | 01/01/70 00:00 | |
Now I say: HUH | 01/01/70 00:00 | |
huh | 01/01/70 00:00 | |
Thank you | 01/01/70 00:00 | |
what datasheet says | 01/01/70 00:00 | |
I should've RTFM... :-) | 01/01/70 00:00 | |
not too much logic | 01/01/70 00:00 | |
sure | 01/01/70 00:00 | |
The horses mouth | 01/01/70 00:00 | |
horse is plural | 01/01/70 00:00 | |
I'd be happy to ... | 01/01/70 00:00 | |
can't find them | 01/01/70 00:00 | |
As you use to say :)![]() | 01/01/70 00:00 | |
another note | 01/01/70 00:00 |