Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 13:50 26 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Introducing the Pi-cromite: first steps

     Page 1 of 16    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8578
Posted: 05:27am 04 Apr 2017
Copy link to clipboard 
Print this post



6x as fast as the Micromite eXtreme, this is MMBasic 5.3 running native on a Raspberry Pi 3 under Raspbian. The picture is of a Teraterm session on the PC connected to the Pi with SSH.

If you want to try it, load the attached to your Pi and execute it using the usual Linux syntax "./mmbasic". You may need to execute "chmod +x mmbasic" to set the file as executable.

2017-04-04_151107_mmbasic.zip

I don't think it needs anything else installing on the Pi to run - let me know.

The code is a port of MMBasic V5.3 with double precision floating point and 64-bit integers. The executable is posted with Geoff's approval. Basic file handling is supported as in the picture but error handling is primitive/non-existent. Time$, date$ and timer are supported but there is no other peripheral support at the moment. The FILE command can be used (without arguments) to list the contents of the current directory (use "Print cwd$" to see where you are)

It has been tested with cdeagle's code for calculating solar eclipses and exactly matches the output of the MMX.

I'm doing the development on the Pi itself using Netbeans8.2/GCC


Edited by matherp 2017-04-05
 
twofingers
Guru

Joined: 02/06/2014
Location: Germany
Posts: 1133
Posted: 05:58am 04 Apr 2017
Copy link to clipboard 
Print this post

WOW!

... today is not the 1. of april?

Thanks for the great job!

Michael


edit:
File names are case sensitiv!Edited by twofingers 2017-04-05
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 1985
Posted: 07:58am 04 Apr 2017
Copy link to clipboard 
Print this post

you are prolific Peter!

is there support for the Pi hardware in/out, analogue in etc...?

<edit> ah... finished reading the post </edit>

cheersEdited by CaptainBoing 2017-04-05
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 261
Posted: 08:25am 04 Apr 2017
Copy link to clipboard 
Print this post

Another awesome effort Peter.

I'll have to dig out my Pi and give it a try.
 
jman

Guru

Joined: 12/06/2011
Location: New Zealand
Posts: 711
Posted: 09:28am 04 Apr 2017
Copy link to clipboard 
Print this post

Awesome effort.
Once this has peripheral support and graphics the sky's the limit


Regards
Jman
 
Grogster

Admin Group

Joined: 31/12/2012
Location: New Zealand
Posts: 9061
Posted: 02:13pm 04 Apr 2017
Copy link to clipboard 
Print this post

Impressive.

matherp needs an MMBASIC knighthood for all the developement he has done for the platform.....

I take it that this could also be run on the Pi Zero-W once development is complete?

If so, that opens up a very powerful MMBASIC on a very cheap $5 board - all you need to do is design a host board for the Pi-0W.

The MMX still wins in terms of number of I/O pins available, but I dearsay that the Pi with an I2C port-expander chip on it would solve that issue pretty quickly.

Nice work, matherp.
Smoke makes things work. When the smoke gets out, it stops!
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5901
Posted: 03:38pm 04 Apr 2017
Copy link to clipboard 
Print this post

I think the winters are too long in the mother country.

A small bug:
  Quote  > > for zz = 2 to 10 :print zz : next zz

2
3
4
5
6
7
8
9
10
> > for zz = 10 to 2 step -1 : print zz : next zz

> >


not happy with STEP -1
At the prompt, it does nothing. In a program it is likely to give an error but not on that line.

Not sure why I am getting the double prompt but I suspect it is to do with using CD LF pairs in my TeraTerm configuration. I usually have to change it when talking to a Pi. - Yes, changing sending CR on it's own fixes the double prompt (as well as double line spacing).

If you want to talk to a Pi with MMEdit, you will have to enable Telnet on the PI and that should only be done within secure networks. It is not something I have tried yet.
There is no way MMEdit can use SSH although I will dust off a copy of plink and see what hope there is that way.

Well done Peter
Jim

VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8578
Posted: 11:29pm 04 Apr 2017
Copy link to clipboard 
Print this post

Jim

Thanks for the report - I've made single vs double floating point a compilation option and missed one instance. Fixed in the attached.

I've also added the DIR$ function and an edit capability

If you type edit the program will save any program in memory to disk and open it for edit in a simple Linux editor (nano). When you have edited the program type ctrl-O to write the edited version to disk (accept the proposed filename) and ctrl-X to exit the editor. MMBasic will automatically load up the edited version ready for use.

This is tested and works nicely using Teraterm on a PC over SSH

This allows programs on a Pi to be remotely maintained over the network (NB the Pi 3 has built in wifi)

2017-04-05_092850_mmbasic.zip
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 261
Posted: 09:54am 05 Apr 2017
Copy link to clipboard 
Print this post

Ran several of my programs on a Raspberry Pi 2 without any problems.

I'm using a USB mouse and keyboard along with an HDMI monitor to communicate with the Pi. Web connection via the Ethernet socket on the Pi.
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5901
Posted: 02:52pm 05 Apr 2017
Copy link to clipboard 
Print this post

It works well with nano as the editor. When you exit nano, the mmbasic command prompt is there but the nano screen is still showing so the mmbasic prompt is not very obvious.
That is something that I have got used to with the limited Linux work I do but it is worth mentioning.

