Using I2C in BBC Basic on Pi Pico
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). Are there any examples for this?
This is a part of an example program I found:
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);
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
sda_pin%=16 sdc_pin%=17 SYS "gpio_set_function", sda_pin, GPIO_FUNC_I2C
And replace GPIO_FUNC_I2C with it's value, whatever that may be.... (probably 3). Are there any examples for this?
0
Comments
-
Just possibly the posts near this one will help:
https://forums.raspberrypi.com/viewtopic.php?p=2032046#p2032046
0 -
Thanks Ed. I'll give this a try. For now I have written a bit-bang routine and that works also good enough for my purpose.1