Code/C-Code/atmega.c
//Function used for setting motor's direction
Function used for setting motor's direction
Function used for setting motor ' s direction
void motion_set (unsigned char Direction)
{
 	unsigned char PortARestore = 0;
 	Direction &= 0x0F; 				
 	PortARestore = PORTA; 			
	 PortARestore &= 0xF0; 			
 	PortARestore |= Direction; 		
 	PORTA = PortARestore; 			
}
void motion_set ( unsigned char Direction ) { unsigned char PortARestore = 0 ; Direction &= 0x0F ; PortARestore = PORTA ; PortARestore &= 0xF0 ; PortARestore |= Direction ; PORTA = PortARestore ; }
Function used for setting motor's direction
Function used for setting motor ' s direction
// removing upper nibbel as it is not needed // reading the PORTA's original status // setting lower direction nibbel to 0 // adding lower nibbel for direction command and // restoring the PORTA status // setting the command to the port