Jump to content
Sign in to follow this  
mramos

Compiler Gives Success _.bas Has Line Line Of Code

Recommended Posts

I have the program listed at the bottom on this post. I compile it and see the _.bas and seccess Done..

 

The _.bas has one line:

 

#include <basic/system.bas>

 

I figured out I have to do the code in BoostBASICs IDE and then add the file "_.bas" to the MPLABS project. I am OK with that. After I spent time trying to compile the source in MPLABS and nothing worked :huh:, it did not like #pragma, const, dim, etc..

 

So I figured I would compile in BoostBASIC and add _.bas in the project of MPLABS. The code compiles in BoostBASIC, but _.bas has one line, the include?

 

I would think I could edit and compile from MPLABS? As it will shell the BoostBASIC compiler. Maybe a switch to rename the _.bas to the passed programname.bas. But for now, _.BAS will make me happy. :blink: If I could get it to work.

 

Thanks Dave for all your help.

 

#pragma DATA _CONFIG, _WDT_OFF & _CP_OFF & _PWRTE_OFF
#pragma CLOCK_FREQ 4000000
const maxval 50
dim ldr@GPIO.0 as bit
dim led@GPIO.1 as bit
dim relay@GPIO.2 as bit
dim a as char

' init ADC port
sub adc_init()
trisio  = 00000001b          'pin A0 is for analog input
'	adcon1 = 10001110b           'setting for only AN0 and ref of vss and vdd, Fosc/8
adcon0 = 01000001b           'setting for channel AN0 and Fosc/8 for 4Mhz, start AD
end sub

' read ADC port
function adc_read() as byte
adcon0.2 = 1
call delay_ms(1)
adcon0.2 = 0
call delay_ms(1)
adc_read = adresl
end function

' MAIN
Sub main()
   trisio = ( 00000001b )       'pin A0 as input for analog input
   call adc_init()              'initialize the adc port
   
   Do while 1 
	a = call adc_read()
	if a < maxval then
	   relay = 0
	else
	   relay = 1
	end if
	led=1					'light LED					
       call delay_ms(500)      'delay to take readings after 1/2 seconds
	led = 0 				'off LED
       call delay_ms(500)      'delay to take readings after 1/2 seconds
   Loop
end Sub

Share this post


Link to post
Share on other sites

mramos,

I have the program listed at the bottom on this post.  I compile it and see the _.bas  and seccess Done..

 

The _.bas has one line:

 

#include <basic/system.bas>

 

I figured out I have to do the code in BoostBASICs IDE and then add the file "_.bas" to the MPLABS project.  I am OK with that.  After I spent time trying to compile the source in MPLABS and nothing worked :huh:, it did not like #pragma, const, dim, etc.. 

 

So I figured I would compile in BoostBASIC and add _.bas in the project of MPLABS.  The code compiles in BoostBASIC, but _.bas has one line, the include?

As more files are added to a BoostBasic project unders SourceBoost IDE the contents of _.bas file has more added to it.

 

I would think I could edit and compile from MPLABS?  As it will shell the BoostBASIC compiler.  Maybe a switch to rename the _.bas to the passed programname.bas.  But for now, _.BAS  will make me happy.  :blink:  If I could get it to work.

Sorry I don't understand exactly what you are trying to say here.

 

Regards

Dave

Share this post


Link to post
Share on other sites
mramos,
I have the program listed at the bottom on this post.  I compile it and see the _.bas  and seccess Done..

 

The _.bas has one line:

 

#include <basic/system.bas>

 

I figured out I have to do the code in BoostBASICs IDE and then add the file "_.bas" to the MPLABS project.  I am OK with that.  After I spent time trying to compile the source in MPLABS and nothing worked :huh:, it did not like #pragma, const, dim, etc.. 

 

So I figured I would compile in BoostBASIC and add _.bas in the project of MPLABS.  The code compiles in BoostBASIC, but _.bas has one line, the include?

As more files are added to a BoostBasic project unders SourceBoost IDE the contents of _.bas file has more added to it.

 

Oh, so what I got in the _.bas (the one line of C code) is as far along as the project is in reference to building the _.bas file?

 

I thought _.bas was working. It does make a hex file that runs right? I did a BoostBASIC program and compiled and linked and had a hex file I thought?

 

I am lost now. Maybe back to my program that moves the comments from .casm to .asm :blink:

 

I guess I will have to be patient. I thought if it compiled, the _.bas would either be a .CASM type file with comments, or a file that MPLABS uses to show the source and allow debug and assemble.

 

Odd thing is, if I try to link I get a "Couldn't find function/label by name:main". This code was working before (as a 12F683). Off to check the datasheet.

Edited by mramos

Share this post


Link to post
Share on other sites
mramos,
I have the program listed at the bottom on this post.  I compile it and see the _.bas  and seccess Done..

 

The _.bas has one line:

 

#include <basic/system.bas>

 

I figured out I have to do the code in BoostBASICs IDE and then add the file "_.bas" to the MPLABS project.  I am OK with that.  After I spent time trying to compile the source in MPLABS and nothing worked ;), it did not like #pragma, const, dim, etc.. 

 

So I figured I would compile in BoostBASIC and add _.bas in the project of MPLABS.  The code compiles in BoostBASIC, but _.bas has one line, the include?

As more files are added to a BoostBasic project unders SourceBoost IDE the contents of _.bas file has more added to it.

 

Oh, so what I got in the _.bas (the one line of C code) is as far along as the project is in reference to building the _.bas file?

 

I thought _.bas was working. It does make a hex file that runs right? I did a BoostBASIC program and compiled and linked and had a hex file I thought?

 

I am lost now. Maybe back to my program that moves the comments from .casm to .asm <_<

 

I guess I will have to be patient. I thought if it compiled, the _.bas would either be a .CASM type file with comments, or a file that MPLABS uses to show the source and allow debug and assemble.

 

Odd thing is, if I try to link I get a "Couldn't find function/label by name:main". This code was working before (as a 12F683). Off to check the datasheet.

 

Am I correct in my last post? The _.bas part is not complete as of yet?

Share this post


Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...