If you prefer to write your code on a Windows PC you can easily transfer it to the Pi with
copy the code to the clipboard
In TeraTerm:
NEW
AUTO
paste the code into TeraTerm (right click)
^C
Other useful commands are ^Z or QUIT to exit mmbasic and return to the Pi command prompt.

Get serial ports working and I won't have to get my hands dirty learning Python.

Jim
VK7JH
MMedit   MMBasic Help
 
isochronic
Guru

Joined: 21/01/2012
Location: Australia
Posts: 689
Posted: 05:38pm 05 Apr 2017
Copy link to clipboard 
Print this post

Does the pi version include lcd screen buttons, cfunctions etc ?
(I only ask as part of thinking about the difference between running in interpreted and compiled environments, especially linux etc)
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5901
Posted: 06:34pm 05 Apr 2017
Copy link to clipboard 
Print this post

Think of the DOS version but double precision floating point and 64-bit integers.
No serial, I2C etc and no LCD (Yet)

Being a multitasking environment, accurate timing could be difficult.
Pi's are also missing analogue inputs which has always been a bugger.

Jim

VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8578
Posted: 09:23pm 05 Apr 2017
Copy link to clipboard 
Print this post

  Quote  Does the pi version include lcd screen buttons, cfunctions etc ?


It will include full LCD support on a limited selection of LCD types. It won't include CFunctions but the Pi version of MMBasic is very fast anyway

  Quote  Pi's are also missing analogue inputs


Correct but I'll support an external ADC (proposals?) in MMBasic

  Quote  No serial, I2C etc and no LCD (Yet)

Being a multitasking environment, accurate timing could be difficult.


Serial, I2C, onewire etc. are all intended to be supported. I believe I can get round the timing issue but MMBasic is likely to need to be run as root

"sudo ./mmbasic"

I would appreciate help from any Linux gurus as to how to run a copy of MMBasic from boot of the Pi for true embedded applications. It would use the GPIO pins UART as the console.Edited by matherp 2017-04-07
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 09:45pm 05 Apr 2017
Copy link to clipboard 
Print this post

NIFTY !!!!!!! ........ Can this help ? .......
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3656
Posted: 10:08pm 05 Apr 2017
Copy link to clipboard 
Print this post

Do you want it to be run under Linux or stand-alone?

Also, do you want a real-time version or happy to be scheduled in whatever way the OS chooses?

In effect these may come down to whether you're wanting something akin to the DOS/Windows (EXE) version or want something like on a 'mite. (There's quite a spectrum between these.)

Judging by the non-Linux things around you could go for a stand-alone mmbasic along the lines of all the others (except the EXE).

Running under Linux of course provides things like TCP/IP (internet), lots of file systems, even virtual memory (not really wanted for mmbasic).

John
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8578
Posted: 10:36pm 05 Apr 2017
Copy link to clipboard 
Print this post

The intention is to run under linux but use some tricks to turn off the Linux scheduler when doing specific real-time actions. The I/O will probably be a combination of pigpio + other bits when needed
 
flip
Senior Member

Joined: 18/07/2016
Location: Australia
Posts: 114
Posted: 12:55am 06 Apr 2017
Copy link to clipboard 
Print this post

This is brilliant!

Once serial is implemented (and if I/O super-speed isn't needed) we can always use a slave uMite (28-pinner under AU$5 in quantity) in command mode to perform all the analogue and digital I/O this will keep all the code and I/O 'mitey.
Regards Phil
 
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 06:07am 06 Apr 2017
Copy link to clipboard 
Print this post

> how to run a copy of MMBasic from boot of the Pi

https://www.dexterindustries.com/howto/run-a-program-on-your-raspberry-pi-at-startup/
 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 261
Posted: 06:51am 06 Apr 2017
Copy link to clipboard 
Print this post

While poking around the applications on the Raspberry Pi, I discovered a very useful text/programmer editor named Geany (geany.org). I pulled in a MMBASIC program and the Geany sidebar displayed the names and locations of functions, subroutines, variables and constants within the source code.

It shows the line numbers of these items and lets you jump to their location in the file by simply clicking on the name of the item of interest. Keywords within the file are displayed in bold text. It appears to also "hold" the indentation.

Geany appears to be an IDE (Integrated Development Environment). I'm running it on both Raspian and Windows 7. Now to find a way to send the file to the eXtreme!
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8578
Posted: 08:54am 06 Apr 2017
Copy link to clipboard 
Print this post

The Pi 3 is ridiculously fast

The attached version implements simple digital I/O

SETPIN x,DIN [,pullup] [,pulldown]
setpin x,dout
setpin x,off

pin(x)=1
pin(x)=0
? pin(x)

NB: The pin number refers to the physical pin on the 40-pin connector and not the Broadcom GPIO number

the following loop has a cycle time of 3.3 microseconds!!!!!





[code]do:pin(7)=1:pin(7)=0:loop[/code]

2017-04-06_184832_mmbasic.zip

The file must now be run as root to get priority access to the GPIO so use

sudo ./mmbasic





 
     Page 1 of 16    
Print this page
© JAQ Software 2024