BasicMicro - Forums

www.basicmicro.com
It is currently Tue Feb 07, 2012 3:05 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: project won't build, program or debug studio 1.0.0.32
PostPosted: Mon Aug 23, 2010 8:18 am 
Offline
Citizen

Joined: Tue Aug 10, 2010 3:42 pm
Posts: 15
main
;*****declaration*****

;generate initpulse @10hertz
;senser return echo is 0.9 ms per foot
;adjust deadband up to 20" via potentiometer
;adjust span 20" via potentiometer
;use deadband and span to scale the pwm output duty cycle
init_signal var bit
insignal var bit
analog1 var word
analog2 var word
outsignal var word
distance var word
deadband var word
span var word
spaninches var word
deadbandinches var word
dutyadj var word
dutypercentage var byte
dutyrange var word
duration var word
duty var byte
deadband_distance var word
span_distance var word
deadband_inches var word
span_inches var word
;setup sensor distance resolution with adc adjustment

adin,p8,deadband ;minimum deadband 6"
adin,p9,span ;max span 20"
init_signal = P0 ;setup after to generate every 10 hertz
high init_signal
count=(count+1)
insignal = irq1int,high
enable insignal
oninterrupt,calcdistance

gosub calcspan
gosub dutycalc
duration=5000
pwm p12,duty,duration

calcdistance
distance = count\0.075 ;0.9 ms/ft=0.075 ms/inch
return



calcdeadband ;pot starts at 6" to 20" 14" range analog scale
deadband_inches =deadband\16
return

calcspan ; pot starts at 6" to 20"
span_inches =span\16
return


dutycalc

dutyrange = span_inches - deadband_inches
if span<=deadband then
dutypercentage = 0
elseif
dutypercentage = (distance\dutyrange)*100
duty=(255*(dutypercentage\100))
endsub
end


programming this code when I click build so I can get an error check nothing happens???
same with debug or build????
Checked to see if the program can see the processor it can.
Any idea????????


Top
 Profile  
 
 Post subject: Re: project won't build, program or debug studio 1.0.0.32
PostPosted: Mon Aug 23, 2010 8:38 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 788
Location: Temecula, CA
Well, first you have a comma right after your adin commands:

adin,p8,deadband ;minimum deadband 6"

should be

adin p8,deadband ;minimum deadband 6"

Also what processor are you using?

Also you have this statement:
Code:
count=(count+1)

1. you don't define count
2. count is a reserved word.

So you need to change the variable name count to something else(I recommend counter) and you need to define what type of variable it is:
Code:
counter var long

Then there is this:

Code:
insignal = irq1int,high
enable insignal
oninterrupt,calcdistance


What are you trying to do here. This isn't even remoetly valid in our Basic. Let me know what you are trying to do and I can show you how(if it's possible).

In Studio the PWM command has been changed to give more functionality. The old syntax:
Code:
pwm p12,duty,duration

has been replaced with the new syntax:
Code:
pwm p12,255,duty,duration


pwm pin,period,duty,cycles

This line and several others is using the wrong symbold for divide:
Code:
distance = counter\0.075 ;0.9 ms/ft=0.075 ms/inch

should be
Code:
distance = TOINT(TOFLOAT(counter)/0.075) ;0.9 ms/ft=0.075 ms/inch


You have a typo in this line and the divide symbol is incorrect:
Code:
deadband_inches =deadband\16

should be
Code:
deadbandinches =deadband/16


This line:
Code:
elseif

should be
Code:
else


This line
Code:
endsub

should be
Code:
endif
return


My guess is you are coming from a different Basic language.

When you installed 1.0.0.32 did you uninstall any previous versions first? Also I suggest you get the latest release from the news section in these forums.

_________________
Nathan Scherdin
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
 Post subject: Re: project won't build, program or debug studio 1.0.0.32
PostPosted: Mon Aug 23, 2010 1:02 pm 
Offline
Citizen

Joined: Tue Aug 10, 2010 3:42 pm
Posts: 15
Acidtech wrote:
Well, first you have a comma right after your adin commands:

adin,p8,deadband ;minimum deadband 6"

should be

adin p8,deadband ;minimum deadband 6"

Also what processor are you using?

Also you have this statement:
Code:
count=(count+1)

1. you don't define count
2. count is a reserved word.

So you need to change the variable name count to something else(I recommend counter) and you need to define what type of variable it is:
Code:
counter var long

Then there is this:

Code:
insignal = irq1int,high
enable insignal
oninterrupt,calcdistance


What are you trying to do here. This isn't even remoetly valid in our Basic. Let me know what you are trying to do and I can show you how(if it's possible).

In Studio the PWM command has been changed to give more functionality. The old syntax:
Code:
pwm p12,duty,duration

has been replaced with the new syntax:
Code:
pwm p12,255,duty,duration


pwm pin,period,duty,cycles

This line and several others is using the wrong symbold for divide:
Code:
distance = counter\0.075 ;0.9 ms/ft=0.075 ms/inch

should be
Code:
distance = TOINT(TOFLOAT(counter)/0.075) ;0.9 ms/ft=0.075 ms/inch


You have a typo in this line and the divide symbol is incorrect:
Code:
deadband_inches =deadband\16

should be
Code:
deadbandinches =deadband/16


This line:
Code:
elseif

should be
Code:
else


This line
Code:
endsub

should be
Code:
endif
return


My guess is you are coming from a different Basic language.

When you installed 1.0.0.32 did you uninstall any previous versions first? Also I suggest you get the latest release from the news section in these forums.


the version we have is a single instalation no previous version.

I corrected the code with the corrections you mentioned then realized I culd simplify several of the steps. So re-wrote the code from scratch.

Currently at the stage of building the circuitry to test the code parameters and timing out.
The one instruction you mentioned with the insignal = irq1int etc was an example I had pulled from another micro processor. Thanks for pointing out that interupts cannot be directly handled on the nano18 processor. I sent the email to you for further information on handling interupts.


Top
 Profile  
 
 Post subject: Re: project won't build, program or debug studio 1.0.0.32
PostPosted: Tue Aug 24, 2010 9:14 am 
Offline
Site Admin
User avatar

Joined: Thu Mar 01, 2001 11:00 am
Posts: 788
Location: Temecula, CA
Ok. I replied to the email. Ya, have to be carefull not to confuse different versions of basic for different processors. :)

_________________
Nathan Scherdin
Basic Micro - Robotic Technology Evolved


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO