Q: PIC error messages

Snippets from assembled code:

LOC OBJECT CODE LINE SOURCE TEXT VALUE

0073 00178 SET_PWM_TIME: 0073 30FF 00179 MOVLW d'255' ; (PR2+1)*Timer2 prescalar value*Tcy 00180 ; 256 * 1 *(4/20e6) or 200nSec Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 0074 0092 00181 MOVWF PR2 ; 51.2uSec PWM period or about 19.5kHz 00182 ; Timer 2 ON, fastest scale, 10 bit resolution; MS 8 used 0075 3004 00183 MOVLW 0x04 ; TMR2ON bit; prescale & postscale bits = 0 0076 0092 00184 MOVWF T2CON ; enable TMR2 with prescaler = 1 0077 300F 00185 MOVLW 0x0F ; M0 to M3 all set 0078 0097 00186 MOVWF CCP1CON ; Activate PWM mode Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct. 0079 1186 00187 BCF TRISB,TRISB3 ; clear for PWM output pin 9 RB3 00188 ; Nothing found in manual about these three. 00189 ; v---INTerrupt CONtrol 007A 170B 00190 BSF INTCON,PEIE ; set bit 6 PEripheral Interrupt Enable 007B 108C 00191 BCF PIR1,TMR2IF ; clear bit 1 Peripheral Interrupt Register 00192 ; TiMeR 2 Interrupt Flag 00193 007C 3000 00194 MOVLW D'0' ; zero PW 007D 0095 00195 MOVWF CCPR1L 007E 0008 00196 RETURN ** How do i fix those 302 messages?

  • Also, I assume the 306 message below can be safely ignored.

003A 1B86 00110 T4L: BTFSC PORTB,K1.4 ; Wave enable input, 0 => enabled 003B 284C 00111 GOTO T5L ; skip lookup code when disabled 003C 3009 00112 MOVLW High(tab4) 003D 008A 00113 MOVWF PCLATH ; may be in a different 2K block Message[306]: Crossing page boundary -- ensure page bits are set. 003E 21A9 00114 CALL tab4 ; far call 003F 07A8 00115 ADDWF amplo ; add lookup value to amplitude

Help please?

Reply to
Robert Baer
Loading thread data ...

Those troublesome PIC bank select bits are something you'll need to read up about the topic from the data sheets and/or application notes. From my vague memory of an old project of mine, bank control is used to tell the machine which bank from which to execute instructions and access RAM or registers. You'll need to plan the layout of your code and data in the various banks when your code and/or data grows beyond the limit of what bank 0 can hold.

JJS

Reply to
John Speth

Thanks.

Reply to
Robert Baer

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.