Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

assembly code bankselect problem

Status
Not open for further replies.

ceibawx

Junior Member level 2
Joined
Oct 13, 2008
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
chongqing,China
Activity points
1,606
Dear Friend,

I compiled the code followed. It did pass simulation last Friday. But today, problem appeared.-------------------------------------------------------
Message[302] C:\DOCUMENTS AND SETTINGS\GRACEE\MY DOCUMENTS\PNS2\PNS2.ASM 62 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\DOCUMENTS AND SETTINGS\GRACEE\MY DOCUMENTS\PNS2\PNS2.ASM 63 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\DOCUMENTS AND SETTINGS\GRACEE\MY DOCUMENTS\PNS2\PNS2.ASM 64 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\DOCUMENTS AND SETTINGS\GRACEE\MY DOCUMENTS\PNS2\PNS2.ASM 67 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\DOCUMENTS AND SETTINGS\GRACEE\MY DOCUMENTS\PNS2\PNS2.ASM 71 : Register in operand not in bank 0. Ensure that bank bits are correct.
Error[113] C:\DOCUMENTS AND SETTINGS\GRACEE\MY DOCUMENTS\PNS2\PNS2.ASM 122 : Symbol not previously defined (LoopThree)
Halting build on first failure as requested.
I don't think that the error exists in my code. But the simulation said like this.
Can you help me to see the error in the code?

Bankselect there are two kinds of method. One is use "banksel", for example, "banksel TXSTA" means that code works into bank1. The other is use "bsf". "BSF STATUS,5" and "BCF STATUS,6" can shift into bank1. I didn't write wrong. why simulation didn't pass.

The second is "LoopThree". I think that no problem. why it is also not passed in simulation?


;**********************************************************************


list p=16F877 ; list directive to define processor
#include <p16f877.inc> ; processor specific variable definitions


; '__CONFIG' directive is used to embed configuration data within .asm file.
; The labels following the directive are located in the respective .inc file.
; See respective data sheet for additional information on configuration word.

; __CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC
; & _WRT_OFF & _LVP_OFF & _CPD_OFF

;******************DAC to PIC*************************************8
#define FS PORTC,1 ; FS for TLV5614
#define SCLK PORTC,2 ; SCLK for TLV5614
#define DIN PORTC,3 ;Data for TLV5614
;*

;C0 IS CLOCK INPUT
;C1 IS BIT DATA INPUT
;***** VARIABLE DEFINITIONS

w_temp EQU 0x7D ; variable used for context saving
status_temp EQU 0x7E ; variable used for context saving
pclath_temp EQU 0x7F ; variable used for context saving

BitCount EQU 0x38
ByteCount EQU 0x39
DeciCount EQU 0x40
DinB0 EQU 0x60 ; MCP3302, MCP3204, & PIC16F767 ADC MSB
DinB1 EQU 0x61 ; ADC Least Significant Byte
DinB2 EQU 0x62 ; data received
DinB3 EQU 0x63 ; data to transmit
DinB4 EQU 0x64 ; General Purpose Temp Register
DinB5 EQU 0x65 ; Counts what digit of the phone number needs to be dialed.
DinB6 EQU 0x66 ; counter to determine 32b sine wave step
DinB7 EQU 0x67 ; ouput register for the sine wave generator
;**********************************************************************
ORG 0x0000 ; processor reset vector
goto Main ; go to beginning of program
;**********************************************************************
; isr code can go here or be located as a call subroutine elsewhere

ORG 0x0004 ; interrupt vector location
MOVWF w_temp ; save off current W register contents
movf STATUS,w ; move status register into W register
MOVWF status_temp ; save off contents of STATUS register
movf PCLATH,w ; move pclath register into w register
MOVWF pclath_temp ; save off contents of PCLATH register

movf pclath_temp,w ; retrieve copy of PCLATH register
MOVWF PCLATH ; restore pre-isr PCLATH register contents
movf status_temp,w ; retrieve copy of STATUS register
MOVWF STATUS ; restore pre-isr STATUS register contents
swapf w_temp,f
swapf w_temp,w ; restore pre-isr W register contents
retfie ; return from interrupt
Main:
BSF STATUS,5
BCF TRISC,1 ;c6=0 as output
BCF TRISC,2 ;c0=0 as output
BCF TRISC,3 ;c1=0 as output
; UART module setup
MOVLW 15 ; rs232 baud as 57600
MOVWF SPBRG ; Enable SPBRG register Baud Rate
MOVLW b'00101110' ; UART Asynchronous mode
; 8-bit transmission
; High Baud Rate
MOVWF TXSTA ; Enable Transmission
BCF STATUS,5

MOVLW b'10010000' ; Enable 8-bit reception
MOVWF RCSTA

;****************convert four analog value into binary for DAC_Din**********************
;stored in PIC MEMORY B0~B7,
MOVLW b'00011001' ;,channelA,01;2, 2495
MOVWF 0x60
MOVLW b'10111111' ;
MOVWF 0x61
MOVLW b'01011011' ;channelB,01;2.32, 2852
MOVWF 0x62
MOVLW b'00100100' ;
MOVWF 0x63
MOVLW b'10010011' ;channelC,01;0.765, 940
MOVWF 0x64
MOVLW b'10101100' ;
MOVWF 0x65
MOVLW b'11011000' ;channelD,01;1.7, 2090
MOVWF 0x66
MOVLW b'00101010' ;
MOVWF 0x67

;**********************TLV5614***************************************
;CS low,delay, FS low, delay; ;SCLK LOW THEN HIGH
;until one byte is transmit; ;then the next byte is transmit.
;from MSB bit to LSB bit. ;16bits are transmit; ;then FS is high; ; CS is high
WriteToMCP492X:
MOVLW 0x60
MOVWF FSR
MOVLW 0x04
MOVWF DeciCount
OneChannel:
MOVLW 0x02
MOVWF ByteCount
DinTrans:
BANKSEL PORTC
CLRF PORTC
BCF FS ;FS is low
NOP
LoopOne:
MOVLW 0x08
MOVWF BitCount
LoopTwo:
BSF SCLK ;SCLK idles low.; Data output after rising edge of SCK
; 8bit rotate left
;first check the bit value.use BSF when 1;use BCF if 0.
BCF SCLK
BTFSS INDF,7
goto LoopThree ;!=1
BSF DIN ;=1
RLF INDF,1
DECFSZ BitCount,1
goto LoopTwo
INCF FSR,1
DECFSZ ByteCount,1
goto LoopOne
BSF FS
NOP
DECFSZ DeciCount,1
goto OneChannel
END
LoopThree:
BCF DIN
RLF INDF,1
DECFSZ BitCount,1
goto LoopTwo ;8bits is not finished
INCF FSR,1
DECFSZ ByteCount,1 ;8bits is finished.
goto LoopOne
BSF FS
NOP
DECFSZ DeciCount,1
goto OneChannel
END ;END code

;*************Convert decimal to binary*********************************

;********************************************************************/
 

ceibawx said:
Bankselect there are two kinds of method. One is use "banksel", for example, "banksel TXSTA" means that code works into bank1. The other is use "bsf". "BSF STATUS,5" and "BCF STATUS,6" can shift into bank1. I didn't write wrong. why simulation didn't pass.
You will always get this message for any variable not in bank 0.
This message 302 was added to remind you to check your code, particularly code in banks other than 0.
You can use the errorlevel command to turn this messages off.
ceibawx said:
The second is "LoopThree". I think that no problem. why it is also not passed in simulation?
ceibawx said:
END
LoopThree:
To remove 'END' above the 'LoopThree'.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top