/* =========================================================================== */
/* Project:        Ex1 */
/* File:           Ex1Main.c */
/* Organization:    */
/* Author:           (initial version generated by RBuilder) */
/* Date:           12/1/2004 */
/* =========================================================================== */

#include "ST7lib_config.h"
#include <stdio.h>


/*---------------------------------------------------------------------------*/
/*Function:       PeriphInit*/
/*Purpose:        Periph configuration at RESET*/
/* Date:           12/1/2004 */
/*---------------------------------------------------------------------------*/
void PeriphInit ( void ) {
   
   /* I/O Port initialization */
   IO_Init();

   IO_Input(IO_PULL_UP, IO_PORT_B, 0x77);
   IO_Output(IO_OPEN_DRAIN, IO_PORT_F, 0xff);
   
   
}/*end of  Main*/

/*---------------------------------------------------------------------------*/
/*Function:       main()*/
/*Purpose:        main routine*/
/* Date:           12/1/2004 */
/*---------------------------------------------------------------------------*/
void main ( void ) 
{
	unsigned char readval=0;
   
   /*Configure the internal peripherals*/
   PeriphInit();

   while ( 1 )
   {
   	//read port C
   	readval=IO_Read (IO_PORT_B);
   	readval &=0x77;
   	
   	readval = (readval&0x07) | ((readval&0x70)>>1) ;
   	readval |= 0xC0;
	   
   	//write value on port F
   	IO_ByteWrite (IO_PORT_F, readval);   	 
      
   }
}/*end of main*/

