I tried to ported the code to GCBasic but getting the following error. Anyone like to help.
makeHEX.bat
Great Cow Basic Pre-processing (v0.98.01)
Great Cow BASIC (0.98.01 2017-10-27)
Compiling ...
Done
Assembling program ...
An error has been found:
Error: GCASM: Symbol 13.0 has not been defined
The message has been logged to the file Errors.txt.
Here is the code.
'' Firmware for PIC16F1827
''
''
; ----- Configuration
' OSC=LP,XT,HS,EXTRC,INTOSC,ECL,ECM,ECH
' WDTE=OFF,SWDTEN,NSLEEP,ON
' PWRTE=ON,OFF
' MCLRE=OFF,ON
' CP=ON,OFF
' CPD=ON,OFF
' BOREN=OFF,SBODEN,NSLEEP,ON
' CLKOUTEN=ON,OFF
' IESO=OFF,ON
' FCMEN=OFF,ON
' WRT=ALL,HALF,BOOT,OFF
' PLLEN=OFF,ON
' STVREN=OFF,ON
' BORV=HI,LO,19
' LVP=OFF,ON
#chip 16f1827, 16
'#config INTOSC_OSC_NOCLKOUT
' #config OSC = RC, BODEN = OFF
#config WDTE = OFF
#config PWRTE = ON
#config LVP = OFF
#config MCLRE = ON
#config CP = ON
#config CPD = ON
#config BOREN = ON
#config IESO = ON
#config FCMEN = ON
#config BORV = HI ' 2.5 V
#config WRT = ALL
; ----- Constants
#define THRESHOLD_H 15
DIR PORTB OUT
; ----- Variables
DIM cap as Word
DIM flag as Bit
; ----- Main body of program commences here.
cap = 0
flag = 0
' OSCCON = 0x70 ; Internal 8MHz clock
ANSELA = 0xff
ANSELB = 0
TRISA = 0xff
TRISB = 0
PORTA = 0
PORTB = 0
CPSCON0 = 0b00001100 ; 11 = Oscillator is in high range. Charge/discharge current is nominally 18 uA.
CPSCON1 = 0 ; Port select
T1CON = 0b11000001
TMR1GE = 0
TMR1L = 0
TMR1H = 0
CPSON = 1
Wait 100 ms
Do
CPSCON1 = 0x00
Wait 16 ms
dokunmatik
If (flag = 1) Then
PORTB.RB0 = PORTB.RB0 xor PORTB.RB0
flag = 0
Wait 3000 ms
End If
CPSCON1 = 0x01
Wait 16 ms
dokunmatik
If (flag = 1) Then
PORTB.RB1 = PORTB.RB1 xor PORTB.RB1
flag = 0
Wait 3000 ms
End If
CPSCON1 = 0x02
Wait 16 ms
If (flag = 1) Then
PORTB.RB2 = PORTB.RB2 xor PORTB.RB2
flag = 0
Wait 3000 ms
End If
CPSCON1 = 0x03;
Wait 16 ms
If (flag = 1) Then
PORTB.RB3 = PORTB.RB3 xor PORTB.RB3
flag = 0
Wait 3000 ms
End If
loop
End
; ----- Support methods. Subroutines and Functions
Sub dokunmatik
CPSON = 0
cap = FnLSL(TMR1H, 8)
cap = cap + TMR1L
cap = FnLSR(cap, 8)
If (cap > THRESHOLD_H) Then
flag = 0 ; Button Not Pressed
Else
flag = 1 ; Button Pressed
End If
TMR1L = 0
TMR1H = 0
CPSON = 1
End sub
I hope that someone will add this to GCBasic library also.
With kind regards,
Awais
Last edit: Awais 2017-11-23
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Really good see you coming across to use Great Cow BASIC.
Really simple error during the port. The addressing on PortB is incorrect. I think if you globaly replace .RB for . will sort the port addressing out.
PORTB.RB0 = PORTB.RB0 xor PORTB.RB0
But, what was the original code? XOR one bit with the same bit? Maybe I do not understand but this is a NOT? This is why the error message is happening the linked does not know what to do.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Anobium for pointing out the .RB replacement. I tried but got same result with error.
Original code is different but I want to toggle the output bit, so I used XOR. When the code is
PORTB.0 = NOT PORTB.0
hex file generated successfully.
10.1 Sec. Compiler Version: 0.98.01 2017-10-27 Program Memory: 254/4096 words (6.2%) RAM: 16/384 bytes (4.17%) Chip: 16F1827
Hello,
This is Awais. First of all congratulation to all the contributing members who shared their efforts in terms of GCBasic.
I found mtouch example using mikroc, CCS and Proton Basic on the following link.
https://pwmccs.wordpress.com/2016/01/05/pic16f1827-dokunmatik-mtouch-kullanimi/
I tried to ported the code to GCBasic but getting the following error. Anyone like to help.
makeHEX.bat
Great Cow Basic Pre-processing (v0.98.01)
Great Cow BASIC (0.98.01 2017-10-27)
Compiling ...
Done
Assembling program ...
An error has been found:
Error: GCASM: Symbol 13.0 has not been defined
The message has been logged to the file Errors.txt.
Here is the code.
I hope that someone will add this to GCBasic library also.
With kind regards,
Awais
Last edit: Awais 2017-11-23
Really good see you coming across to use Great Cow BASIC.
Really simple error during the port. The addressing on PortB is incorrect. I think if you globaly replace
.RB
for.
will sort the port addressing out.But, what was the original code? XOR one bit with the same bit? Maybe I do not understand but this is a NOT? This is why the error message is happening the linked does not know what to do.
Thanks Anobium for pointing out the .RB replacement. I tried but got same result with error.
Original code is different but I want to toggle the output bit, so I used XOR. When the code is
PORTB.0 = NOT PORTB.0
hex file generated successfully.
10.1 Sec. Compiler Version: 0.98.01 2017-10-27 Program Memory: 254/4096 words (6.2%) RAM: 16/384 bytes (4.17%) Chip: 16F1827
I found the same issue in this post.
https://sourceforge.net/p/gcbasic/discussion/596084/thread/a7338360/
Your code is now correct using the NOT
The post you refer to was a syntax error not the issue you have. I did not bother to reply as the poster moved off the syntax error issue raised. .
is giving error. Can you please have a look?
ok. Looking. The issue is the error message?