/* =========================================================================== */
/* 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 5 and 6 because they are the ICC pins
   IO_Output(IO_OPEN_DRAIN, IO_PORT_A, 0x9f);
   IO_Input(IO_PULL_UP, IO_PORT_B, 0x3F);
//   IO_Input(IO_PULL_UP_IT, IO_PORT_B, 0x3F);
}/*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 B
   	readval=IO_Read (IO_PORT_B);
   	//shift read value
   	readval&=0x3F;
   	if(readval&0x20) readval|=0x80;
   	//write value on port A
   	IO_ByteWrite (IO_PORT_A, readval);   	
    }
}/*end of main*/

