void gpio_test()
{   
   UART_Printf("\n\rConnect any IO Pins to buzzer, relays, leds ");
   UART_Printf("\n\rMake connections and hit 'k' to test ");
   while(UART_RxChar()!='k');
  while(1)
    {
	 /* Turn On all the leds and wait for one second */ 
	   P0= P1 = P2 =P3= 0xff;	   
	   DELAY_sec(1);
	 /* Turn off all the leds and wait for one second */
	  P0= P1 = P2 =P3= 0x00;;
	   DELAY_sec(1);
    }
}
示例#2
0
/* start the main program */
void main() 
{
   unsigned char cnt=0;
  /*Configure all the ports as output */
   TRISA= C_PortOutput_U8;
   TRISB= C_PortOutput_U8;
   TRISC= C_PortOutput_U8;
   TRISD= C_PortOutput_U8;
   TRISE= C_PortOutput_U8;
   
  while(1)
    {

	 /* Display the counter on all the ports */ 
	   PORTA=cnt;
	   PORTB=cnt;
	   PORTC=cnt;
	   PORTD=cnt;
           PORTE=cnt;

	 /* Increment the counter after 1-sec */ 
	   DELAY_sec(1);
        cnt++;
      }
  }
示例#3
0
/* start the main program */
void main() 
{
 
   unsigned int cnt=0;

   while(1)
    {
	   
	    for(cnt=0;cnt<9999;cnt++)	 // loop to display 0000-9999
		 {
		   
		   display_number(cnt);
		   DELAY_sec(1);
	    	 
			
		 }

	}												  
																		 
  }										
示例#4
0
/* start the main program */
void main()
{
	uint16_t cnt=0;

	/* Initialize the UART before Transmitting/Receiving any data */
	UART_Init(9600);
	UART_Printf("5digit decimal counter: ");

	/* Transmit the counter till 9999 */
	while(cnt < 9999)
	{
		
		/* Transmit the 4-digit counter value and go to next line */
		UART_Printf("\n\r%4u",cnt);
		
		/* Increment the counter value after 1-sec */
		DELAY_sec(1);
		cnt++;
	}
	while(1);

}