Here is your code with comments . . .changesCode:DEFINE OSC 4 'Define the Osc to 8 MHz asm bsf OSCCON, SCS1 ; 1x = Internal Block bcf OSCCON, SCS0 ; 00 = Primary Oscillator (20Mhz?) bsf OSCCON, IRCF2 ; 111=8000 110=4000 101=2000 bsf OSCCON, IRCF1 ; 100=1000 011=0500 010=0250 bcf OSCCON, IRCF0 ; 001=0125 000=0032 MSTABLE010 btfss OSCCON, IOFS bra MSTABLE010 ; wait until Oscillator is stable endasm data @0,0 'Initialize location 0 on eeprom to zero LED2 var PORTB.2 ' LED cntr var word FET var PORTA.0 'PORTB = %00000100 ' Clear PORTB, and set B2 PortB = %00000000 ' clear port latch bits 'PORTA = %01000000 ' Clear PORTA PortA = %00000000 ' Clear PortA latches 'TRISA = %01000000 ' Set PORTA port 2 and 7 to input, 0, 3-6 ,8 Output TRISA = %10000100 'Set PORTA port 2 and 7 to input, 0, 3-6 ,8 Output TRISB = %00000000 ' Set PORTB to all output led2 = 1 ' PortB.2 high LED on read 0,cntr 'read location 0 or eeprom FET = 0 ' PortA.0 Low if (PORTA.7 = 0) then pause 255 ' pause 255 milliseconds If (PORTA.7 = 0) then write 0,0 'reset eeprom to 0 when port A Bit 7 has been forced to 0 Main: led2 = 0 'PortB.2 Low LED off pause 64 ' very strange choice of pause 64 milliseconds led2 = 1 ' LED on if (cntr < 10) then Pause 255 'slow blink under ten cycles cycles of what ? pause 255 ' why this duplicate pause is good for something like 65535 ms else Pause 64 'fast blink over 10 cycles cycles of what ? endif cntr = cntr + 1 'increment cntr write 0,cntr 'write new cntr value into eeprom if (cntr <= 20) then goto main FET = 1 'Shut down RF Current ' cntr = 0 'stop stop stops all brain activity how can it goto main? goto main 'Stop End
Bookmarks