- Added support for serial I/O, for example the EXT# function returns the number of characters waiting in the input buffer.
- Added a new example program animal.bbc which is the famous 'guess the animal' program, which learns from its mistakes (sort of).
New: Console Mode editions of BBC BASIC
Re: New: Console Mode editions of BBC BASIC
Richard has updated the Console Mode editions of BBC BASIC to version 0.41. The changes in this version are:
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Re: New: Console Mode editions of BBC BASIC
I have been playing with BBC Basic on the Pico. It's great. I am trying to do some I/O. I can set a bit to output and make it high with:
And I can make it an input with:
And read it's state with
But how can I get the state of a pin into a variable? state%=SYS "gpio_get", dataPin% throws an error...
Code: Select all
SYS "gpio_set_dir", pin%, 1
SYS "gpio_put", pin%, 1
Code: Select all
SYS "gpio_set_dir", pin%, 0
Code: Select all
SYS "gpio_get", pin%
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN
Re: New: Console Mode editions of BBC BASIC
Try:roland wrote: ↑Sun Mar 19, 2023 4:57 pm And read it's state with
But how can I get the state of a pin into a variable? state%=SYS "gpio_get", dataPin% throws an error...Code: Select all
SYS "gpio_get", pin%
Code: Select all
SYS "gpio_get", pin% TO value%
Re: New: Console Mode editions of BBC BASIC
Thanks Dave, that works
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN
Re: New: Console Mode editions of BBC BASIC
Richard has updated his Console Mode editions of BBC BASIC to version 0.42. The changes in this version are:
- Added new command-line options: -help, -load and -quit:
- -help lists a brief description of these options.
- -load loads the (tokenised) program specified subsequently on the command line, but doesn't run it (it enters immediate mode).
- -quit runs the subsequently-specified tokenised program, but when that program terminates (either normally or because of an error) quits rather than entering immediate mode. In the event of an error the exit code is set to the BBC BASIC error number.
- Enabled the *FLOAT 80 command in ARM editions, because it's the only way of reading & writing 64-bit integers in a file!
- Added two new libraries: socklib.bbc and mysqllib.bbc. These provide the same capabilities as the libraries with the same names supplied with BBC BASIC for Windows and BBC BASIC for SDL 2.0.
- Added new example programs: client.bbc, server.bbc, lanchat.bbc and mysqldem.bbc. These work the same as the example programs with the same names supplied with BBC BASIC for Windows and BBC BASIC for SDL 2.0.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Re: New: Console Mode editions of BBC BASIC
Another challenge .... does somebody have an example for I2C on the Pi Pico with BBC Basic? Searches on the internet only come up with micropython or C examples.
This is a part of an example program I found:
So for example ... how can I initiate the i2c instance just like the marked line in BBC Basic. The other functions will probably be sys-calls like
And replace GPIO_FUNC_I2C with it's value, whatever that may be.... (probably 3)
This is a part of an example program I found:
Code: Select all
int main() {
// Pins
const uint sda_pin = 16;
const uint scl_pin = 17;
// Ports
i2c_inst_t *i2c = i2c0; <----- how do I do this in BBC Basic?
//Initialize I2C port at 400 kHz
i2c_init(i2c, 400 * 1000);
// Initialize I2C pins
gpio_set_function(sda_pin, GPIO_FUNC_I2C);
gpio_set_function(scl_pin, GPIO_FUNC_I2C);
Code: Select all
sda_pin%=16
sdc_pin%=17
SYS "gpio_set_function", sda_pin, GPIO_FUNC_I2C
FPGAtom: 512 KB RAM, Real Time Clock and 64 colours
MAN WOMAN
MAN WOMAN
Re: New: Console Mode editions of BBC BASIC
this might be better asked here: Introduction to BBC BASIC - Page 41 - Raspberry Pi Forums or on the developer's github: Memotech-Bill/PicoBB: BBC BASIC for Raspberry Pi Pico.
I agree, there appears to be no documented way to access this.
I agree, there appears to be no documented way to access this.
Re: New: Console Mode editions of BBC BASIC
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Re: New: Console Mode editions of BBC BASIC
yeah, that one too. Does Memotech Bill hang out there, though? Richard hasn't done much on the Pico version
Re: New: Console Mode editions of BBC BASIC
No, but Richard might have some input on addressing the GPIO from BBC BASIC.
Matrix Brandy BASIC VI (work in progress) The Distillery (another work in progress) Note Quiz (New educational software for the BBC and modern kit)
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
BBC Master 128, PiTubeDirect (Pi 3B), Pi1MHz, 5.25+3.5in dual floppy.
Re: New: Console Mode editions of BBC BASIC
Since i2c_inst_t is likely to be a structure type, with i2c initialised to being a pointer to the predefined i2c0 structure, you probably want to find out what the details of i2c_inst_t are and what i2c0 is defined as.roland wrote: ↑Wed Mar 29, 2023 8:15 pm Another challenge .... does somebody have an example for I2C on the Pi Pico with BBC Basic? Searches on the internet only come up with micropython or C examples.
This is a part of an example program I found:
Code: Select all
// Ports i2c_inst_t *i2c = i2c0; <----- how do I do this in BBC Basic?
I can imagine that i2c_inst_t just reflects the memory layout of the I2C peripheral in the microcontroller, and i2c0 is the address of the first I2C peripheral. Then, the i2c_init function probably just accesses locations relative to the supplied i2c address.
You could probably define a BASIC procedure equivalent to i2c_init...
Code: Select all
DEF PROCi2c_init(i2c, frequency)
i2c!xxx = frequency
ENDPROC