Hey everyone, this is my first post here -- I'm extreemly new to electronics and microcontrollers, I built a simple PIC circuit that I think should work, I used a really cheap programmer (CAPR-PI) to program the chip, it has 5 pins that go to the circuit and it was able to program and verify the device so that's why I think my circuit is electronically ok, I've also done a multimeter tests on most of the connections for continuity... I think the actual problem is probably with the assembly program I wrote....
Acording to the data sheets supplied by microchip, bits 5 and 6 of the status register determine what bank is active. but the compiler complains even after setting/clearing certain bits that I'm doing things with address space that's outside of bank 0 -- even tho at this point it should be in bank 1 (trying to set TRISD, and TRISE to 0 for output)
I'm having some basic compiler issues I guess is what it comes down to, at first it wouldn't even produce a .hex file, now it produces one but it still complains about a few things:
Message[302] C:\PIC\PROJECTS\COUNTER\COUNTER.ASM 35 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\PIC\PROJECTS\COUNTER\COUNTER.ASM 36 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[205] C:\PIC\PROJECTS\COUNTER\COUNTER.ASM 70 : Found directive in column 1. (end)
my short asm code is as follows:
--------------------------------------------------------------------------------------------
;TEST Program for the PIC Microcontroller 16F877a
;Michael Jensen 2004
STATUS equ 03h
TRISA equ 85h
TRISB equ 86h
TRISC equ 87h
TRISD equ 88h
TRISE equ 89h
PORTA equ 05h
PORTB equ 06h
PORTC equ 07h
PORTD equ 08h
PORTE equ 09h
;BANK 0 VARIABLES
COUNT equ 20h ; General Purpose registers that are
COUNT2 equ 21h ; used by the Delay Subroutine
OUT1 equ 22h ; Will Go out PORT D
OUT2 equ 23h ; Will Go out PORT E
;TRISA & B are in BANK 1, PORTA & B are in BANK 0
bcf STATUS,6 ;As long as we leave STATUS <6> at 0
;We should be able to swap between
;Bank 0 and 1 by setting/clearing
;STATUS <5>
bsf STATUS,5 ;Move to bank 1 (set STATUS bit 5)
clrf TRISD ;PORTD = OUTPUT <LINE 35>
clrf TRISE ;PORTE = OUTPUT <LINE 36>
bcf STATUS,5 ;Move to bank 0 (clear STATUS bit 5)
clrf COUNT
clrf COUNT2
clrf OUT1
clrf OUT2
Start:
movlw OUT1
movwf PORTD
movlw OUT2
movwf PORTE
call Delay
incfsz OUT1, 1
goto Start
incf OUT2, 1
goto Start
Delay:
decfsz COUNT, 1
goto Delay
decfsz COUNT2, 1
goto Delay
return
end ; The compiler seems to like having this more than not...
--------------------------------------------------------------------------------------------
If anyone could help with with these compiler messages I would appreciate it...
Mike.
Acording to the data sheets supplied by microchip, bits 5 and 6 of the status register determine what bank is active. but the compiler complains even after setting/clearing certain bits that I'm doing things with address space that's outside of bank 0 -- even tho at this point it should be in bank 1 (trying to set TRISD, and TRISE to 0 for output)
I'm having some basic compiler issues I guess is what it comes down to, at first it wouldn't even produce a .hex file, now it produces one but it still complains about a few things:
Message[302] C:\PIC\PROJECTS\COUNTER\COUNTER.ASM 35 : Register in operand not in bank 0. Ensure that bank bits are correct.
Message[302] C:\PIC\PROJECTS\COUNTER\COUNTER.ASM 36 : Register in operand not in bank 0. Ensure that bank bits are correct.
Warning[205] C:\PIC\PROJECTS\COUNTER\COUNTER.ASM 70 : Found directive in column 1. (end)
my short asm code is as follows:
--------------------------------------------------------------------------------------------
;TEST Program for the PIC Microcontroller 16F877a
;Michael Jensen 2004
STATUS equ 03h
TRISA equ 85h
TRISB equ 86h
TRISC equ 87h
TRISD equ 88h
TRISE equ 89h
PORTA equ 05h
PORTB equ 06h
PORTC equ 07h
PORTD equ 08h
PORTE equ 09h
;BANK 0 VARIABLES
COUNT equ 20h ; General Purpose registers that are
COUNT2 equ 21h ; used by the Delay Subroutine
OUT1 equ 22h ; Will Go out PORT D
OUT2 equ 23h ; Will Go out PORT E
;TRISA & B are in BANK 1, PORTA & B are in BANK 0
bcf STATUS,6 ;As long as we leave STATUS <6> at 0
;We should be able to swap between
;Bank 0 and 1 by setting/clearing
;STATUS <5>
bsf STATUS,5 ;Move to bank 1 (set STATUS bit 5)
clrf TRISD ;PORTD = OUTPUT <LINE 35>
clrf TRISE ;PORTE = OUTPUT <LINE 36>
bcf STATUS,5 ;Move to bank 0 (clear STATUS bit 5)
clrf COUNT
clrf COUNT2
clrf OUT1
clrf OUT2
Start:
movlw OUT1
movwf PORTD
movlw OUT2
movwf PORTE
call Delay
incfsz OUT1, 1
goto Start
incf OUT2, 1
goto Start
Delay:
decfsz COUNT, 1
goto Delay
decfsz COUNT2, 1
goto Delay
return
end ; The compiler seems to like having this more than not...
--------------------------------------------------------------------------------------------
If anyone could help with with these compiler messages I would appreciate it...
Mike.