Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 14 of 14

Thread: MikroElektronika Basic and Teensy boards

  1. #1
    Junior Member
    Join Date
    Jan 2015
    Posts
    6

    MikroElektronika Basic and Teensy boards

    Hi,
    This is my first post here, and I would like some help please.

    Let me introduce myself a little bit first, so you can get a better picture.

    I use to use, and still do, PIC micro-controllers every now and then for some occasional projects. I have been using products from MikroE and mostly their Basic programing language.

    I only know BASIC, and not other languages, and do not have the time to learn C etc.

    So, what I would like to know is, can I use this product: mikroBasic PRO for AVR, as the ATMega32u4 is a supported uC, can I create the HEX file, and upload it with the Teensy loader for USB and just transfer it to the teensy board. The great thing is, is that you can make small enough programs using the unregistered / free version, up to 4Kb, of which is more than enough for what I am looking at doing, like temp monitoring and maybe a simple display, as there is a whole eco system for a huge amount of things with pre-compiled libraries.

    I am in to small simple projects, that do not need the power of 32 bit uC etc, neither am I young enough to start learning a new language nor the inclination due to other factors.

    So, what I am looking for is the following:

    Use BasicPro for AVR,
    Create HEX
    Dump to Teensy 2.0
    Reset, and hopefully see things working.

    Will it really be that simple? Can someone that has already done this, please let me know.

    I ask, since i think the price is reasonable, comes also with a pin header, has some basic stuff on it, like Crystal, Led and Reset button, and program from USB, so I really like the board and have purchased 3, 1 locally here in Australia - without pins, and 2 directly from, PJRC, one with pins, the other without, both Teensy 2.0 - still waiting to arrive, due to being in Australia, and only ordered recently.

    A simple project got me in to this, that is the sidewinder pro to USB, and I liked what I saw, so I am interested in "jumping ship" so to say from PIC to Atmel / Teensy.

    It would make things make more convenient and less soldering for me in the trial phase with less of the basic stuff to use.
    Thank you for your time guys.

    I guess you could always try the "C" version, if that is your thing, try it, and let me know if the HEX will work, as that is the important thing, since then that would most probably meant that the Basic compiler would also work.

  2. #2
    Junior Member
    Join Date
    Jan 2015
    Posts
    6
    Just a quick update

    After having downloaded and played around with the default sample programs on the website:
    LED Blink, Both Slow & Fast
    I was able to make the LED blink fast and slow, so I was able to verify that at least I had everything working ok before I ventured beyond that point.

    Since the one I have on hand is the one without the pin header, I am not inclined to solder anything else on it yet, before I complete this project:
    sw3dprousb (aka 3DP-Vert)

    Now, I have downloaded and installed MikroE's Basic Pro compiler, and copied from the "1st Project" pdf, the following and adjusted it to "PORTD", where the led is located:

    Code:
    program LedBlinking
    main:
    ' set PORTA to be digital output
    DDRA = 0
    ' Turn OFF LEDs on PORTA
    PORTA = 0
    while TRUE
    ' Toggle LEDs on PORTA
    PORTA = not PORTA
    ' Delay 1000 ms
    Delay_ms(1000)
    wend
    Edit: Please remember to adjust to "PORTD" and "DDRD" from "PORTA" and "DDRA"

    The only difference is, that I changed it to 2000 and now it stays on and off longer, just to make sure it works.
    and this is the HEX
    Code:
    :100000000C9456000C9400000C9400000C9400001A
    :100010000C9400000C9400000C9400000C94000060
    :100020000C9400000C9400000C9400000C94000050
    :100030000C9400000C9400000C9400000C94000040
    :100040000C9400000C9400000C9400000C94000030
    :100050000C9400000C9400000C9400000C94000020
    :100060000C9400000C9400000C9400000C94000010
    :100070000C9400000C9400000C9400000C94000000
    :100080000C9400000C9400000C9400000C940000F0
    :100090000C9400000C9400000C9400000C940000E0
    :0C00A0000C9400000C9400000C94000074
    :1000AC00BFEFBDBFBAE0BEBFB0E0BAB9B0E0BBB9FC
    :1000BC000BB100950BB923EA17E503E00A95F1F7AC
    :0E00CC001A95E1F72A95D1F70000F2CFFFCF89
    :00000001FF

    So, I just wanted to let you all know that it is working, at least with the simple program and the single LED on the Teensy 2. I can not confirm more advanced functions, since I am awaiting the other parts to arrive from Paul
    Then I can try a couple of more complicated stuff, like filling it all with leds to make sure all ports work ok, and maybe down the track a display and temperature readout etc

    So, If anyone is interested, they can try the compilers out, as the HEX file seems to work, just remember to set it to 16 MHz and ATMega32U4.

    Good luck guys.
    Last edited by Aries1470; 01-17-2015 at 11:45 AM. Reason: Added Edit line, explaining to change from "A" to "D" for LED to work.

  3. #3
    Senior Member+ Frank B's Avatar
    Join Date
    Apr 2014
    Location
    Germany NRW
    Posts
    5,679
    There's a Basic compiler for Teensy 3.0/3.1 :

    http://www.coridiumcorp.com/teensy.php

    T3 is really MUCH faster, you have to see it to believe it. And more memory.

  4. #4
    Junior Member
    Join Date
    Jan 2015
    Posts
    6
    Hi guys, just tried a little bit more with blinking the led, similar to "... --- ..." and then some fast flashing.
    it works
    Code:
    program LED_AdvancedBlinking
    
    ' Declarations section 
    dim LEDA as sbit at PORTD.B6    ' Defined PORTD.B6 as LEDA
    dim i as byte
    
    main:
    '   Main program
        ' set PORTD to be digital output
        DDRD = 0
        ' Turn OFF LEDs on PORTD
        LEDA = 0
        while TRUE
              while i < 3
                  ' Toggle LEDs on PORTD
                  LEDA = 1
                  ' Delay 250 ms
                  Delay_ms(250)
                  ' Toggle LEDs off PORTD
                  LEDA = 0
                  Delay_ms(250)
                  i = i + 1
               wend
               LEDA = 0
               i = 0
               Delay_ms(1000)
              while i < 3
                  ' Toggle LEDs on PORTD
                  LEDA = 1
                  ' Delay 500 ms
                  Delay_ms(500)
                  ' Toggle LEDs off PORTD
                  LEDA = 0
                  Delay_ms(500)
                  i = i + 1
               wend
               LEDA = 0
               i = 0
               Delay_ms(1000)
            while i < 3
                  ' Toggle LEDs on PORTD
                  LEDA = 1
                  ' Delay 250 ms
                  Delay_ms(250)
                  ' Toggle LEDs off PORTD
                  LEDA = 0
                  Delay_ms(250)
                  i = i + 1
               wend
               Delay_ms(1000)
               i = 0
    
               for i = 0 to 10
                 ' Toggle LEDs on PORTD
                  LEDA = 1
                  ' Delay 250 ms
                  Delay_ms(100)
                  ' Toggle LEDs off PORTD
                  LEDA = 0
                  Delay_ms(100)
               next i
               LEDA = 0
               Delay_ms(5000)
               i = 0
        wend
    end.
    The quick flash is so you know where you are in the program
    I will also include the HEX, if anyone wants to play around with it.
    Here it is:
    Code:
    :100000000C9456000C9400000C9400000C9400001A
    :100010000C9400000C9400000C9400000C94000060
    :100020000C9400000C9400000C9400000C94000050
    :100030000C9400000C9400000C9400000C94000040
    :100040000C9400000C9400000C9400000C94000030
    :100050000C9400000C9400000C9400000C94000020
    :100060000C9400000C9400000C9400000C94000010
    :100070000C9400000C9400000C9400000C94000000
    :100080000C9400000C9400000C9400000C940000F0
    :100090000C9400000C9400000C9400000C940000E0
    :0C00A0000C9400000C9400000C94000074
    :1000AC00BFEFBDBFBAE0BEBFB0E0BAB9BBB1BF7B5A
    :1000BC00BBB900910001033000F5BBB1B064BBB912
    :1000CC0025E11BE40FEB0A95F1F71A95E1F72A9558
    :1000DC00D1F70000BBB1BF7BBBB925E11BE40FEB33
    :1000EC000A95F1F71A95E1F72A95D1F700000091DE
    :1000FC0000010F5F00930001DCCFBBB1BF7BBBB92C
    :10010C00B0E0B093000122E51BE200E00A95F1F7A4
    :10011C001A95E1F72A95D1F70000000000000000C5
    :10012C00009100010330F0F4BBB1B064BBB929E21B
    :10013C0016E900E80A95F1F71A95E1F72A95D1F737
    :10014C00BBB1BF7BBBB929E216E900E80A95F1F710
    :10015C001A95E1F72A95D1F7009100010F5F0093F2
    :10016C000001DECFBBB1BF7BBBB9B0E0B0930001E7
    :10017C0022E51BE200E00A95F1F71A95E1F72A95C2
    :10018C00D1F70000000000000000009100010330D6
    :10019C0000F5BBB1B064BBB925E11BE40FEB0A95CC
    :1001AC00F1F71A95E1F72A95D1F70000BBB1BF7BA7
    :1001BC00BBB925E11BE40FEB0A95F1F71A95E1F7B2
    :1001CC002A95D1F70000009100010F5F0093000108
    :1001DC00DCCF22E51BE200E00A95F1F71A95E1F776
    :1001EC002A95D1F70000000000000000B0E0B093A9
    :1001FC000001B0E0B0930001BBB1B064BBB929E021
    :10020C001EE105EE0A95F1F71A95E1F72A95D1F75B
    :10021C000000BBB1BF7BBBB929E01EE105EE0A951E
    :10022C00F1F71A95E1F72A95D1F70000009100013A
    :10023C000A3031F0009100010F5F00930001DCCF18
    :10024C00BBB1BF7BBBB932E026E918ED09E00A95DA
    :10025C00F1F71A95E1F72A95D1F73A95C1F7000015
    :0C026C000000B0E0B093000124CFFFCFF1
    :00000001FF
    I hope you all enjoy, it has been a great learning curve. Now to head off to sleep.

    A great thanks to Paul for this great little critter, that is easy to program even from an un-powered usb hub

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,576
    Good to know this one works too.

    Previously, I'd only heard confirmed reports of BASCOM-AVR being used with Teensy 2.0.

  6. #6
    Junior Member
    Join Date
    Jan 2015
    Posts
    6
    Hi Frank and Paul,

    Frank, thank you for the link, that is very informative :-) but it would still mean that I would need to learn a new IDE / programming environment, even though it is still "basic"

    At the moment though, I am only doing basic stuff, like simple interrupts (TTL level), measuring voltage(soon), sending a signal, so it would be overkill for those type of projects.
    It is akin to taking a sledgehammer when you need a small hammer to hit a nail, or an 18 wheeler when all you need is a van.

    Don't get me wrong, each has its usefulness and its place. Having said that, it is very interesting to say the least I might be trying it in the future when I need to do more.

    Paul,

    The only thing to keep in mind, since it is not directly reading it yet (Teensy 2.0), it does not know the amount of space really left on the device, so need to manually calculate it... it doesn't account for the bootloader.

    As I have mentioned, my main projects include interrupts, and then appropriate output. Hobby project is for a model railway crossing and activating a pair of alternating flashing lights, with two inputs, that are triggered when there is a break in a light beam. Another future project would be a temperature / thermometer with a simple 16x2 LCD readout. Later I will progress to more complex ones

    So, I would like to thank you both for replying

  7. #7
    Junior Member
    Join Date
    Jan 2015
    Posts
    6
    stevech wrote:

    The Mikroe compilers are awful. Non-standard. No C++. No object oriented BASIC.
    Pascal might be a fun retro-trip.
    Mikroe's libraries are tuned to help them sell I/O boards.
    It seems amied at undergrad classes.

    Their small ARM M4 boards are good hardware if you *mass erase * the M4 chip and Mikroe's bootloader and use an SWD debugger pod with one of the good IDEs like Visual Studio 2013 Community or VisualGDB.
    Hi Stevech,

    I am "retro" as in the basic I learned was real and true old school, where you learned on a mainframe, I also learned RM Cobol, but since I haven't used in over 27 - 28 years, I have forgotten it, so this style of basic, plus modules are great. Personallly, if I do a couple of projects a year, I am more than happy

    I have been using their picBasic for a little over 10 years, making a couple of projects at most a year and at times none at all, it is more of a hobby for me than a job.

    To each his own I guess, that is why I got excited when it worked Nothing fancy, nothing new to learn and same programming environment.

    Personally, I have only used their software and not their hardware, and only their "free version", since I haven't done something fancy to require a large code.
    It outputs standard HEX, I use any programmer I want, and it works, so it is suitable for me.

    Call me "old fashioned" if you must, I did not learn "Visual Basic" and studio et al, since it was after my time and did not have a need for it, jsut as I learned straight HTML using notepad in the mid to late 90's. Loads fast, does its job, no need for all the bells and whistles... I hope you understand where I am coming from.

    I hope others will find this post useful when they might want to dable in a different architecture and still use the same tools, as it was the easiest thing for me.

    My personal journey was the following:

    I used Pic12/16/18 series, with mikroE since I found many things on the web, from the venerable 16F84... that is what got me started, then, I started doing my own little things over the years on and off...
    Now, I recently found the Teensy so I could bring back to life an old MS Sidewinder Joystick, and this is what got me going again, and I loved the design, since it saves me adding all the ancillary components that are needed for the uC and I do not need tp use a serial or // port to program the chip and put it in my board, or use a ICSP header etc, just put it in the programmer, burn, put in circuit done. Now I can use USB and I am done ;-)

  8. #8
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Mikroe BASIC and C compilers are beyond awful. And no C++.

    My first BASIC was on GE Tymeshare. Did a lot of math modeling work of RF stuff.

    I started my career doing digital circuit design. I then had to learn enough software in order to test my designs since they all interfaced to a computer (Data General Nova 800, DEC PDP-11, etc). And one year long project was a team-designed wire-wrap boards computer that was an early microprogrammed CISC computer - it emulated the PDP-11 and others. There were always bugs - divide didn't work for some cases. It was years before I stopped assuming my bug was a computer hardware bug.
    I discovered that for x amount of work time, in software I could get 100 times more functionality!
    So I shifted to a software bent- which was at the time all was in assembly language due to cost of computers and lack of today's cheap silicon DRAM.
    After years of asm on many computers and the beloved 6809 MCUs, I self-taught Pascal. UCSD Pascal. At first, on an Apple II.
    Then job-wise along came C popularity. I struggled with C, thinking it should be like Pascal. One day the light came on: C is not a high level language, it's just a portable assembler. You can make all the same stack and subroutine call mistakes in C as in asm. Not so Pascal. Then I "got it", with pointers, pointers to pointers, and all that in C.
    Then into RTOSes for embedded and real time programming with task preemption mutual exclusion and all that brings.

    Along the way, I tried some PICs. I quickly abandoned them - the lack of a stack, the tiny code pages, etc., was reminiscent of an ancient design never meant to be used for more than a 1970's washing machine controller.

    A long time later, that being in the last 2 years or so, I've become reasonably proficient in C++ for embedded. I resisted for years. Glad I undertook learning C++. There is a lot to NOT like about C++ (like constructors and operator overloading), but if you don't over-use all the arcane parts much, since you nor anyone else can understand the code 6 months later. And too many C++ developers don't comment the code for their own long term good - for some odd reason.

    Well, enough.
    Last edited by stevech; 01-19-2015 at 11:06 PM.

  9. #9
    Junior Member
    Join Date
    Jan 2015
    Posts
    6
    Quote Originally Posted by stevech View Post

    Along the way, I tried some PICs. I quickly abandoned them - the lack of a stack, the tiny code pages, etc., was reminiscent of an ancient design never meant to be used for more than a 1970's washing machine controller.

    A long time later, that being in the last 2 years or so, I've become reasonably proficient in C++ for embedded. I resisted for years. Glad I undertook learning C++. There is a lot to NOT like about C++ (like constructors and operator overloading), but if you don't over-use all the arcane parts much, since you nor anyone else can understand the code 6 months later. And too many C++ developers don't comment the code for their own long term good - for some odd reason.

    Well, enough.
    Hi,

    Thanks for the feedback

    The PIC32 have come a long way, with plenty of extra features, but I personally do not use them.
    Our paths are totally different, so I can see why you need way more features than I will use.

    In regards to your last statement, I wish I knew too. At times I over comment, it does not do any harm, since the comments do not get interpreted or compiled, but was an 'excellent' habit that my professor drilled in to us from the get go, so if anyone else picked up our code or even ourselves a long time later, we would know what each part was for. I was doing it since the TI 99/4A, ok, not always putting comments with the TI, and then at school.

    I wish I continued on my programming path instead of it becoming just a 'hobby'. I guess we can't have everything.

    For now though, I am hooked on this little critter called Teensy, and hopefully I would be able to get my kids curiosity going and become more better than me.

    Again, thank you for your feedback and time.

    p.s. I think the TMS9900 had a lack of a stack too, but was the first 16 bit CPU Edit: for home computers.

  10. #10
    Member
    Join Date
    Aug 2013
    Location
    Ohio
    Posts
    88
    Hi Steve,

    I'm wondering whether that first stackless computer was the PDP-8? Studying the -11 after working on the -8 for a few years was *wonderful*. Reentrancy!! :-)

    Transitioning to C was another epiphany. (FORTRAN-II on the -8 then -IV under the FPS-8 emulator, then on the Eclipse S200 and C300) through a few inadmissable years in COBOL (also on the C350)... PL/I on the MV-8000 was great too. (I was able to double the performance of our IDEA app with caching and DG's wonderful IPC tricks...)

    Those were the days...
    Last edited by LenSamuelson; 01-20-2015 at 08:38 PM. Reason: Spelling correction

  11. #11
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,256
    In the early 1980's, I wrote the Data General C compiler front end mostly by myself (I did have a subordinate for part of the time) in PL/1. I would not have used the words 'great' to describe PL/1.

  12. #12
    Senior Member
    Join Date
    Jun 2013
    Location
    So. Calif
    Posts
    2,828
    Quote Originally Posted by LenSamuelson View Post
    Hi Steve,

    I'm wondering whether that first stackless computer was the PDP-8? Studying the -11 after working on the -8 for a few years was *wonderful*. Reentrancy!! :-)

    Transitioning to C was another epiphany. (FORTRAN-II on the -8 then -IV under the FPS-8 emulator, then on the Eclipse S200 and C300) through a few inadmissable years in COBOL (also on the C350)... PL/I on the MV-8000 was great too. (I was able to double the performance of our IDEA app with caching and DG's wonderful IPC tricks...)

    Those were the days...
    Stackless referred to the microchap PIC 8 bitters. (The PIC 32 is a senseless attempt to drag the PIC 8 bitter customers to PIC32 instead of losing them to ARMs.

    My DG Nova 800 work way back was all assembly language. It had either 32KB or 64KB of core (yes, core). I worked with its RTOS a lot- drivers, etc. Wrote "disk overlay" system so that one could write assembly code that was link-loaded to a fixed address. Then the RTOS read the code into that address, executed it, and it returned (hopefully), releasing the next "transient overlay" program to run. I spent countless hours devising means to determine which transient program overwrote code or data in the RTOS and causing a crash some time later. There were some 10 people writing transient programs and some of them were dolts. This was all prior to the PDP-11. Before the Nova 800, I did FORTRAN II on a Navy submarine navigation computer. What fun in those days.
    Last edited by stevech; 01-20-2015 at 10:29 PM.

  13. #13
    Member
    Join Date
    Aug 2013
    Location
    Ohio
    Posts
    88
    Much of the human experience is relative... PL/I compares favorably with FORTRAN and COBOL. Anything block-structured is an improvement.

    Something else to admit: AOS and AOS/VS were my all-time favorites until UNIX/Linux got competent multithreading. I'm guessing that a technical management decision to simplify porting of RDOS applications to AOS and subsequently AOS/VS provided just enough impetus to ensure proper "multitasking".

  14. #14
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Location
    Ayer Massachussetts
    Posts
    3,256
    Well the creation of AOS happened before I joined DG. I was there from 1979 (straight out of college) to 1989, working originally on the DG/L compiler (AOS, later with transition to AOS/VS), then as I said creation of the AOS/VS C compiler on MV/Eclipse systems, retargeting the C compiler to DG/UX on the MV/Eclipse systems, and then finishing up wtih the GNU C compiler for the AViiON running DG/UX and using the Motorola 88000 processor. I've mostly worked on GCC backends since then at OSF, Cygnus Solutions, Red Hat, AMD, and now IBM, with some periods of employment on non-GCC compilers (first at a small Java company that no longer exists and then at Metrowerks on their Playstation compilers).
    Last edited by MichaelMeissner; 01-21-2015 at 05:28 AM.

Posting Permissions

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