/*
	MGFLSHEE.C

	BL14xx/MicroG or BL15xx/MicroG2

	Store and read back memory from flash eeprom. Only the top most 512 bytes
	of the flash eeprom is accessible in the user program. Access the data
	location as 0 to 511. Locations 0 and 1 are reserved for operation mode
	and communication baud rate, respectively.

	If the final program is burned to a regular eprom, the flash is gone
	and therefore no storage is available.
*/

main()
{
int i;

	for(i=2;i<512;i++)
	{
		ee_wr(i, i & 0xff);
		if(ee_rd(i) != (i & 0xff))
		{
			printf("Bad data\n");
			printf("Must not be a using flash eprom !!!\n");
			break;
		}
		hitwd();
	}

	printf("Sample flash values\n");
	printf("location 2 has %d\n", ee_rd(2));
	printf("location 3 has %d\n", ee_rd(3));
	hitwd();
	printf("location 255 has %d\n", ee_rd(255));
	printf("location 256 has %d\n", ee_rd(256));
	printf("location 511 has %d\n", ee_rd(511));
}