Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 00:46 21 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 15 of 16    
Author Message
hitsware
Guru

Joined: 23/11/2012
Location: United States
Posts: 535
Posted: 12:25pm 23 Jun 2017
Copy link to clipboard 
Print this post

> "Save" in the editor moves the program from the edit buffer
> and "saves" it in normal RAM ready for execution.
> Unlike the Micromite, the Raspberry Pi always has a SD card available so,
> to save for next time,
> it is just a matter of saving to disk once you have exited the editor.

???????????????????????? save ?????? from ???? to ??????
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 712
Posted: 12:41pm 23 Jun 2017
Copy link to clipboard 
Print this post

  hitsware said   > "Save" in the editor moves the program from the edit buffer
> and "saves" it in normal RAM ready for execution.
> Unlike the Micromite, the Raspberry Pi always has a SD card available so,
> to save for next time,
> it is just a matter of saving to disk once you have exited the editor.

???????????????????????? save ?????? from ???? to ??????



Ahhhhh.....
So it was not the reason of not understanding it, because English is not my native language.
I also did not understand it😄😄

Please explain it again Peter...

Thank you
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5886
Posted: 12:43pm 23 Jun 2017
Copy link to clipboard 
Print this post

  hitsware said   > "Save" in the editor moves the program from the edit buffer
> and "saves" it in normal RAM ready for execution.
> Unlike the Micromite, the Raspberry Pi always has a SD card available so,
> to save for next time,
> it is just a matter of saving to disk once you have exited the editor.

???????????????????????? save ?????? from ???? to ??????


F1 to exit the editor or ^O ^X if you are using nano

This puts you back at the mmbasic prompt with your program loaded.
SAVE "myprogam.bas"
will save the currently loaded program as myprogram.bas in the current directory on the SD card, overwriting any program of the same name.

LOAD "myprogram.bas"
will load the file myprogram.bas into memory, overwriting the current program in memory.

FILES will list the files in the current directory


VK7JH
MMedit   MMBasic Help
 
RonnS
Senior Member

Joined: 16/07/2015
Location: Germany
Posts: 120
Posted: 06:31am 27 Jun 2017
Copy link to clipboard 
Print this post

System command

Someone knows how I can make a text output from them ??? to display it

system "vcgencmd measure_temp"
or
system 'vcgencmd measure_volts
or
system 'vcgencmd measure_clock arm

thanks for help Ron
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 712
Posted: 06:57am 27 Jun 2017
Copy link to clipboard 
Print this post

Na klar,

write (pipe) output into a file > or >>
and then open this file with mmbasic file open .....

ready
 
RonnS
Senior Member

Joined: 16/07/2015
Location: Germany
Posts: 120
Posted: 10:50am 27 Jun 2017
Copy link to clipboard 
Print this post

thanks Atmega,

meanwhile I have also found Peters guidance


  matherp said   WW asked the following question by PM

  Quote  Is there a way to 'intercept' any 'reply' from a SYSTEM command?

For example: a$ = SYSTEM "date"


The Pi-cromite does uses the system time and date when you use the normal Basic TIME$ and DATE$

However, more generally you can use standard LINUX notation to capture any SYSTEM output as follows:


