![]() |
Forum Index : Microcontroller and PC projects : PicoMite/PicoMiteVGA V5.07.03 release candidates
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
V5.07.03RC14 https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip More bug fixes to CSUB internals New command INTERRUPT [myint] This command triggers a software interrupt. The interrupt is set up using INTERRUPT 'myint' where 'myint' is the name of a subroutine that will be executed when the interrupt is triggered. Use INTERRUPT 0 to disable the interrupt Use INTERRUPT without parameters to trigger the interrupt. NB: the interrupt can also be triggered from within a CSUB: example in another thread Edited 2022-01-15 02:48 by matherp |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1111 |
Peter, Can you tell me what priority the software interrupt has please? Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
V5.07.03RC15 https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip Fixes bugs in PWM (hopefully) Draft manual updated to remove reference to LOAD FONT Don't understand the question. MMBasic interrupts are checked and, if triggered, processed at the end of each Basic statement. The only MMBasic commands that use actual H/W interrupts are SETPIN n,FIN/CIN/PIN but these only use the Interrupt to monitor the pin |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2417 |
"V5.07.03RC15" Many thanks Peter so far it is working perfectly. > pwm 1,200000,50 : pause 2500 : ? pin (9) 199987 > ? pin (9) 199984 measured 199.9kHz > ? pin (9) 199976 > pwm 1,250000,50 : pause 2500 : ? pin (9) 248987 measured 249.9kHz > |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1111 |
In the Micromite manual other sections of MMBasic including timers and communications ports. The list of all these interrupts (in high to low priority ranking) is: 1. CFunction Interrupt 2. ON KEY 3. I2C Slave Rx 4. I2C Slave Tx 5. COM1: Serial Port 6. COM2: Serial Port 7. COM3: Serial Port (MM+ only) 8. COM4: Serial Port (MM+ only) 9. GUI Int Down (MM+ only) 10. GUI Int Up (MM+ only) 11. WAV Finished (MM+ only) 12. IR Receive 13. I/O Pin Interrupts in order of definition 14. Tick Interrupts (1 to 4 in that order) As an example: If an ON KEY interrupt occurred at the same time as a COM1: interrupt the ON KEY interrupt subroutine would be executed first and then, when the interrupt subroutine finished, the COM1: interrupt subroutine would then be executed. I was wondering where in this list the software interrupt would be? ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
flasherror Senior Member ![]() Joined: 07/01/2019 Location: United StatesPosts: 159 |
I am allocating Picomite VGA I/O for something I am working on. I am one I/O short. Is it possible to configure Picomite VGA so that instead of 2 bits green output (when in color mode) it can use one green bit/GP20 leaving the other green GP19 available for use as general I/O? This would reduce colors to one bit R/G/B which is enough for displaying status in different colors etc (still an advantage over mono/green VGA). I could use VGA mono/green and free up 3 more I/O but only really need one more, plus I'd like to retain some color capability. Edited 2022-01-17 11:57 by flasherror |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2417 |
If I have understood the description of PicoMite VGA, the VGA driver is running in the second core making those pins allocated to it inaccessible to MMBasic programs, which can only directly access pins allocated to the first core. A different version of PicoMite VGA might be needed with different pin allocation to get what you want. The correct answer will have to await Peter's return. There are a number of I/O expansion methods available. |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2417 |
Plan B In the "PicoMite VGA Check" thread there is a description of how to re-map the colours to get RGB+Intensity - RGIB(1,1,1,1). Use that scheme except use the intensity bit (GP19) as a digital output. Create a different map to give separate control of the I bit. If you just use a RGIB map, in your program for a high output use bright colours and for low use dim colours. As the intensity bit is not controlling the display all colours will be bright. A crude sample-and-hold will remove frame flicker from the output. eg: ![]() Edited 2022-01-17 15:41 by phil99 |
||||
Mixtel90![]() Guru ![]() Joined: 05/10/2019 Location: United KingdomPosts: 7512 |
Another way is to do something with the onboard LED output (on a pad on the bottom of the board). Note that it only goes up to about Vf for the LED though (about 2v) as it's connected directly to the RP2040 pin. It would turn a transistor on via a base resistor though. Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
To go into the next version of the manual The list of all these interrupts (in high to low priority ranking) is: 1. ON KEY individual 2. ON KEY general 3. GUI Int Down (not PicoMiteVGA) 4. GUI Int Up (not PicoMiteVGA) 5. ADC completion 6. I2C Slave Rx 7. I2C Slave Tx 8. I2C2 Slave Rx 9. I2C2 Slave Tx 10. WAV Finished 11. COM1: Serial Port 12. COM2: Serial Port 13. IR Receive 14. Keypad 15. Interrupt command/CSub Interrupt 16. I/O Pin Interrupts in order of definition 17. Tick Interrupts (1 to 4 in that order) As an example: If an ON KEY interrupt occurred at the same time as a COM1: interrupt the ON KEY interrupt subroutine would be executed first and then, when the interrupt subroutine finished, the COM1: interrupt subroutine would then be executed. VGA mechanism can't be changed to free a pin Look at the We-Act Pico which has 2 more pins available on same footprint. Minor wiring changes needed (3V3 pin location) |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2400 |
Don't understand the question. I was wondering where in this list the software interrupt would be? Doug, you may like to have a look at the example here: https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=14475 ("A PicoMite CSUB to timestamp pin changes") strictly speaking, it is not an 'interrupt' so much as a 'callback'. as far as i can determine, peter has implemented the Interrupt command to allow for a basic routine that can be called once or periodically by a csub. this allows a csub to carry on running in the background and indicate that data is ready through a call to the basic (callback) routine: ' configure the basic callback handler Interrupt MyCallBack ' initialize some variables Dim a%(100) [...] ' initialize the csub, that contains a periodic component that stays running while MMbasic carries on MyCSub a%(), b%, c% ' wait forever Do: Loop End Sub MyCallBack [...] End Sub CSub MyCSub [...] End CSub MyCSub contains two distinct parts: (1) a configuration part that is run once when called from the user's MMbasic program, and (2) a periodic part that is called multiple times in the background by the firmware (a bit like a timer interrupt routine, but with different trigger events). when the periodic part reaches a 'finished' state (for instance after collecting 100 data samples), it then triggers MMbasic to call MyCallBack where the collect data is printed out, or whatever else. it is not clear if upon exiting MyCallBack that MyCSub will then carry on running and collecting more data. i think i've got this right! personally, i'd have not done it this way. in peter's example the callback routine violates the rules of an interrupt by (a) doing complex processing, and (b) halting the program! i would have instead used some sort of a semaphore or flag of some sort. so the call to MyCSub would be of the form log a%(), b%, c%, MyFlag, where the CSub was able to change the value of MyFlag to reflect what it was doing (collecting data, waiting for data to be used my the user's MMbasic program, etc). the main loop of the MMbasic program would then look something like: Do Do: Loop Until MyFlag for I=1 to 100 print a%(I), [...] MyFlag=0 Loop End MyCsub could be arranged so that if MyFlag=1 then it would idle, doing nothing, and if MyFlag=0 then it would collect data (or whatever else it does when active). there is then no need for the Interrupt command and no need for the user to implement a MyCallBack routine. but that is just how i would have done it. cheers, rob :-) Edited 2022-01-17 19:08 by robert.rozee |
||||
disco4now![]() Guru ![]() Joined: 18/12/2014 Location: AustraliaPosts: 971 |
I think this is valid code. It looks like when the SUB myint is called by the Interrupt command it does not step to the next instruction when the SUB returns. It prints "hello from interrupt" until you CNTRL+C it. Interrupt myint Print "ONE" Pause 1000 Interrupt Pause 1000 Print "two" End Sub myint Print "hello from interrupt" End Sub Latest F4 Latest H7 FotS |
||||
panky![]() Guru ![]() Joined: 02/10/2012 Location: AustraliaPosts: 1111 |
My original thought on usage for myself was that I could invoke the INTERRUPT command when I wanted to run some code that I could ensure that would not be interrupted itself - not an intended use by Peter I'm sure ![]() Thanks to both Peter and Rob for their replies - will study thoroughly. Doug. ... almost all of the Maximites, the MicromMites, the MM Extremes, the ArmMites, the PicoMite and loving it! |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
That will work. Interrupts are never interrupted. The ordering just selects which one executes to completion first if there are more than one extant |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 3998 |
It prints "hello from interrupt" until you CNTRL+C it. Interrupt myint Print "ONE" Pause 1000 Interrupt Pause 1000 Print "two" End Sub myint Print "hello from interrupt" End Sub Looks like a bug! Or, odd at least. John |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
Yes, forgot to clear the interrupt ![]() |
||||
flasherror Senior Member ![]() Joined: 07/01/2019 Location: United StatesPosts: 159 |
In the "PicoMite VGA Check" thread there is a description of how to re-map the colours to get RGB+Intensity - RGIB(1,1,1,1). Use that scheme except use the intensity bit (GP19) as a digital output. Create a different map to give separate control of the I bit. If you just use a RGIB map, in your program for a high output use bright colours and for low use dim colours. As the intensity bit is not controlling the display all colours will be bright. A crude sample-and-hold will remove frame flicker from the output. This is interesting but what happens during reset (Picomite VGA output startup message so activity on GP19?) According to manual: "SETPIN GP25, DOUT | HEARTBEAT This version of SETPIN controls the on-board LED. If it is configured as DOUT then it can be switched on and off under program control. If configured as HEARTBEAT then it will flash 1s on, 1s off continually while powered. This is the default state and will be restored to this when the user program stops running." I guess that means the heartbeat will run on power-up which is not good for whatever's connected to the pin? There doesn't seem to be a way to disable heartbeat entirely so the I/O could be freed up for other use, unless I have missed something. Look at the We-Act Pico which has 2 more pins available on same footprint. Minor wiring changes needed (3V3 pin location) Thanks, wasn't aware of this board. Does WeAct only sell through their store? (i.e. no resellers on ebay etc) Edited 2022-01-18 00:43 by flasherror |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
V5.07.03RC16 https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip Fixed bug in INTERRUPT introduced in RC14 OPTION CPU TURBO ON/OFF no longer exists on the VGA version for compatibility reasons instead use: OPTION CPUSPEED 126000 or OPTION CPUSPEED 252000 Manual fully updated to cover PicoMite and PicoMiteVGA. NB: indexing currently not fully correct |
||||
robert.rozee Guru ![]() Joined: 31/12/2012 Location: New ZealandPosts: 2400 |
hi Peter, regarding INTERRUPT [myint] (pg 100 of the 'user manual'), is the purpose of this command primarily to allow a basic subroutine to be called from within a CSub? i'm wondering about the utility of it, when it seems that a simple flag (eg, MyFlag) can be passed as a parameter to a CSub, and that any periodic background event within the CSub can then communicate with the user's BASIC program through this flag. after all, Geoff tells us that an 'interrupt' routine in MMbasic should be short anyway, preferably just setting a flag that the main portion of the BASIC program can then act upon at a later time. one other disadvantage of INTERRUPT [myint] is that - as far as i can see - only ONE handler can be active at any one time, hence only ONE CSub can make use of this functionality at any one time. cheers, rob :-) Edited 2022-01-18 02:02 by robert.rozee |
||||
matherp Guru ![]() Joined: 11/12/2012 Location: United KingdomPosts: 10067 |
I'm not sure why I need to justify every decision but feel free to use your method and other can use whatever they want. There are many ways to skin a cat and having a choice is normally considered a good thing |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |