
 Originally Posted by 
Melanie
					 
				 
				The XOR simply toggles the BIT in that example.  If it was a 0 it becomes a 1, and vice-versa.  What you do with that BIT thereafter depends on you and your schematic.
That's what I meant by the trick using discrete XOR logic in the analog world.  It is the way we get a 180° phase shift without a lot of folderol.
As for the DATA statement, it presets the state of the on-board EEPROM at program time.  The EEPROM is not usually all zero's when you get it from Microchip... actually, I wouldn't trust what state it's in.  After erasing, it'll probably full of $FF which may not be what you want... after all, on power-up, your device will look in EEPROM to determine the state of your various I/O's, so when you design your device, when it's powered ON for the very first time, you will want it to come-up with the various I/O's and options in a default state, so in that instance you will use the DATA statements to preset the PICs EEPROM accordingly.  Thereafter, their state can be altered by the equipments operation, but initially you will want your device to initialise a certain way.  The DATA statements will ensure the EEROM is pre-set to those values at program-time and not to some random value.
Ah, that's something I missed.  I missed the "first programmed" part of the DATA command reference description.  Normal execution of the program thereafter disregards the DATA line??
You buy a brand-new TV set and plug it in the wall, you don't expect it to switch-on for the very first time with the factory default volume set to maximum.
It might get your attention {;-)
LOCATION is the address in EEPROM space.
So is each LOCATION one 8-bit byte long?  If so, how can you store 16 bit words??
For example, the volume setting can be located at address 5 in EEPROM.  It can be a value from 0 (minimum) to 255 (maximum) the default (brand-new, untampered out-of-the-box) setting is 75.  You would ensure in your program that...
DATA @5,75
Got it.  Thanks.
			
		 
	
Bookmarks