System "ls -al >> myfile"
Open "myfile" For input As #1
Do
Line Input #1,a$
Print a$
Loop While Not Eof(#1)
Close #1
Kill "myfile"


Of course rather than just read the file and print it line by line you can do any processing that you wish

 
cdeagle
Senior Member

Joined: 22/06/2014
Location: United States
Posts: 261
Posted: 07:41am 29 Jun 2017
Copy link to clipboard 
Print this post

A useful open source (Linux) desktop publishing program for the Raspberry Pi is Scribus. It's the usual sudo apt-get install scribus to retrieve and install it.

I'm currently using it to view and print eps graphics images.
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 07:50pm 29 Jun 2017
Copy link to clipboard 
Print this post

@matherp

  RonnS said   thanks Atmega,

meanwhile I have also found Peters guidance


  Quote  

However, more generally you can use standard LINUX notation to capture any SYSTEM output as follows:


System "ls -al >> myfile"
Open "myfile" For input As #1
Do
Line Input #1,a$
Print a$
Loop While Not Eof(#1)
Close #1
Kill "myfile"


Of course rather than just read the file and print it line by line you can do any processing that you wish



Is there a way to 'intercept' the SYSTEM response directly into MMBASIC rather than via a file?

The reason for asking is that I need to do a continual SYSTEM command (in a loop meaning about two a second) and I am not wanting to wear out my uSD card with the system that needs to be left on 24/7

Also leads to the question: Are there any MMBASIC commands that you can think of that could 'wear out' the uSD card in general use?

Thanks.

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 712
Posted: 08:46pm 29 Jun 2017
Copy link to clipboard 
Print this post

WW,

the Linux system is permanently writing logfiles in the background /var/Log/messages and many other places.
SD cards have wear leveling algorithms which try to rotate the writes to different locations/ cells.

You should use SD cards with hi capacity 16/32 GB to maximize this effect.
I ave Linux Running on PI over 3 years, with a 4 GB Card and it didn't fail.

DS


 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 09:11pm 29 Jun 2017
Copy link to clipboard 
Print this post

Hi Dietmar,

Thanks for your response.

I guess my concern is that in my solution I would effectively be writing (and then killing) upwards of 7,000 'myflies' every hour ( ) based on the sample code above from Peter.

In my simple world of thinking, I was feeling that this quantity would have an impact on the uSD in a very short time span - even with load balancing. I may be totally wrong, but just doing the simple maths makes me think it would be much better to be able to grab the SYSTEM response directly into MMBASIC.

Ultimately I am 'updating' my original MMBASIC Internet Streaming Radio (which was based on a 28pin BackPack) and bringing it onto the Pi-croMite. I use the popular Music Daemon program (MPD) along with the Music Player Client (MPC) and want to write the song information to the GUI with the 'MPC STATUS' command. It is this command (sent using MMBASIC's SYSTEM command) that I need to intercept on a 'regular' basis. Two to three times a second gives a nice 'responsive' display.

Open to other ideas on 'grabbing' the response from SYSTEM "MPC STATUS >> myflie"

WW



For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
bigfix
Senior Member

Joined: 20/02/2014
Location: Austria
Posts: 124
Posted: 09:25pm 29 Jun 2017
Copy link to clipboard 
Print this post

Phil,
how about a tiny ramdisk for the hot files ?

I am not familar with Raspian at all, but you easily find recipes how to do:
Ramdisk

It is of course volatile - but to handover data it should work

You can also use a real SSD on USB with the RPi3
But it is still challenged a little by excessive writes
(the SSD may last only 20+ years...)
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 09:31pm 29 Jun 2017
Copy link to clipboard 
Print this post

  Quote  Open to other ideas on 'grabbing' the response from SYSTEM "MPC STATUS >> myflie"


I've thought of a way of directing system output to a LONGSTRING

which will allow you to capture and analyse the output in memory. I'll try and post a new release later today
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 09:43pm 29 Jun 2017
Copy link to clipboard 
Print this post

THANKS PETER (you can ignore my last part of the email I just sent!!)

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 712
Posted: 02:35am 30 Jun 2017
Copy link to clipboard 
Print this post

You know, in linux nothing is impossbly, nearly.

Why overlaod Peter and the code with funktions that can easily be done with linux???

A simple mount tmpfs <mountpoint> -t tmpfs -o size=1M will do the job for you
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 02:56am 30 Jun 2017
Copy link to clipboard 
Print this post

  atmega8 said  .. can easily be done with linux???

A simple mount tmpfs <mountpoint> -t tmpfs -o size=1M will do the job for you


Can those two highlighted words really be used in the same sentence?

Ideally want to remain in the MMBASIC environment where command syntax means something obvious

Without Googling, I have no possible sensible guess as to what: tmpfs, -t, or -o do or mean. The language is totally alien to me; but that may just be me!


@matherp

I am not convinced the IR stuff works (or at least with a 4"IPS attached). Have tried a 38KHz, and 40KHz IR receiver on Pin 16 and use the example in the standard MM manual. In my main Do Loop I am just toggling an LED attached to another pin (and updating the Time on the IPS).

Very occasionally I get a response in my IR_Int where I just try and display the DevCode & KeyCode on the IPS. All hardware works ok - tested on a 28pin MM.

Using 5.3.a32 BUT this was implemented in a14.

Can anyone out there run a IR test on the Pi-croMite please and report back Please let me now which version of MMBASIC too!

WW
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 712
Posted: 03:25am 30 Jun 2017
Copy link to clipboard 
Print this post


Can those two highlighted words really be used in the same sentence?

Of course it can, but you must be willing to use your brain, or goggle, better both,
where/what is your problem?
RAMDISK is selfexplaining also for windows/mouse gurus

 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 03:43am 30 Jun 2017
Copy link to clipboard 
Print this post

I believe that if Peter is able to implement the FIELD scenario that he refers to above then the solution will simply be something like:

SYSTEM "MPC STATUS"
Artist$=FIELD....
Track$=FIELD....
(and all contained within MMBASIC)

The above has to be easier than creating a RAMDISK using tmpfs <mountpoint> -t tmpfs -o size=1M
and then loading the SYSTEM "MPC STATUS" response into this RAMDISK, then extracting line by line.

I always look at MMBASIC 'coding' from a beginners point of view, so the easier we can make it, the better the 'end experience' is for the user.

However, that said, you have now highlighted a potentially useful linux feature that I was totally unaware about - it could be very useful for another project I am working on



For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
atmega8

Guru

Joined: 19/11/2013
Location: Germany
Posts: 712
Posted: 10:55am 30 Jun 2017
Copy link to clipboard 
Print this post

No limits to the limits of our imagination 🤓🤓
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 02:03am 06 Jul 2017
Copy link to clipboard 
Print this post

Please find attached version 5.4.a06

2017-07-06_112516_mmbasic.zip

Please delete the OPTIONS file before use: "rm .options"

Changes are:

Bug fixes/changes as per Micromite release 5.4.05


OPTION PINS pinmask specify pins to be excluded from mmbasic e.g. OPTION PINS &B10100 ‘exclude pins 3 and 5 from use by mmbasic

OPTION LIST will report the pinmask if none-zero

SETPIN reservedpin,DOUT will report a reserved on boot error

Once the pins are reserved exit mmbasic and set up the pins as you wish external to mmbasic or do it using system command from within mmbasic

I’ve checked I can waggle pins from LINUX with MMBasic running and that restarting MMBasic does not affect them

SYSTEM "LINUX command" {,longstringarray()}

There is now an additional optional parameter to the system command. This is specified as an integer array which is used to hold a LONGSTRING . The output from the system command will be stored in the array and can be interrogated using the set of LONGSTRING commands and functions. If the output would be longer than the array can hold it will be truncated.

The use of this is shown by this simple example

[code]
DIM INTEGER a(1000)
SYSTEM "ls -al",a()
FOR i=1 to LLEN(a())
print LGETSTR$(a(),i,1);
NEXT i
[/code]

For reference the complete set of LONGSTRING commands and functions are:
LONGSTRING APPEND longstringarray%(), string_to_append$
LONGSTRING TRIM longstringarray%(), number_of_chars_to_remove_from_start
LONGSTRING REPLACE longstringarray%(), new_string$, start_position
LONGSTRING LOAD longstringarray%(), string_to_load$
LONGSTRING LEFT destination_longstringarray%(), source_longstringarray%(), number_of_chars
LONGSTRING RIGHT destination_longstringarray%(), source_longstringarray%(), number_of_chars
LONGSTRING MID destination_longstringarray%(), source_longstringarray%(), start_position, number_of_chars
LONGSTRING CLEAR longstringarray%()
LONGSTRING UCASE longstringarray%()
LONGSTRING LCASE longstringarray%()
LONGSTRING COPY destination_longstringarray%(), source_longstringarray%()
LONGSTRING CONCAT destination_longstringarray%(), source_longstringarray%()

substring$ = LGETSTR$(longstringarray%(), start_position, number_of_chars)
string_length% = LLEN(longstringarray%())
test_string_position = LINSTR(longstringarray%(), test_string$ [,start_position])
string_comparision = LCOMPARE(first_longstringarray%(), second_longstringarray%())

 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8570
Posted: 06:42am 06 Jul 2017
Copy link to clipboard 
Print this post

Please find attached version 5.4.a07

2017-07-06_153723_mmbasic.zip

Please delete the OPTIONS file before use: "rm .options"

This has one more OPTION command

OPTION CLOCK clocktype

Valid values are PCM (default) and PWM. This command is used to specify which of the two main Pi clocks are used for mmbasic. The default allows hardware PWM to be used on pin 12 but will cause external commands using the PCM clock, such as output on the i2s port, to fail.

To understand this together with the previous release consider i2s set up as the main audio output of the Pi. This can be enabled as the default for audio using

sudo curl -sS https://get.pimoroni.com/phatdac | bash


The pinout for i2s is:

Bit-clock : pin 12
LR-clock : pin 35
i2s-data-in : pin 38
i2s data-out : pin 40

These pins can be "protected" from mmbasic using the command

OPTION PINS &HA400000800


The PWM clock must also be used by mmbasic to leave the PCM clock free

OPTION CLOCK PWM


Then an audio file can be played over i2s either external to mmbasic (and unaffected by it), or from mmbasic using any appropriate Linux command

SYSTEM "aplay wavfile"


To play mp3 or flac files over i2s I found mpv worked, omxplayer does not work

[code]sudo apt-get install mpv[/code]
Edited by matherp 2017-07-07
 
     Page 15 of 16    
Print this page
© JAQ Software 2024