View previous topic :: View next topic |
Author |
Message |
got_bascom
Joined: 23 Feb 2015 Posts: 12
|
Posted: Sun Mar 01, 2015 4:19 pm Post subject: Trouble with data type in Lookup Table |
|
|
Hi gang,
I'm having trouble with figuring out what data type to use for an ultra simple lookup table.
I'm watching the system load values into the variables in the simulator.
Some of them I understand the datatype is understandably over-flowing.
But some of them I don't understand.
For example, when I try to use a Dword or a Double as a data type the compiler indicates "Wrong Data Type" error.
I really feel the Double, or the Dword are the best choice here but the compiler will not allow.
So far, I'm unable to find a data type that can accurately store all of the values in the table.
Must be something simple I'm missing!!
Here is the code:
Dim A As Byte ' used in for loop
'Variables experimental to see how they will store lookup values
Dim Varint As Integer
Dim Varword As Word
Dim Vardword As Dword
Dim Varlong As Long
Dim Varsingle As Single
Dim Vardouble As Double
For A = 0 To 11 Step 1
Varint = Lookup(a , Baudlookup)
Varword = Lookup(a , Baudlookup)
Vardword = Lookup(a , Baudlookup)
Varlong = Lookup(a , Baudlookup)
Varsingle = Lookup(a , Baudlookup)
Vardouble = Lookup(a , Baudlookup)
Next A
END
Baudlookup:
Data 300% , 600% , 1200% , 2400% , 4800% , 9600% , 19200% , 38400% , 57600% , 128000% , 256000% , 115200%
(BASCOM-AVR version : 2.0.7.5 , Latest : 2.0.7.8 ) |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Sun Mar 01, 2015 4:49 pm Post subject: |
|
|
One table can be filled with variables of the same type only. If Word or Integer cannot accommodate value then biger type must be used and then in Help You can read:
Quote: | Integer and Word constants must end with the %-sign.
Long constants must end with the &-sign.
Single constants must end with the !-sign.
Double constants must end with the #-sign. |
|
|
Back to top |
|
|
got_bascom
Joined: 23 Feb 2015 Posts: 12
|
Posted: Sun Mar 01, 2015 5:45 pm Post subject: |
|
|
AH!
Thank you!
Where did you find that in the Help files?
I didn't see that in the "lookup" help text.
But from your post I did find it in the "Data" help text.
Many thanks!! |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sun Mar 01, 2015 8:41 pm Post subject: |
|
|
or use : avrhelp.mcselec.com
Part of the wiki is available in German too. And wiki users with rights can edit the articles. The help is static and an exact copy of the chm/hlp file. _________________ Mark |
|
Back to top |
|
|
PeterM
Joined: 09 Jun 2008 Posts: 118
|
Posted: Sun Mar 01, 2015 9:42 pm Post subject: |
|
|
Quote: | But from your post I did find it in the "Data" help text. |
Its towards the end just before the example under Difference with QB _________________ Peter |
|
Back to top |
|
|
got_bascom
Joined: 23 Feb 2015 Posts: 12
|
Posted: Sun Mar 01, 2015 10:56 pm Post subject: |
|
|
Thanks All!!
My learning curve :-] |
|
Back to top |
|
|
|