![]() |
Forum Index : Microcontroller and PC projects : PicoMite/PicoMiteVGA V5.07.04 betas
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
This is exactly how "gonzo" works ![]() Best wishes, Tom MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4854 |
Oh, about interrupts... In MMBasic you can define interrupts (timer, interrupt on edges etc), and these are called interrupts, but they are actually polled at the end of each executed basic statement (I have been told). Actually, all computer interrupts are fed to the processor syncronous with the CPU execution clock, so they are "polled" too. In this perspective I was thinking of a loop that polls if there is data in the RS232 RX, and when there is, that data can contain an interrupt symbol. So a polled interrupt based on the data in the RX buffer (in example a "!" could be a interrupt message, send from the pico). A question and answer could determine what it was, or the trailing information after the "!" could contain that info. Having an interrupt when there is data in the RX buffer is even better, no need for polling... (Thanks TassyJim). Honestly, since parallel ports disappeared from the PC, I have been looking for ways to do this, but never found a good hobby solution. Yes there is professional stuff, ranging from complete PLC's, National Instruments card cages etc.. But that was all outside my league (hobby). The best I found so far is my tinybasic Arduino solution that works similar to what I described in previous post. But it is limitted to digital and analog IO. It can't do SPI, it can't do I2C, it has no floating point variables and uses 16 bit integers only, it can's do the super duper things MMBasic can. But i can run a 1 kbyte program that does some real-time stuff, and send the output to the PC. But mostly it is used to check events and output digital IO. Something like DW.3,1 'digital write 1 to pin 3, automatically changes data direction if wrong ?DR.(4) 'read digital input 4, and print (send to PC) And DW. is the normal abbreviation of DWRITE (you can use both) a tinybasic command. Edited 2022-02-23 07:18 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7503 |
Not strictly correct about all interrupts being polled. A true interrupt pin on a cpu is, as you say, synchronous with the system clock but in most cases it is operated on on the next clock cycle as it's handled in hardware. The CPU isn't running a program that tests the interrupt pin every so often, which is the normal meaning of a polled input. You can usually get a "soft" interrupt that says there are characters in the input buffer of a port. Even if it's a flag that has to be polled rather than an interrupt it would be very fast to test as you aren't actually reading the buffer all the time. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3309 |
It's less than 2 dozen lines on the slave (Picomite), and offers the following functions for each appropriate pin (which can easily enough be expanded for other commands): 0 Not configured or inactive 1 Analog input 2 Digital input 3 Frequency input 4 Period input 5 Counting input 8 Digital output 9 Open collector digital output. In this mode SPIN() will also return the value on the output pin. (And it's not re-inventing the wheel--if it suits the need.) PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7503 |
It's also what I'm intending to use on my expansion boxes. :) Geoff used the watchdog too. If the Micromite gets knotted up it'll reset to a safe condition of everything off. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10066 |
I'll implement execute for the PicoMite in the next beta (thought I already had). This will make the required application that bit easier. |
||||
led-bloon![]() Senior Member ![]() Joined: 21/12/2014 Location: AustraliaPosts: 207 |
Using hardware platform Seeed XIAO RP2040 14 pin device with 4 ADC pins GP26-GP29 (GP29 extended out unlike pico) PicoMiteV5.07.03 & PicoMiteV5.07.04b4 Setting GP29 in code as DIN/DOUT not a problem, acts like any other GPIO pin with suitable code. Try to set OPTION SDCARD GP29,GP26,GP27,GP28 on reset/boot system either hangs or prints out: "Pin 44 is reserved on startup" then hangs. led Miss you George |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10066 |
This is a limitation. You can't use pins that aren't broken out on the Pico for fixed Options. I'll put in a block in the OPTION command UPDATE: I think I can find a way of allowing what you want - watch this space Edited 2022-02-23 20:27 by matherp |
||||
Lou![]() Senior Member ![]() Joined: 01/02/2014 Location: United StatesPosts: 229 |
@ Bleep Kevin, will your project run on a PicoMite with a Waveshare 2.8" display? I have some Pico boards and some 2.8" touch displays but no RTC. I have little time and wanted a quick and easy PicoMite project to test the hardware, I love your project. Thanks, Lou Microcontrollers - the other white meat |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3309 |
Geoff's I2C slave code for the MX170 under "A More Complex I2C Example" in the "Getting Started With the Micromite" manual depends on using these values with SETPIN: 0 Not configured or inactive 1 Analog input 2 Digital input 3 Frequency input 4 Period input 5 Counting input 8 Digital output 9 Open collector digital output. In this mode SPIN() will also return the value on the output pin But on the picomite, if I enter SETPIN 1,8, expecting it to be the equivalent of SETPIN 1,DOUT, I get: Error: Invalid address - resetting Am I doing it wrong or is there another set of values (numbers corresponding to DIN, DOUT, CIN, etc.) which would be used on the picomite? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2415 |
I think you may need to change the name of SUB SETPIN to avoid conflict with the Pico's own SETPIN command. |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3309 |
If you were responding to my post, there is no SUB SETPIN--my example was using SETPIN on the command line with a numeric value instead of DOUT (a numeric value which apparently works on an MX170). PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2415 |
From the section:- "Interface Routines on the Master ' set the output of an I/O pin on the slave SUB SETPIN pinnbr, dat I2C OPEN 100, 1000 I2C WRITE &H26, 0, 3, 2, pinnbr, dat IF MM.I2C THEN ERROR "Slave did not respond" I2C CLOSE END SUB " If I have understood the manual it is this Sub that is needed to control the MM2 output. If the Pico doesn't have it you will trying to control the Pico's own pins, not the MM2. To minimize confusion I would rename it SETPIN2. Before using that command to set the pin output the pin must be configured with:- ' configure an I/O pin on the slave SUB SSETPIN pinnbr, cfg I2C OPEN 100, 1000 I2C WRITE &H26, 0, 3, 1, pinnbr, cfg IF MM.I2C THEN ERROR "Slave did not respond" I2C CLOSE END SUB So to setup pin 1 as DOUT SSETPIN 1,8 then to set it to 1 SETPIN2 1,1 'assuming the sub SETPIN is renamed SETPIN2 That is what I understand the manual to mean. |
||||
led-bloon![]() Senior Member ![]() Joined: 21/12/2014 Location: AustraliaPosts: 207 |
@matherp re: Hardware board Seeed XIAO RP2040 and GP29 Probably not worth your time, as this and the other "cute" smaller offerings from Sparkfun & Pimoroni have little to offer the PicoMite family. Smaller size, fewer pins (and a fourth ADC I/P!) at two to three times the price (the XIAO admittedly only 1 1/2 times price)! No big deal. Thought it might have been a simple over-sight. Thanks anyway led Edited 2022-02-24 14:21 by led-bloon Miss you George |
||||
Volhout Guru ![]() Joined: 05/03/2018 Location: NetherlandsPosts: 4854 |
@Tom, Impressive piece of code, this "gonzo" project of yours. That where quite some hours of coding. I can honestly say that I don't understand it completely, but I see that you stubled upon the echo thing also. You have specific routines "read until matched" to find the location in the serial stream where you expect an answer to come. And ... It is obvious that you are an experienced programmer. I haven't tried it yet. MMB4L is next on the list... To be able to run MMB4L I decided to re-image my linux laptop with a more modern 64 bit linux, and I am still working on getting everything else working (Ubuntu from 32 bit 16.04.7 to 64 bit 20.04.3). There is quite a lot of 32 bit stuf that needs ppa's and apt-get's .. but almost there. Regards, Volhout P.S. My picomites finally arrived after being held captive in chineese new year.... PicomiteVGA PETSCII ROBOTS |
||||
thwill![]() Guru ![]() Joined: 16/09/2019 Location: United KingdomPosts: 4251 |
Yup. Note that it's very much WIP and still quite fragile. I'm writing it to both exercise MMB4L's serial comms and also to provide a utility to simplify the process of developing MMBasic programs on Linux and then deploying them to the PicoMite (something that others based on Windows use MMEdit for). Ultimately I hope to be able to use it to automatically transpile my unit-tests on Linux, send them to the PicoMite and then remotely execute them and retrieve the results. And still learning ![]() Best wishes, Tom Edited 2022-02-24 23:15 by thwill MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3309 |
What you have pointed to is on the master side. I'm looking at the Picomite as a slave (and have converted to serial instead of I2C, but that doesn't matter for this question). On the slave side, what Geoff's code does for msg(0)=1 is effectively SETPIN pin, action, where pin is msg(1) and action is msg(2), so in effect, for pin 1 and DOUT, the command which apparently works on the MX170 is SETPIN 1,8. This doesn't work on the Picomite, perhaps because the constants for DIN, DOUT, etc. have changed, or perhaps because of some other code change. It will be easy enough to use a SELECT statement and CASE 1-10 for SETPIN 1,DIN or SETPIN 1,DOUT, etc.--but it does expand Geoff's elegant code. ~ Edited 2022-02-24 23:49 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10066 |
The PicoMite does not,can not, and will not support numerical codes for setpin it conflicts with the expanded use of setpin to support the Pico's flexible peripherals - sorry |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7503 |
As far as I'm concerned the code expansion is irrelevant. For a start, the PicoMite has vastly more memory and speed available and secondly the slave code is still tiny. A SELECT command is more explanatory (and more flexible) and might still be faster than the Micromite. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3309 |
Ok, no problem. Thanks for the explanation. "Select" it is. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |