/////////////////////////////////////////////////////////////
// This test code works with the PIC-PG4-628 demo board
// from Olimex (http://www.olimex.com/dev/index.html)
/////////////////////////////////////////////////////////////
//20 MHz quartz
#pragma CLOCK_FREQ 20000000
//RS232 settings
#pragma RS232_RXPIN 2
#pragma RS232_TXPIN 3
//Register mapped variables
char _porta@0x05; //PortA
char _trisa@0x85; //TrisA
char _portb@0x06; //PortB
char _trisb@0x86; //TrisB
char _cmcon@0x1F; //CMCON
//Configuration Bits
asm
{
list p=16F628
__config H'3F8A'
}//WDT,PWRT,MCLR,BODEN off, LVP on, HS, CP Off
//Main entry point
main()
{
//Hardware Initialization
_cmcon = 7;
_trisa = 4;
_trisb = 0;
_porta = 0;
_portb = 0;
//Output test string into serial port
putchar( 'T' );
putchar( 'e' );
putchar( 's' );
putchar( 't' );
putchar( '\r' );
putchar( '\n' );
//Flash PortB in endless loop
while( 1 )
{
_portb = 0xFF;
delay_ms( 250 );
_portb = 0x0;
delay_ms( 250 );
}
}
Copyright © 2002-2006 SourceBoost Technologies