///////////////////////////////////////////////////////////// //Descrition: / //Firmware: 0125-00-00 / //Hardware: 1199B / //Processor: PIC18F6620 / //Last Rev: 2003/06/15 / ///////////////////////////////////////////////////////////// //Revision history / //00 2002/12/14 Initial release / ///////////////////////////////////////////////////////////// #include "012500.h" ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// //This block of code should decrement rfam location 0x00 8 / //times from 0x10 to 0x08. / //----------------------------------------------------------/ //With a 9.8304mhz crystal at 4x mode (H4) and 5.00vdc, the / //result is 0x09 (1 lost decrement) / // start result / // 0x1000 0x09 (1 lost) / // 0x1100 0x0b (3 lost) / // 0x1200 0x09 (1 lost) / // 0x1300 0x09 (1 lost) / // 0x1400 0x09 (1 lost) / // 0x1500 0x09 (1 lost) / // 0x1600 0x09 (1 lost) / // 0x1700 0x09 (1 lost) / // 0x1800 0x09 (1 lost) / // 0x1900 0x0b (3 lost) / //>Replacing all the decfsz with incfsz results in 0x17, or / //one lost increment at block start 0x1000, 0x15 or 3 lost / //increments at block start 0x1100!!! / //>Replacing all incfsz/decfsz with incf or decf does not / //help / //>Getting rid of the NOPs and packing the INDF0s fixed it??/ //>Replacing all the INDF0 with absolute register references/ //fixed the problem / //----------------------------------------------------------/ //With a 9.8304mhz crystal at 1x mode (HS) and 5.00vdc, the / //result is 0x0d (5 lost decrements) / ///////////////////////////////////////////////////////////// #org 0x1000,0x10ff void testnop(){ #asm clrf 0xfea movlw 0x00 movwf 0xfe9 movlw 0x10 movwf 0x00 //1 nop decfsz 0xfef,f movlw 0x00 //should be 0x0f //2 nop nop decfsz 0xfef,f movlw 0x00 //should be 0x0e //3 nop nop nop decfsz 0xfef,f movlw 0x00 //should be 0x0d //4 nop nop nop nop decfsz 0xfef,f movlw 0x00 //should be 0x0c //5 nop nop nop nop nop decfsz 0xfef,f movlw 0x00 //should be 0x0b //6 nop nop nop nop nop nop decfsz 0xfef,f movlw 0x00 //should be 0x0a //7 nop nop nop nop nop nop nop decfsz 0xfef,f movlw 0x00 //should be 0x09 //8 nop nop nop nop nop nop nop nop decfsz 0xfef,f movlw 0x00 //should be 0x08 //ram location 0x00 should be 0x08 after 8 decrements from 0x10 #endasm } void main() { byte temp; ///////////////////////////////////////////////////////////// output_a(0x00); output_b(0x00); output_c(0x40); output_d(0x00); output_e(0x00); output_f(0x00); output_g(0x02); //----------------------------------------------------------- set_tris_a(0xCF); set_tris_b(0xCF); set_tris_c(0x80); set_tris_d(0x00); set_tris_e(0x00); set_tris_f(0x02); set_tris_g(0xE4); ///////////////////////////////////////////////////////////// port_b_pullups(false); ///////////////////////////////////////////////////////////// setup_adc_ports(ANALOG_AN0_TO_AN3); setup_adc(ADC_CLOCK_INTERNAL); setup_psp(PSP_DISABLED); setup_spi(FALSE); setup_wdt(WDT_OFF); setup_timer_0(RTCC_INTERNAL); setup_timer_1(T1_DISABLED); setup_timer_2(T2_DIV_BY_1,255,1); setup_timer_3(T3_DISABLED|T3_DIV_BY_1); setup_ccp1(CCP_PWM); setup_ccp2(CCP_PWM); setup_comparator(NC_NC_NC_NC); setup_vref(FALSE); //enable_interrupts(INT_RDA); //enable_interrupts(INT_RDA2); //enable_interrupts(global); while(true){ //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW testnop(); temp++; //WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW } }