Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Code from version bascom 1.11.9.0 does not compile

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Thu Mar 26, 2015 9:45 pm    Post subject: Code from version bascom 1.11.9.0 does not compile Reply with quote

Hi,
I found an FFT program written in Bascom 1.11.9.0 but not compiling in latest version.
http://mdiy.pl/wp-content/uploads/2009/12/spectrum_analyzer_v2_9d.rar
The error code is
Error : 200 Line : 242 .DEF not found [BETA []] , in File : D:\Program Files\Bascom\analizator.V2_9d_16x2.bas
Error : 369 Line : 281 Duplicate label name used by const or variable [SAMPLE_L] , in File : D:\Program Files\Bascom\analizator.V2_9d_16x2.bas
which apparently is related to
Code:
Dim Beta As Iram Byte

and a sub does have same name as a variable SAMPLE_L
Any suggestion how to get it running is very, very welcome.
Regards, Meister

(BASCOM-AVR version : 2.0.7.8 )
Back to top
View user's profile
PeterM

Bascom Member



Joined: 09 Jun 2008
Posts: 118

australia.gif
PostPosted: Fri Mar 27, 2015 7:00 am    Post subject: Reply with quote

Meister

Just briefly looking at the code, I cannot see it used for any registers so remove
the Iram from the Dim
Code:
Dim Beta As Byte


Next rename the routine Sample_h to say Sample_hx
There is also a Gosub Sample_h, change to Gosub Sample_hx

Also so the same for Sample_l

_________________
Peter
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 671

poland.gif
PostPosted: Fri Mar 27, 2015 10:05 am    Post subject: Reply with quote

Code:
Dim Div As Iram Integer At 16


You have to spend a while and fix some typos but the code will work for sure.In codes of this Author often variables are set in fixed locations. So You cannot simply adapt code from (another project) FREQmeter for ATtiny2313 to Atmega because, for example one variable is set At &H71 . Then You must open two datasheets and compare memory maps Smile

I get this analizator working like Include file for bigger project. You can watch this https://www.youtube.com/watch?v=P7805XtjeXU
But I wrote this for someone else and I don`t have hardware like TDA and filters for two ADC inputs when I test this code and making film.
So "No control" is displaying and response for freq will be better if You use dedicated filters.
Back to top
View user's profile Visit poster's website
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Fri Mar 27, 2015 2:34 pm    Post subject: Reply with quote

Thanks for the answers.
@EDC, will your FFT Bascom code be available?
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 671

poland.gif
PostPosted: Fri Mar 27, 2015 3:06 pm    Post subject: Reply with quote

This is only a part adapted to my project. Main file shows how this work.
Back to top
View user's profile Visit poster's website
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Fri Mar 27, 2015 3:55 pm    Post subject: Reply with quote

@EDC:
The Compiler complains:
Error : 200 Line : 101 .DEF not found [BETA []] , in File : analizator.bas
(coming from Dim Beta As Iram 'iram )
Replacing Iram by Byte gives same error.
Do you have suggestion on how to get it running? Thanks...
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4966
Location: Holland

blank.gif
PostPosted: Fri Mar 27, 2015 8:57 pm    Post subject: Reply with quote

instead of the dim beta as iram byte, use the register name like R16
so code becomes :

R16 = I * K
r16=r16 and 31

_________________
Mark
Back to top
View user's profile Visit poster's website
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Fri Mar 27, 2015 11:01 pm    Post subject: Reply with quote

Thanks, Mark.
I replaced all "Beta" by R16 but still get the error
Error : 200 Line : 101 .DEF not found [BETA []] , in File : analizator.bas
Line 101:
R16 = R16 And 31
Regards, Meister
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 4966
Location: Holland

blank.gif
PostPosted: Fri Mar 27, 2015 11:05 pm    Post subject: Reply with quote

you must have missed one. otherwise post the code.
_________________
Mark
Back to top
View user's profile Visit poster's website
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Sat Mar 28, 2015 3:18 pm    Post subject: Reply with quote

Hi Mark,
strange thing is: after saving the changed include-file, no error any more.
Maybe not so strange because the included file always is loaded from disk and not from the IDE.
Thank you for your help.
I will try the code now.
Regards, Meister
Back to top
View user's profile
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Fri Apr 10, 2015 9:39 am    Post subject: Reply with quote

Hello EDC,
thank you very much for posting the FFT code.
What I want to do finally is to get the phases of the spectrum components.
The comments in the file are in Polish and Google translate does not help too much.
Could you point out which arrays are are holding the real and imaginary parts of the spectrum so I could calculate the phases?
Thank you very much.
Regards, Meister
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 671

poland.gif
PostPosted: Fri Apr 10, 2015 1:56 pm    Post subject: Reply with quote

This code works so I never must deeply thinking how this is made Very Happy
Autor can explain this propabbly the best but I translate this to english myself so maybe this can be helpful.
Please write to the author for further clarification.
Back to top
View user's profile Visit poster's website
Meister

Bascom Member



Joined: 27 May 2010
Posts: 314

PostPosted: Fri Apr 10, 2015 2:46 pm    Post subject: Reply with quote

Thank you, EDC.
I will see now if I can find the lines corresponding to Re and Im part of the spectrum.
Best regards, Meister
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum