//*********************************************************************
//*  HI-TECH C SOURCE CODE FOR INVERTER MODULE
//*********************************************************************

#include <pic.h>
							
__CONFIG(MCLRDIS & WDTDIS & UNPROTECT);

void main()
{
 TRIS = 0b11111011;	//GP2 = output : GP3 = input
 FOSC4 = 0;		//GP2 = I/O pin
 CMCON  = 0b11110111;	//comparator off
 OPTION = 0b11001111;	//pull-ups and wake-up off
	
 while(1)		//loop forever
 {
  if(GPIO & 0b00001000) //look for a high on GP3
   GP2 = 0;		//GP3 was high
  else
   GP2 = 1;		//GP3 was low
 }//while(1)
}//main

//*********************************************************************
//*  RESULTING ASSEMBLER FROM HI-TECH C COMPILER
//*********************************************************************
     1                           	processor	10F206
     2                           	opt	pw 79
     3                           	psect	__Z18698RS_,global,delta=1
     4                           	psect	ctext0,local,size=512,class=ENTRY,delta=2
     5                           	psect	config,global,class=CONFIG,delta=2
     6                           	psect	text0,local,class=CODE,with=ctext0,delta=2
     7                           	psect	text1,local,class=CODE,delta=2
    18                           	psect	__Z18698RS_
    19  008                     
    20  008                     	;#
    21                           
    22                           	psect	config
    23  3FF  FEB                	dw	4075	;#
    24                           
    25                           	psect	text0
    26  1F1                     _main
    27                           ;inverter.c: 33: TRIS = 0b11111011;
    28  1F1  CFB                	movlw	-5
    29  1F2  006                	tris	6
    30                           ;inverter.c: 34: FOSC4 = 0;
    31  1F3  405                	bcf	5,0
    32                           ;inverter.c: 35: CMCON = 0b11110111;
    33  1F4  CF7                	movlw	-9
    34  1F5  027                	movwf	7	;volatile
    35                           ;inverter.c: 36: OPTION = 0b11001111;
    36  1F6  CCF                	movlw	-49
    37  1F7  002                	option
    38                           ;inverter.c: 38: while(1){
    39  1F8                     l3
    40                           ;inverter.c: 39: if(GPIO & 0b00001000)
    41  1F8  766                	btfss	6,3	;volatile
    42  1F9  BFC                	goto	l5
    43                           ;inverter.c: 40: GP2 = 0;
    44  1FA  446                	bcf	6,2
    45                           ;inverter.c: 41: else
    46  1FB  BF8                	goto	l3
    47  1FC                     l5
    48                           ;inverter.c: 42: GP2 = 1;
    49  1FC  546                	bsf	6,2
    50                           ;inverter.c: 43: }
    51  1FD  BF8                	goto	l3
    52                           
    53                           	psect	text1
    54  0000                     

HI-TECH Software PICC Macro Assembler V8.05
Symbol Table                                          Fri Aug 20 13:44:07 2004

         l3 01F8           l5 01FC        _main 01F1        start 0000  
