
	Test LdMicro for AVR ATMega microcontrollers
	_________________________________________


	If everything is well configured, one can generate C files,
	hex file, and upload it to the target without exiting LdMicro


1)	Install an avr-gcc for windows 

2)	Copy LdMicro executable, buildAvr.bat and flashMCU.bat in a same directory
	Also copy LIBRARIES_FOR directory and its content at the same place
	Verify that libraries' version is the same as LdMicro's one

3)	Edit buildAvr.bat (right click + Modify) and modify GCCPATH to point 
	to your avr-gcc path

	Then, edit if need be FlashMCU.bat (right click + Modify) 
	If you intend to use AvrDude to flash the target, modify the path
	AVRDUDE_PATH too, and adapt avrdude.exe command line according to your 
	AVR programmer	
	It'll be possible anyway to flash the target manually with hex file

4)	Create a ladder with LdMicro in a directory.

5)	Compile the ladder with "Compile Atmel AVR-GCC" 
	and generate the C file in the same directory as the source (.ld) 
	file, with the same name (.c)
	
	It also generates a (.h) file and a ladder.h header
	With joined libraries, it makes a ready-made C project

6)	Launch "Generate C solution" from LdMicro to get the hex file
	in "bin" directory

	Look at the command window ; there shouln't be compiling errors
	Librairies are automaticaly copied (first time only) in "lib" 
	subdirectory where they can be adapted if need be
	Intermediate files are generated in "obj" subdirectory

7)	Upload generated hex file into the target with "Call FlashMcu" or manually
	Test generated hex file on target...



NB:	The libraries have been tested on AtMega8, 16 and 328
	It's possible (and easy) to adapt the code to other targets of the 
	same family by using compiling directives.
	The name of the target is defined in ladder.h as LDTARGET_atmegaxxx

	You can use several ADCs or PWMs, but only one Uart, one SPI and one I2C
	(But with several peripherals with different software SS pins on SPI
	or with diferent addresses on I2C Bus)

NB:	SPI must be named "SPI" on AVRs
	SPI new functions are:
	SPI Send/Receive, which sends and/or receives a byte 
	SPI Write, which send an alphanumerical string to SPI without reception

	SPI frequency is defined as UART's one in the global settings
	SPI works only in master mode with most standard config

NB:	I2C must be called "I2C" on AVRs
	I2C new functions are:
	I2C Read to read one byte in a peripheral's register
	I2C Write to write a byte to a peripheral's register

	I2C frequency is also defined in global settings
	I2C also works only in master mode

NB:	All the frequencies used by ADC, PWM or SPI are obtained from CPU clock
	by a dividing factor. There are few choices for this factor, so frequencies
	are very approximative. To have hints about frequencies compile in Hex/Asm
	and look at given information or compute it by looking at libraries
	or datasheet
	I2C frequency is more precise because of configuration possibilities

NB:	ADC max available resolution is used
	PWM max resolution is used and parameter is only % between 0 and 100
