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.
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.
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.
LOCATION is the address in EEPROM space.
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


 
		
		 
			 
			 
			 
					
					

 
 
		 Originally Posted by Melanie
 Originally Posted by Melanie
					


Bookmarks