Shop OBEX P1 Docs P2 Docs Learn Events
So, what about xbasic? — Parallax Forums

So, what about xbasic?

RsadeikaRsadeika Posts: 3,837
edited 2014-01-19 23:03 in Propeller 1
Starting out the new year, I am thinking maybe I should try something new. I am not sure how I missed xbasic back in 2011 when it was released, I cannot remember if PropGCC was also released at that time or what else was going on. xbasic is the the only language, that is offered for the Propeller, that I have not tried yet, so maybe it should get a chance.

A couple of things, right off the bat, in favor for xbasic, it has its own IDE, which sort of resembles an IDE that I am used too. And it resembles a typical basic format, you do not have to have a specific "START" location, or any specific programming structure requirements. Since it is not widely used at this time, it does lack or needs to be updated to today's standards, like having access to FDS, SD, XBee, ..., and other modules that are available at this time.

Since I just did a "hello, world" program in xbasic, I am a complete beginner at this. I did notice that you can start and/or have COGs, I wonder if these can be run in extended/expanded RAM? I also did notice that there is no standard commands for, lets say, doing the familiar blinker program. For a blinker program you would need, high, low, and waitMS commands, not sure how those would be done, in assembly per chance?

So, maybe some of the people that are very familiar with xbasic can jump in, and give there insight as to what xbasic is all about, again, in the year 2014. At this point it seems that David Betz, the author, is not bogged down, and just might be able to stand behind and really support xbasic.

Ray
«13456789

