As reported in the first lines of "GCbasic Command Guide.doc" I tried to insert PIC assembly mnemonics. The mnemonics is passed straight through to the assembly but as a label, the mnemonics is in the first column of the line, so it acts like a label.
The version of gcbasic used is 0.9.0.4
regards
stefano
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What mnemonics are you using? GCBASIC should recognize all of the ones in the PIC datasheet. When it puts them into the assembly, it is supposed to format them like this:
btfsc STATUS,Z
bsf PORTB,1
That is, they should be in lower case and have a space or tab in front of them.
Even if the mnenomics are not being formatted properly, gputils/MPASM should still be able to assemble the program. Is a .hex file still being produced?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thank you for your answer the code that I tested is this:
'prova04
#chip 16F84A, 4
#mem 68
DIR PORTA b'11111111' 'PORTA as input
DIR PORTB b'00000000' 'PORTB as output
Main:
bsf PORTB,1
SET PORTB.2 1
clrw
goto Main
-----------------------
the assembler produced from gcbasic is this:
;Program compiled by GCBASIC, which is the best language for PICs, ever!
;Something not working? Email me at hconsidine@bigpond.com
;GCBASIC Version: 0.9 9/9/2006
;Start of the main program
movlw B'11111111'
banksel TRISA
movwf TRISA
movlw B'00000000'
movwf TRISB
MAIN
banksel PORTB
bsf PORTB,1
bsf PORTB,2
CLRW
goto MAIN
BASPROGRAMEND
sleep
goto $
END
------------------
the instruction "bsf PORTB,1" is in the right position, but the instruction "clrw" (Clear W) now is a label.
In output I get the hex file, because a label is not error for the compiler.
I use nospace in front of "bsf PORTB,1" and a space in front of "clrw".
Regards
stefano
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That is a bug in GCBASIC - thanks for telling me about it. GCBASIC doesn't seem to recognize assembly mnemonics unless they have parameters (which clrw doesn't). This bug will be fixed in the next version, which should be out in a day or two.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As reported in the first lines of "GCbasic Command Guide.doc" I tried to insert PIC assembly mnemonics. The mnemonics is passed straight through to the assembly but as a label, the mnemonics is in the first column of the line, so it acts like a label.
The version of gcbasic used is 0.9.0.4
regards
stefano
What mnemonics are you using? GCBASIC should recognize all of the ones in the PIC datasheet. When it puts them into the assembly, it is supposed to format them like this:
btfsc STATUS,Z
bsf PORTB,1
That is, they should be in lower case and have a space or tab in front of them.
Even if the mnenomics are not being formatted properly, gputils/MPASM should still be able to assemble the program. Is a .hex file still being produced?
thank you for your answer the code that I tested is this:
'prova04
#chip 16F84A, 4
#mem 68
DIR PORTA b'11111111' 'PORTA as input
DIR PORTB b'00000000' 'PORTB as output
Main:
bsf PORTB,1
SET PORTB.2 1
clrw
goto Main
-----------------------
the assembler produced from gcbasic is this:
;Program compiled by GCBASIC, which is the best language for PICs, ever!
;Something not working? Email me at hconsidine@bigpond.com
;GCBASIC Version: 0.9 9/9/2006
;********************************************************************************
;Set up the assembler options (Chip type, clock source, other bits and pieces)
LIST p=16F84A, r=DEC
#include <P16F84A.inc>
__CONFIG _HS_OSC & _WDT_OFF
;********************************************************************************
;********************************************************************************
;Jump to initialisation code when PIC is reset
ORG 0
goto SystemInitialise
;********************************************************************************
;Interrupt routine
ORG 4
INTERRUPT
;Interrupt code will be inserted here in a later version
retfie
;********************************************************************************
;Various initialisation routines, automatically called by GCBASIC
SystemInitialise
;********************************************************************************
;Start of the main program
movlw B'11111111'
banksel TRISA
movwf TRISA
movlw B'00000000'
movwf TRISB
MAIN
banksel PORTB
bsf PORTB,1
bsf PORTB,2
CLRW
goto MAIN
BASPROGRAMEND
sleep
goto $
END
------------------
the instruction "bsf PORTB,1" is in the right position, but the instruction "clrw" (Clear W) now is a label.
In output I get the hex file, because a label is not error for the compiler.
I use nospace in front of "bsf PORTB,1" and a space in front of "clrw".
Regards
stefano
That is a bug in GCBASIC - thanks for telling me about it. GCBASIC doesn't seem to recognize assembly mnemonics unless they have parameters (which clrw doesn't). This bug will be fixed in the next version, which should be out in a day or two.