Page 1 of 1

Accessing GPIO pins from RISC OS BBC BASIC

Posted: Fri Nov 09, 2012 10:31 am
by pointyhat
Before I go and splash out any cash, does anyone know if you can access the GPIO pins on a Raspberry Pi via BBC BASIC via RISC OS?

I have fond memories of having various things hanging out of the back of an A3000 with user port podule and would like to do the same thing again :)

I remember doing the following from CLI to turn everything on - similar thing with BBC BASIC except loading the registers via a procedure that called an inline assembler function :).

*FX 150, &61, &FF

Re: Accessing GPIO bins from RISC OS BBC BASIC

Posted: Fri Nov 09, 2012 1:34 pm
by NigelJK
Have a read of this topic, it shows 'how to'. http://www.raspberrypi.org/phpBB3/viewt ... 3&start=50
Strictly speaking these sorts of things should go in the 'programming->other' forum (at least so the BBCBasic thread gets bumped ;)

Re: Accessing GPIO bins from RISC OS BBC BASIC

Posted: Wed Nov 21, 2012 10:31 am
by neilf
Before I go and splash out any cash, does anyone know if you can access the GPIO pins on a Raspberry Pi via BBC BASIC via RISC OS?
See thread at:
https://www.riscosopen.org/forum/forums/5/topics/1445

Re: Accessing GPIO bins from RISC OS BBC BASIC

Posted: Wed Nov 21, 2012 11:18 am
by nr.
Yup - I've been busy playing with just this over the past couple of days. Take a quick look at http://www.raspberrypi.org/phpBB3/viewt ... 42&t=23384 for an example. In this instance I'm using the GPIO pins to drive a gertboard, but that's incidental really.

I'm conscious of the fact that this information seems to be getting spread out over a number of sites, and threads within those sites. I'll have a look and see if there's a handywiki available where I can start to consolidate some of this stuff. Unless someone has already started on it that is :)

Ta,

Re: Accessing GPIO bins from RISC OS BBC BASIC

Posted: Sun Jun 16, 2013 10:50 am
by doglitbug
Let me know if you find a wiki. I would love to have a place for RISC OS information but purely for the raspberry pi distribution(up to date PRMs, tutorials etc) but I don't think such a project exists yet :-(

Re: Accessing GPIO pins from RISC OS BBC BASIC

Posted: Sun Jun 16, 2013 10:51 am
by mahjongg
http://elinux.org/RaspberryPiBoard
not specific for RiscOS though.

Re: Accessing GPIO pins from RISC OS BBC BASIC

Posted: Sun Jun 16, 2013 11:20 am
by grizzler
The RISC OS Open wiki has sections on the PRMs and the Raspberry Pi.

https://www.riscosopen.org/wiki/

The Introduction page also has links to other sites with possibly useful info.

Re: Accessing GPIO bins from RISC OS BBC BASIC

Posted: Sun Jun 16, 2013 11:25 am
by AMcS
doglitbug wrote:Let me know if you find a wiki. I would love to have a place for RISC OS information but purely for the raspberry pi distribution(up to date PRMs, tutorials etc) but I don't think such a project exists yet :-(
To a large extent that's true, there are "snippets" of information here and there. The PRM's distributed in the Pi RISC OS image go back to RISC OS 3.xx so are not quite up to date but do give useful pointers and get across key concepts in RISC OS - but then miss out entirely on the new hardware abstraction layer and the 32 bit stuff.

A good (alternative) way to start is by looking at the "online" PRM wiki run by RISC OS Open - it isn't entirely complete but is more up to date than the PDF PRMs in the Pi image. (Link to the online wiki is - https://www.riscosopen.org/wiki/documen ... %20Manuals).

The RaspberryPi RISC OS distribution (RISC OS 5.19 RC8) is very similar to a normal RISC OS 5.xx distribution - the hardware is "abstracted" away by the HAL - and all the other stuff (largely) is like what you get on other RISC OS 5 computers - like the Iyonix. Now there are differences (Iyonix has PCI, a real-time clock/non-volatile RAM etc.,) - while the PI doesn't but for most common activities they're the same.

The online PRM wiki is probably the closest to the a "unified" PRM resource - but you'll still need to refer back to the paper/PDF version for some extended explanations or where parts are not yet completed in the online resource.

Hope that helps !

Re: Accessing GPIO pins from RISC OS BBC BASIC

Posted: Tue Feb 20, 2018 5:23 pm
by gastorro
That's exactly what I'm looking for :
How to control the GPIO pins of my Raspberry Pi 3 Model B from a 'BBC BASIC'/(in 'RISC OS Pico image' or 'RISC OS Pi image') program.

For example, here's how to blink the green LED on the RPi3 board with the other implementation of BASIC ( the IchigoJam BASIC ),
10 LED 1
20 WAIT 30
30 LED 0
40 WAIT 30
50 GOTO 10

The code for that ^^ LED function was obviously re-written (probably in C or assembly) by someone,
to match the specifics of this (Raspberry) board (Thank you btw!)
But this ^ ported version of the IchigoJam BASIC offers only 1KB of program space.. So I prefer RISC OS' BBC BASIC
_________

So how do I blink the green LED in BBC BASIC ? ( for starter..)

Re: Accessing GPIO pins from RISC OS BBC BASIC

Posted: Sun Sep 09, 2018 6:31 pm
by DavidS
gastorro wrote:
Tue Feb 20, 2018 5:23 pm
That's exactly what I'm looking for :
How to control the GPIO pins of my Raspberry Pi 3 Model B from a 'BBC BASIC'/(in 'RISC OS Pico image' or 'RISC OS Pi image') program.

For example, here's how to blink the green LED on the RPi3 board with the other implementation of BASIC ( the IchigoJam BASIC ),
10 LED 1
20 WAIT 30
30 LED 0
40 WAIT 30
50 GOTO 10

The code for that ^^ LED function was obviously re-written (probably in C or assembly) by someone,
to match the specifics of this (Raspberry) board (Thank you btw!)
But this ^ ported version of the IchigoJam BASIC offers only 1KB of program space.. So I prefer RISC OS' BBC BASIC
_________

So how do I blink the green LED in BBC BASIC ? ( for starter..)
Well unfortunately the SWI's have changed a little. Thought it is just looping with a wait and toggleing the state of the pin, like any language. Look at the current GPIO Strong Help manual for reference on how to change the pin state (sorry I have went back to directly writing to the GPIO registers without the GPIO module, at least in RISC OS).