OT: PIC assembler error messages

Snippets from assembled code:

MPASM 5.41 1CHK.ASM 10-31-2015 17:51:56 PAGE 1

LOC OBJECT CODE LINE SOURCE TEXT VALUE

0036 1B86 00106 T4L: BTFSC PORTB,K1.4 ; Wave enable input, 1 => enabled 0037 2846 00107 GOTO T5L ; skip lookup code when disabled 0038 3009 00108 MOVLW High(tab4) 0039 008A 00109 MOVWF PCLATH Message[306]: Crossing page boundary -- ensure page bits are set. 003A 21A1 00110 CALL tab4 ; far call 003B 07A8 00111 ADDWF amplo ; add lookup value to amplitude 003C 1803 00112 BTFSC STATUS,C 003D 0AA7 00113 INCF amphi 003E 182A 00114 BTFSC swcount,0 ; got first wavepoint 003F 2845 00115 GOTO T4LS 0040 1003 00116 BCF STATUS,C ; divide by 2 AKA normalize 0041 0CA7 00117 RRF amphi,F 0042 0CA8 00118 RRF amplo,F 0043 1803 00119 BTFSC STATUS,C ; odd sum? 0044 0AA8 00120 INCF amplo,F ; round up 0045 142A 00121 T4LS: BSF swcount,0 ; got one at least one wavepoint 00122 0046 1B06 00123 T5L: BTFSC PORTB,K1.5 ; Wave enable input, 1 => enabled 0047 2855 00124 GOTO T5LS ; skip lookup code when disabled 0048 300C 00125 MOVLW High(tab5) 0049 008A 00126 MOVWF PCLATH Message[306]: Crossing page boundary -- ensure page bits are set. ** I believe these 2 messages are OK, since I set PCLATH before the CALL,

004A 24A9 00127 CALL tab5 ; far call 00168 ; -------------------------------- 00169 ; VARIOUS SUBROUTINES

006B 00170 SET_PWM_TIME: 006B 30FF 00171 MOVLW d'255' ; (PR2+1)*Timer2 prescalar value*Tcy 00172 ; 256 * 1 *(4/20e6) or 200nSec Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
  • However, these two messages a possible need for something in addition, and I do not know what - this code is a direct copy of an "example". In previous experiences with "examples" from MicroChip documents, i should expect errors.
  • What fixes are needed?

006C 0092 00173 MOVWF PR2 ; 51.2uSec PWM period or about 19.5kHz 00174 ; Timer 2 ON, fastest scale, 10 bit resolution; MS 8 used

006D 3004 00175 MOVLW 0x04 ; TMR2ON bit; prescale & postscale bits = 0 006E 0092 00176 MOVWF T2CON ; enable TMR2 with prescaler = 1 006F 300F 00177 MOVLW 0x0F ; M0 to M3 all set 0070 0097 00178 MOVWF CCP1CON ; Activate PWM mode Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 0071 1186 00179 BCF TRISB,TRISB3 ; clear for PWM output pin 9 RB3 00180 ; Nothing found in manual about these three. 00181 ; v---INTerrupt CONtrol 0072 170B 00182 BSF INTCON,PEIE ; set bit 6 PEripheral Interrupt Enable 0073 108C 00183 BCF PIR1,TMR2IF ; clear bit 1 Peripheral Interrupt Register 00184 ; TiMeR 2 Interrupt Flag 00185 0074 3000 00186 MOVLW D'0' ; zero PW 0075 0095 00187 MOVWF CCPR1L 0076 0008 00188 RETURN ** END

Thanks for the help.

Reply to
Robert Baer
Loading thread data ...

Yes, those messages are just reminders to be aware of program counter page issues and you have adjusted PCLATH.

CCP1CON is not in the same register bank as TRISB so you should adjust bank select bits. Please read the chip datasheet, see fig 4.3 showing data memory map and 4.2.2.1 about the STATUS register (where the bank select bits are).

piglet

Reply to
piglet

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.