Comments

  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-10 05:41
    Rsadeika wrote: »
    At this point it seems that David Betz, the author, is not bogged down, and just might be able to stand behind and really support xbasic.

    That's rather presumptious to assume what David has on his plate, personally, professionally or with his own hobby free time. To call him out publicly on the forum and tell him he has time to stand up and support something he wrote for his own reasons is a bit bold. The majority of the work on this Forum that is shared with the community is created out of love and passion and interest. Just as you have hopped from language to language and project to project to project, others deserve the same freedom to lose passion and change interests.

    When you have problems or concerns with something you are using, post and ask questions. If the author or anyone else is interested, your questions will be answered. There is no obligation for anyone to support or continue development in something that they wrote as you are requesting.

    EDIT: Ignore my grumpiness about time demands - I appologize if I offended.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-01-10 06:13
    That's rather presumptious...
    I was not trying to presume anything, I was just trying to make a general observation. David Betz seems to be very generous with his time in answering questions. And stating his name, I was just trying to credit him with being the author of xbasic, maybe nobody knows that, alright. Relax, I am not calling anybody out, and not making any presumptions about what he may or may not do. I am sure that if he does not have the time or does not want too pursue xbasic any further, then I am sure that he will state it up front, so again, relax.

    Ray
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-10 06:23
    Rsadeika wrote: »
    Starting out the new year, I am thinking maybe I should try something new. I am not sure how I missed xbasic back in 2011 when it was released, I cannot remember if PropGCC was also released at that time or what else was going on. xbasic is the the only language, that is offered for the Propeller, that I have not tried yet, so maybe it should get a chance.

    A couple of things, right off the bat, in favor for xbasic, it has its own IDE, which sort of resembles an IDE that I am used too. And it resembles a typical basic format, you do not have to have a specific "START" location, or any specific programming structure requirements. Since it is not widely used at this time, it does lack or needs to be updated to today's standards, like having access to FDS, SD, XBee, ..., and other modules that are available at this time.

    Since I just did a "hello, world" program in xbasic, I am a complete beginner at this. I did notice that you can start and/or have COGs, I wonder if these can be run in extended/expanded RAM? I also did notice that there is no standard commands for, lets say, doing the familiar blinker program. For a blinker program you would need, high, low, and waitMS commands, not sure how those would be done, in assembly per chance?

    So, maybe some of the people that are very familiar with xbasic can jump in, and give there insight as to what xbasic is all about, again, in the year 2014. At this point it seems that David Betz, the author, is not bogged down, and just might be able to stand behind and really support xbasic.

    Ray
    Hi Ray,

    I pretty much stopped working on xbasic when Steve moved from working on an xbasic IDE to working on SimpleIDE. He was pretty much the only user of xbasic and it didn't seem to make sense to put a lot more effort into it. Recently I've revisited it a bit because I wanted to use its PASM virtual machine with my ebasic interpreter to speed it up and to use less hub memory for the VM code. That is almost working now although it lacks built-in functions to make it useful on the Propeller. Those can be added though and I expect to do that. The nice thing (depending on your point of view) is that ebasic runs on the Propeller. It doesn't require a PC-based tool to build programs. I could revive xbasic if there was any interest. It has some advantages because its compiler runs on a PC. For example, it trims out unused functions to save runtime space and does a somewhat better job at generating good code. I think Steve said at one point that xbasic code runs only a little slower than Spin code. It also has the advantage that it can use external memory for large programs. Anyway, that's the current state of xbasic. The code is checked into Google Code if you want to take a look at it:

    https://code.google.com/p/xbasic/
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-01-10 06:52
    I could revive xbasic if there was any interest.
    That is exactly why I started this thread, to see if anybody will be showing any interest. Again, I am not making any presumptions as to what you will or will not do at this point. I somehow missed or even knew that xbasic existed, maybe other people do not realize the existence of another, basic like, language.

    So, moving on, I just tried the "hello, world" example with some of the boards that I have. The only one, the GG PPUSB board, did not respond, I have verified that the board does work. For whatever reason, it says there is no Propeller available. I tried the C3, and the DNA-RTC boards, those worked, although on the DNA-RTC board I find matching up the right memory designation a little confusing. It is the RAM vs Flash that is giving me a problem, I now that the DNA-RTC has 1M of (Flash? or RAM?) available.

    The xbasic version that I am using is what was available on the xbasicIDE site, is that the latest version? I am reluctant to even mention the name jazzed, I do not want to get jumped on as if I were calling him out also, but he is the author of xbasicIDE, I am really going out on a limb now. I guess what xbasic needs now is a good example showing a blinker program, in the simplest form.

    Ray
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-10 07:00
    Rsadeika wrote: »
    That is exactly why I started this thread, to see if anybody will be showing any interest. Again, I am not making any presumptions as to what you will or will not do at this point. I somehow missed or even knew that xbasic existed, maybe other people do not realize the existence of another, basic like, language.

    So, moving on, I just tried the "hello, world" example with some of the boards that I have. The only one, the GG PPUSB board, did not respond, I have verified that the board does work. For whatever reason, it says there is no Propeller available. I tried the C3, and the DNA-RTC boards, those worked, although on the DNA-RTC board I find matching up the right memory designation a little confusing. It is the RAM vs Flash that is giving me a problem, I now that the DNA-RTC has 1M of (Flash? or RAM?) available.

    The xbasic version that I am using is what was available on the xbasicIDE site, is that the latest version? I am reluctant to even mention the name jazzed, I do not want to get jumped on as if I were calling him out also, but he is the author of xbasicIDE, I am really going out on a limb now. I guess what xbasic needs now is a good example showing a blinker program, in the simplest form.

    Ray
    To be honest, I'm not sure what xbasic has to offer that isn't already done better by Spin. I started writing Basic interpreters a few years ago because I was working with Andre' LaMothe on his XGS and Chameleon products and he wanted Basic to run on them. Since then I've become somewhat disillusioned with Basic and Forth since there doesn't seem to be a single definition of either of those languages. Basic is whatever an implementer says it is. There is an ANSI standard for Basic but no one follows it especially on microcontrollers. This is evidenced by the recent questions about running pbasic on the Propeller and mentions of PropBasic and SXB . Then there is FemtoBasic, Bean's embedded Basic, and probably many others. They are all different and none are compatible with the others. Probably adding xbasic to the mix is a mistake. It will be yet another Basic variant. I'm even worried about Spin falling into this hole with some of the changes being discussed for P2. Maybe that's why I keep going back to C. I have C code that I wrote in 1984 and I can still run it!

    I guess you have to ask yourself why you would want to use xbasic over Spin. The only answer I can come up with is that xbasic can run bigger programs from external memory but I think you can also do that in Spin if you're willing to use the spin2cpp translator along with an XMM memory model.
  • jazzedjazzed Posts: 11,803
    edited 2014-01-10 07:58
    I like xbasic.

    1. It makes small programs.
    2. XMM capable.
    3. IDE shows all variables and functions in the program by file.
    4. Documentation is here: http://www.microcsource.com/xbasic/help.htm

    Try this print example:
    include "print.bas"
    include "propeller.bas"
    
    
    waitcnt(clkfreq+cnt)
    print "hello", 123
    print "goodbye"
    
    
    do while(1)
    loop
    


    The IDE could use some feature updates. If there is substantial interest, I could add some missing items.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-10 08:28
    Rsadeika wrote: »
    I was not trying to presume anything, I was just trying to make a general observation. David Betz seems to be very generous with his time in answering questions. And stating his name, I was just trying to credit him with being the author of xbasic, maybe nobody knows that, alright. Relax, I am not calling anybody out, and not making any presumptions about what he may or may not do. I am sure that if he does not have the time or does not want too pursue xbasic any further, then I am sure that he will state it up front, so again, relax.

    Ray

    Excuse my grumpiness on time demands. I presumed David and Steve were BUSY!! :lol:

    Carry on, ignore me as usual! I'll go back to speaking only when spoken to. :thumb:
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-01-10 08:37
    I like xbasic.

    I do, too, and will be happy if the project grows.

    EFX-TEK just landed a very big account in the theme park world -- they've already purchased about a 50 Propeller-based HC-8+ controllers in the last month, and have "warned" us that they may be ordering another 300 shortly. Most of what they're doing involves the use of show control software (Vixen) with firmware that I have made available to all our customers (including another large theme park company). That said, the new customer comes from a BS2 programming background and, from time-to-time, would like to hand-code boards. For them it means learning Spin. I can certainly teach them, but if xbasic makes them happy and productive, that's all that matters. This company is creates parks and displays geared toward the entertainment and educations of children. Anything I can do to facilitate their work I am willing to do.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-10 08:47
    mindrobots wrote: »
    Excuse my grumpiness on time demands. I presumed David and Steve were BUSY!! :lol:
    I will be busy soon when Chip releases his new FPGA configuration! However, xbasic is working and it might not take that much effort to support it if people want to use it. I'm not a big Basic fan so maybe I don't see the value in it as much as others might.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-10 08:51
    JonnyMac wrote: »
    I do, too, and will be happy if the project grows.

    EFX-TEK just landed a very big account in the theme park world -- they've already purchased about a 50 Propeller-based HC-8+ controllers in the last month, and have "warned" us that they may be ordering another 300 shortly. Most of what they're doing involves the use of show control software (Vixen) with firmware that I have made available to all our customers (including another large theme park company). That said, the new customer comes from a BS2 programming background and, from time-to-time, would like to hand-code boards. For them it means learning Spin. I'm happy to teach them, but if xbasic makes them happy and productive, that's all that matters. This company is creates parks and displays geared toward the entertainment and educations of children. Anything I can do to facilitate their work I am happy to do.
    Thanks for expressing an interest in xbasic. It's nice to hear that there are people who've even looked at it! :-)

    However, I don't think xbasic looks much like pbasic so I wonder if your client might just as well learn Spin as another Basic dialect. Anyway, if you're interested in using xbasic I'll support it. However, I only did the command line compiler, loader, and runtime. Steve wrote the IDE so we should check to see if he has the bandwidth to support it along with SimpleIDE.
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-01-10 08:56
    However, I don't think xbasic looks much like pbasic

    I don't think that's an issue. Many made the move to SX/B without too much fuss, but then, we created a nice help file with a lot of good examples -- that's kind of the key to getting these things going. <joke>Many new Arduino "programmers/artists" can barely tie their shoes</joke>, they get along with the myriad examples provided to them.

    <preach to choir>The Propeller is a different beast, it needs a different BASIC.</preach to choir>

    I wonder if your client might just as well learn Spin as another Basic dialect.

    I think it's a psychology thing. BASIC and C exist outside the microcontroller world which may cause users to more readily accept them. The Arduino language is not really traditional C, right?

    Steve wrote the IDE so we should check to see if he has the bandwidth to support it along with SimpleIDE.

    One hopes that the initial framework of the xbasic IDE and SimpleIDE are similar, if not the same. If this is the case, perhaps a lot of the effort put into SimpleIDE moves right into the xbasic IDE making it even more friendly.
  • jazzedjazzed Posts: 11,803
    edited 2014-01-10 09:34
    mindrobots wrote: »
    Excuse my grumpiness on time demands. I presumed David and Steve were BUSY!! :lol:
    LOL. I'm always busy (though not gainfully employed at the moment). Little distractions are healthy.

    @Jon, While SimpleIDE grew from the xBasicIDE, they are separate projects with different ways of handling things. The xBasicIDE is far simpler because I never had to add tons of features to it.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-10 10:07
    jazzed wrote: »
    LOL. I'm always busy (though not gainfully employed at the moment). Little distractions are healthy.

    @Jon, While SimpleIDE grew from the xBasicIDE, they are separate projects with different ways of handling things. The xBasicIDE is far simpler because I never had to add tons of features to it.

    Ummm.... so you're saying that the xbasic IDE is simpler than SimpleIDE? :-)
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-01-10 10:09
    While SimpleIDE grew from the xBasicIDE, they are separate projects with different ways of handling things. The xBasicIDE is far simpler because I never had to add tons of features to it.

    That's okay being focused on a single language. If possible -- and if you're going to work on it -- I would suggest making xBasic as consistent with SimpleIDE as is possible (even if it's just the icons you use on the toolbars and hot-key assignments). If the terminal from SimpleIDE makes its way to xBasic, that would be helpful. It would also be nice to tell the IDE the starting folder for my xBasic projects (in my case: My Documents\programming\xbasic).

    As ever, and I think I speak for many in the Propeller community, I appreciate the efforts by you and David and others to provide toolset options for those of us that use the Propeller.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-10 10:13
    David Betz wrote: »
    Ummm.... so you're saying that the xbasic IDE is simpler than SimpleIDE? :-)

    ...but if you call it ReallySimpleIDE, people might think you are talking down to them.

    So we've got BasicIDE, SimpleIDE, ProfessionalIDE and BrowserIDE (or localhostIDE but you can't get there from here :lol:)
  • jazzedjazzed Posts: 11,803
    edited 2014-01-10 10:18
    mindrobots wrote: »
    ...but if you call it ReallySimpleIDE, people might think you are talking down to them.

    So we've got BasicIDE, SimpleIDE, ProfessionalIDE and BrowserIDE (or localhostIDE but you can't get there from here :lol:)

    LOL. My BrowserIDE is currently entitled "Spinny Webby Devy"
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-01-10 10:19
    jazzed wrote: »

    LOL. My BrowserIDE is currently entitled "Spinny Webby Devy"

    Um, expect a visit from the guys in marketing.......:lol:
  • tritoniumtritonium Posts: 543
    edited 2014-01-10 12:10
    jazzed
    Re: So, what about xbasic?
    I like xbasic.

    1. It makes small programs.
    2. XMM capable.
    3. IDE shows all variables and functions in the program by file.
    4. Documentation is here: http://www.microcsource.com/xbasic/help.htm

    Hi I tried that link in (4) but all the pages it references seem to be lost?

    Dave
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2014-01-10 12:19
    Hi Dave;
    tritonium wrote: »
    Hi I tried that link in (4) but all the pages it references seem to be lost?

    Dave
    xBasic Download and Support
    Seems to work for me.
    And all the supporting links.
    Try again.

    Duane J
  • tritoniumtritonium Posts: 543
    edited 2014-01-10 17:21
    xBasic Download and Support
    Seems to work for me.
    And all the supporting links.
    Try again.

    Duane J
    AHA!
    I tried again and although I get the intro page, clicking on any of the links drops me back to the search engine....
    AND THEN... I tried using Google Chrome and all is sweetness and light.!
    Well thats a new one on me??
    Originally I was using I. Explorer 11

    Ho Hum and thanks-
    Dave
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-01-11 04:21
    This is my rendition of "hello.bas", I added 'wait' and 'waitMS' commands, but I have no idea as to how to fix the 'high' and 'low' commands so that they would work. The DIRA and OUTA definitions were not included in the propeller.bas module, so I am not sure as to what would be best way to handle this. Once I get the 'high' and 'low' working, probably the next code improvement would be to add, maybe two LEDs in there own COGs, flashing while the main code body would display 'Hello, World!". I think that would be a good example of how to start using xbasic, IMHO.

    Ray

    REM ==========
    REM hello.bas
    REM ==========
    /* Include items */
    include "print.bas"
    include "propeller.bas"
    
    /* Start  */
    do
    	//print "Hello, World!"
    	
    	hello  // hello function
    	//waitcnt(clkfreq+cnt)
    	waitMS(500)  // Wait half a second
    loop
    
    /* Define functions */
    REM hello function
    def hello
    	print "Hello, World!"
    end def
    
    REM wait
    def wait(time)
    	waitcnt((80000000 * time) + cnt)
    end def
    
    REM waitMS
    def waitMS(time)
    	waitcnt(((80000000 / 1000) * time) + cnt)
    end def
    
    REM high
    def high(pin)
    	asm
    		//DIRA[pin] := %1
    		//OUTA[pin] := 1
    		mov dira, pin
    		mov outa, pin
    	end asm 
    end def
    
    REM low
    def low(pin)
    	DIRA[pin] := %1
    	OUTA[pin] := 0
    end def
    
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-11 04:47
    Rsadeika wrote: »
    This is my rendition of "hello.bas", I added 'wait' and 'waitMS' commands, but I have no idea as to how to fix the 'high' and 'low' commands so that they would work. The DIRA and OUTA definitions were not included in the propeller.bas module, so I am not sure as to what would be best way to handle this. Once I get the 'high' and 'low' working, probably the next code improvement would be to add, maybe two LEDs in there own COGs, flashing while the main code body would display 'Hello, World!". I think that would be a good example of how to start using xbasic, IMHO.

    Ray

    REM ==========
    REM hello.bas
    REM ==========
    /* Include items */
    include "print.bas"
    include "propeller.bas"
    
    /* Start  */
    do
    	//print "Hello, World!"
    	
    	hello  // hello function
    	//waitcnt(clkfreq+cnt)
    	waitMS(500)  // Wait half a second
    loop
    
    /* Define functions */
    REM hello function
    def hello
    	print "Hello, World!"
    end def
    
    REM wait
    def wait(time)
    	waitcnt((80000000 * time) + cnt)
    end def
    
    REM waitMS
    def waitMS(time)
    	waitcnt(((80000000 / 1000) * time) + cnt)
    end def
    
    REM high
    def high(pin)
    	asm
    		//DIRA[pin] := %1
    		//OUTA[pin] := 1
    		mov dira, pin
    		mov outa, pin
    	end asm 
    end def
    
    REM low
    def low(pin)
    	DIRA[pin] := %1
    	OUTA[pin] := 0
    end def
    
    The problem you're running into is that the ASM statement in xbasic doesn't allow you to enter PASM code, it allows you to enter xbasic bytecodes. There is a NATIVE bytecode that you can use to enter a single PASM instruction but it requires a hex value since there is no built-in PASM assembler in xbasic. However, the dira and outa registers are provided in xbasic directly:
    def high(pin)
      dira = dira | (1 << pin)
      outa = outa | (1 << pin)
    end def
    
    xbasic does not support the bit indexing feature of Spin that would allow you to do DIRA[pin].
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-01-11 05:25
    I tried the high and low functions, the high(26) turns on the LED, but the low(26) does not seem to do what is expected. In the short program below, something is causing a halt error.

    Ray
    REM high
    def high(pin)
    	dira = dira | (1 << pin) // Set up direction
    	outa = outa | (1 << pin) // Set up condition
    end def
    
    REM low
    def low(pin)
    	dira = dira | (1 << pin) // Set up direction
    	outa = outa | (0 << pin) // Set up direction
    end def
    
    include "print.bas"
    include "propeller.bas"
    
    	high(26)
    	waitMS(5000)  // Wait five seconds
    	low(26)
    end
    
    REM high
    def high(pin)
    	dira = dira | (1 << pin) // Set up direction
    	outa = outa | (1 << pin) // Set up condition
    end def
    
    REM low
    def low(pin)
    	dira = dira | (1 << pin) // Set up direction
    	outa = outa | (0 << pin) // Set up direction
    end def
    
    REM waitMS
    def waitMS(time)
    	waitcnt(((80000000 / 1000) * time) + cnt)
    end def
    
    After running the above short program.
    HALT: STACK 00007BD8, STACK_TOP 00007FD8
    PC OP FP SP TOS SP[0] SP[1] SP[2] SP[3]
    00000069 00 00007FD8 00007FD8 00000000 00007FD8 00007FD8 00000000 00000069
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-11 05:37
    You need this for the LOW function.
    REM low
    def low(pin)
    	dira = dira | (1 << pin) // Set up direction
    	outa = outa & ~(1 << pin) // Set up value
    end def
    
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-01-11 05:49
    That fixed it, but I am still getting the halt error, if it is an error. I added the 'end' command, I assume it is supposed too end the program, is that what is causing the halt error?

    Now that I have the 'high' and 'low' working, is there a good example somewhere as to how to use the 'cognew' command. In the samples folder there is an example, but I am not sure as to how it should be used in a program to actually start a COG, and what if you want too use more than one COG.

    Ray
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-11 05:56
    Rsadeika wrote: »
    That fixed it, but I am still getting the halt error, if it is an error. I added the 'end' command, I assume it is supposed too end the program, is that what is causing the halt error?

    Now that I have the 'high' and 'low' working, is there a good example somewhere as to how to use the 'cognew' command. In the samples folder there is an example, but I am not sure as to how it should be used in a program to actually start a COG, and what if you want too use more than one COG.

    Ray
    I'll have to look at the code but that may not be an error. It's just saying that the program halted which is normal when it's done executing. However, I agree that this is a little alarming so it should be disabled. I'll look into this.
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-01-11 07:02
    Below is a cleaned up version of hello.bas, which uses the 'high()' and 'low()' commands to work the LED. The essential def call outs could be placed in its own .bas file and then you would use the 'include "xxxx.bas"' to get access to your defs.

    I am really starting to like xbasic, I can see using it for some POC prototype programs. The only limiting factor that I see is the creation of drivers for all the different modules that are available, how do you make use of all the OBEX stuff for use in xbasic?

    I have been working with my RPi and Python, the simplicity of using Python is sort of the feeling I am getting with xbasic. In fact with xbasic I do not have to worry about the necessary spaces that are needed in Python, xbasic is straight forward and, so far, a pleasure too use, Thank You, David Betz. Now if I can only get a grasp on how to use 'cognew' in the proper way, or at least figure out how to get a new COG too work.

    Ray
    REM ==========
    REM hello.bas
    REM ==========
    /* Include items */
    include "print.bas"
    include "propeller.bas"
    
    /* Start  */
    
    do
    	
    	high(26)  // On LED
    
    	hello  // hello function
    	
    	waitMS(500)  // Wait half a second
    	low(26)  // Off LED
    	waitMS(500)  // Wait half a second
    	
    loop
    
    end
    /* End of main program. */
    
    /* Define functions */
    REM hello function
    def hello
    	print "Hello, World!"
    end def
    
    REM wait()
    /* Wait, time in seconds. */
    def wait(time)
    	waitcnt((80000000 * time) + cnt)
    end def
    
    REM waitMS()
    /* Wait, time in miliseconds. */
    def waitMS(time)
    	waitcnt(((80000000 / 1000) * time) + cnt)
    end def
    
    
    REM high()
    /* Make pin high.  */
    def high(pin)
    	dira = dira | (1 << pin) // Set up direction
    	outa = outa | (1 << pin) // Set up value
    end def
    
    REM low()
    /* Make pin low.  */
    def low(pin)
    	dira = dira | (1 << pin) // Set up direction
    	outa = outa & ~(1 << pin) // Set up value
    end def
    
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-11 07:23
    Rsadeika wrote: »
    I am really starting to like xbasic, I can see using it for some POC prototype programs. The only limiting factor that I see is the creation of drivers for all the different modules that are available, how do you make use of all the OBEX stuff for use in xbasic?
    I'm glad you're finding xbasic useful! Since xbasic supports coginit and cognew, it is possible to load compiled PASM code into a COG. The code would have to be built with some other tool like spin2cpp or OpenSpin and then converted to an xbasic initialized array. That is the only way that OBEX code could be used with xbasic. Sorry!
  • RsadeikaRsadeika Posts: 3,837
    edited 2014-01-11 07:47
    So, are you saying that the only way you can use cognew is if it were associated with some sort of "initialized array"? I guess this adds a level of complexity, but it would probably work well with having COGs that would run in Flash RAM or expanded memory, I think. I noticed the example code for coginit, it had an array associated with the cognew, I guess now it makes sense, but a lot harder to deal with. That would be one heck of feature add too xbasicIDE, but I think jazzed would be shaking his head no, no, no.

    I noticed that in the print.bas there is a 'def uartTX(ch)' , but I did not see an accompanying uartRX(ch). I am thinking maybe my next example code could be the use of a uart, maybe to work with XBee? Since I did not see any thing in the sample folder, where or how would I start for something like that?

    Ray
  • David BetzDavid Betz Posts: 14,516
    edited 2014-01-11 09:29
    uartRX is in the input.bas include file.
Sign In or Register to comment.