/* =========================================================================== */
/* 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();
   //do not use pins 4 and 6 because these are the ICC pins...
   IO_Input(IO_PULL_UP, IO_PORT_C, 0xaf);
   //don't use pins 3 and 5 because they don't get out of the device...
   IO_Output(IO_OPEN_DRAIN, IO_PORT_F, 0xd7);
   
   
}/*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_C);
   	readval &=0xAF;
	   if(readval&0x20) 	readval|=0x40;
	   if(readval&0x08) 	readval|=0x10;
	   
   	//write value on port F
   	IO_ByteWrite (IO_PORT_F, readval);   	
   }
}/*end of main*/

