Moving from Basic Stamp and MIKROE basic to PicBasic PRO


Closed Thread
Results 1 to 40 of 41

Hybrid View

  1. #1
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default Re: Moving from Basic Stamp and MIKROE basic to PicBasic PRO

    Quote Originally Posted by CuriousOne View Post

    For example, their reference book has black bold letters for main text, but code samples are given with thin CYAN color letters on YELLOW background - almost unreadable.
    Could you give a link to what you're talking about???

    I didn't see anything looking to what you describe here ... for EasyPic 7 board.

    Considering the Mk Basic Pro reference Manual ... I find there such colors, but have no difficulties to read it on my screen.

    Printing it on a monochrome Black laser printer could be somewhat difficult to read ... Ok, but it's not THEIR problem, just YOURS ...
    I already asked them for a paper manual ... ( yes, I did !!! ). The answer was ... " if enough people is Ok to pay for postage and printing, we'll do it ... "

    Will you ???

    I gave the .pdf file to my local print shop ( where students have their school end-of-year-reports printed @ low rates ...), and it didn't cost me too much to get a nice - in colours - book for Mk C.

    a " no cost " solution (!) is obviously to hit the " HELP " button of the compiler or further to download the example projects from here: http://www.libstock.com/

    Yess ... once more "RTFM" ...

    Browsing their site ... you could have found: http://www.mikroe.com/products/view/...ming-in-basic/ also available as a printed book for 24 $ ...

    ...

    @Henrik

    But in general I agree, their documentation LOOKS great but the details are missing an many cases
    you're forgetting here they have a really great forum with numerous " official " guys to answer the details missing.
    YES ! I do agree the only question never answered is " when will Mk xxx compiler/IDE be bugless released " ...

    Alain
    Last edited by Acetronics2; - 24th February 2013 at 20:37.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  2. #2
    Join Date
    Feb 2013
    Posts
    1,157


    Did you find this post helpful? Yes | No

    Default Re: Moving from Basic Stamp and MIKROE basic to PicBasic PRO

    You don't see that does not neceserily means that it does not exist.

    Yes, I also downloaded and printed in color, but it still looks weird. Why no other publishers choose to use suchk peacock-tail style colors?

    and of yes, their forum is "great". When you ask, general answer will be "read the documentation", even if you ask totally different things.

    Releasing poorly documented hardware is another "high standard".

    What makes me especially funny, this is how they give their contact address here: http://www.mikroe.com/visitor_contacts/
    Belgrade, EUROPE.
    Without specifying the country, Serbia. They are ashamed to be Serbians?

    I think it'll be better to finish mikroe discussion now. If anyone interested, I can sell the easy pic v7, usb dongle and everything which came with picbasic kit for half of it's retail price (I will even include the reference manual printed in color and assembled as book).

    Regarding the microbasic pro, I've downloaded the trial version, and reading manual right now. I also have K149-BC PIC programmer which works just fine. So I'll use them together, without using mikroe board.

    The software cames with sample led blink code. And it has some specific settings, which you need to uncomment, before compiling. But, since I want to use PIC16F628A, I need a different config settings, as I guess. I've checked relevant datasheet, and that code to be working, instead of ANSEL = %00000000 I should use TRISB = %00000000
    right?
    Also, I set oscillator to XT type in fuses config in programmer, to use internal osc.

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Moving from Basic Stamp and MIKROE basic to PicBasic PRO

    Agreed on dropping the MikroE discussion, there's nothing more to be gained from it.
    I've checked relevant datasheet, and that code to be working, instead of ANSEL = %00000000 I should use TRISB = %00000000 right?
    Not quite. ANSEL is a register which controls if the pins should be used for analog or digital. TRIS is the register controling the "direction" of the pins, when the pins are set to digital thru the ANSEL register... Makes sense?

    The 16F628A doesn't have an ADC so there will be no ANSEL register to set but it does have a comparator module which may need to be configured properly, see the CMCON register.

    Also, I set oscillator to XT type in fuses config in programmer, to use internal osc.
    Nope, if you set it to XT it expects an external x-tal.

  4. #4
    Join Date
    Feb 2013
    Posts
    1,157


    Did you find this post helpful? Yes | No

    Default Re: Moving from Basic Stamp and MIKROE basic to PicBasic PRO

    Ok, so, as I guess, the code now should look like this:
    Code:
    Define OSC 4 ' 4MHz  'set internal osc to 4mhz
    CMCON=0  'turn comparator off
    VRCON=0 ' turn voltage reference off
    TRISB = %00000000  'set direction of port B pins
    LED    VAR  PORTB.0   ' Assign name "LED" to PORTB.0
    
    mainloop:
       High LED        ' Turn on LED connected to PORTB.0
       Pause 500       ' Delay for .5 seconds
    
       Low LED         ' Turn off LED connected to PORTB.0
       Pause 500       ' Delay for .5 seconds
    
       Goto mainloop   ' Go back to loop and blink LED forever
       
       End

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Moving from Basic Stamp and MIKROE basic to PicBasic PRO

    Hi,
    That's a good start. Couple of notes:
    DEFINE OSC 4 does not SET the oscillator to 4Mhz it simply tells the compiler at what speed you INTEND to run the chip so it (the compiler) can calculate delay loops etc.
    CMCON = 0 does not turn off the comparator, look at the datasheet.

    /Henrik.

  6. #6
    Join Date
    Feb 2013
    Posts
    1,157


    Did you find this post helpful? Yes | No

    Default Re: Moving from Basic Stamp and MIKROE basic to PicBasic PRO

    OK, understood. Going further. By googling I figured out that for my needs (using int. osc), I need to set fuses as follows:

    Oscillator: IRCIO
    WDT=OFF
    LVP=OFF
    MCLRE=OFF
    PWRTE=ON

    regarding the CMCON, by googling I found it to be set to 0x07, to disable comparators. However, I was not able to find that information in datasheet (I'm sure it is in there, just I'm looking in the wrong way).

    Also, how should I set clock frequency? OSCF=%0000100 ?

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Moving from Basic Stamp and MIKROE basic to PicBasic PRO

    Hi,
    The only config that has any actual impact on the oscillator would be the first one, the others have impact on other things but has nothing to do with the oscillator. In either case they look fine to me but if you want to set them from within your code you need get the naming correct, if you set them manually thru your programmer software it doesn't matter. If you have PBP3 I strongly suggest you open the DEVICE REFERENCE folder in the PBP3 installation directory and then open the PIC16F628.INFO (it's a plain text file). It shows you what default CONFIG PBP will use if you don't tell it otherwise and it shows you how to set whatever you want - in the code so you don't have to mess around with it in the programmer software.

    As for CMCON, open the datasheet (please use this one so we're looking at the same thing) and browse to the comparator section. Look at the description of the CMCON register and you'll see that bits 0-2 controlls the comparator mode with a note that figure 9-1 shows the various modes. Now flip the page to find figure 9-1 and find the one that suits you ie. both comparators off and you'll see that in order to do that bits 0-2 should be set - therefor CMCON = 7.

    On the 16F628 you can't really set the frequency of the internal oscillator, you can switch it between 32kHz and 4MHz (I guess that's what you meant though) and that's done by clearing (32kHz) or setting (4MHz) the OSCF bit in the PCON register. If you look at the PCON register in the datasheet you'll see that the OCSF bit is bit 3 (not bit 2 which you seem to have in your code?). So PCON.3 = 1 or if you wish you can create an alias to the bit, like:
    Code:
    OSCF VAR PCON.3
    OSCF = 1
    With that said the default state of the OSCF bit is '1' so it will start up at 4MHz.

    /Henrik.

Similar Threads

  1. Pic Basic pro code Compiling help!
    By JeromyJones in forum mel PIC BASIC
    Replies: 3
    Last Post: - 20th February 2013, 14:14
  2. Yet another SERIN2 problem - Conversion from Basic Stamp
    By Fanias in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 24th October 2012, 08:08
  3. PicBasic Pro to Basic Stamp conversion?
    By Kirk Fraser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th March 2011, 07:49
  4. Basic Stamp BS2 replacement?
    By tenaja in forum Schematics
    Replies: 5
    Last Post: - 17th November 2009, 18:27
  5. Basic Question about PICBASIC
    By zonkwilliams in forum General
    Replies: 1
    Last Post: - 10th March 2005, 22:55

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts