You have a reserved word as a variable name at bit = 1.
Anyway, I have tested and there is something wrong with the ATMEL code, it works ok with Pic. We will have to investigate. Watch this posting for an update.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I don't have a GLCD module, but it appears that the only significant change you made is to rename BIT to BBit. Are you saying that it works as expected with the renamed variable?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No problem...I just wasn't sure whether you were telling me this is the fix or whether you're still investigating.
Yes, the use of a reserved word was unfortunate. Question: Is there a list of reserved words somewhere, not only in the core, but also the libraries? Also, variables. This has driven me crazy in the past.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-05-19
You can find a pretty complete list of reserved words in the syntax file for whatever IDE you're using. I have a homemade one for my TextPad IDE. In Frank's GBC@Syn, look in the Synwrite/HL subdirectory.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Arduino Uno board with ATMEGA 328P.
Example Code:
cls
locate 0,0
PRINT "Program Started."
wait 1 s
Function Bit_Test as bit
Bit = 1
if Bit = 1 then
Bit_Test = 1
else
Bit_Test = 0
end if
end function
locate 0,0
cls
Dim bb as bit
bb = Bit_Test
If bb = 0 then
Print "0"
else
Print "1"
end if
If the function return type is made BYTE and "Dim bb as bit" is commented out it works; with BIT type it doesn't work.
Is it me, or is there a problem with BIT return types in functions?
Joe
There is something not right.
Change your code to remove using BIT as a variable. I removed the LCD code. You need to add back. :-)
Let me know the results, but, the ASM looks wrong.
~~~~
;chip settings
#chip mega324p, 8
#config osc = int
Dim bb as bit
Dim bb1 as bit
Dim bb2 as bit
Dim bb3 as bit
bb1 = 1
bb2 = 1
bb3 = 0
Function Bit_Test as bit
BBit = 1
if BBit = 1 then
Bit_Test = 1
else
Bit_Test = 0
end if
end function
bb = Bit_Test
If bb = 0 then
else
end if
~~~~~
I'm not quite sure what you're requesting. If I change the function definition to:
Function Bit_Test as byte
and remove:
Dim bb as bit
then it works.
You have a reserved word as a variable name at bit = 1.
Anyway, I have tested and there is something wrong with the ATMEL code, it works ok with Pic. We will have to investigate. Watch this posting for an update.
Thanks
Full code with GCB and ASM for testing.
Anobium
I don't have a GLCD module, but it appears that the only significant change you made is to rename BIT to BBit. Are you saying that it works as expected with the renamed variable?
:-)
I posted the completed code I used to understand the issue. It is not the fix.
However, what I did change was the use of the word 'bit' as a variable as this (for me) is something I would not do.
We are investigating the issue. Sorry, for confusion.
No problem...I just wasn't sure whether you were telling me this is the fix or whether you're still investigating.
Yes, the use of a reserved word was unfortunate. Question: Is there a list of reserved words somewhere, not only in the core, but also the libraries? Also, variables. This has driven me crazy in the past.
You can find a pretty complete list of reserved words in the syntax file for whatever IDE you're using. I have a homemade one for my TextPad IDE. In Frank's GBC@Syn, look in the Synwrite/HL subdirectory.