Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Picomite(VGA) V5.07.07 betas - bug fixes + focus on PIO
Page 1 of 16 | |||||
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Picomite(VGA) V5.07.07b1 https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip Bug fix to ON ERROR SKIP (thanks Tom) New functions MM.INFO(EXISTS FILE fname$) ' see CMM2 manual for details MM.INFO(EXISTS DIR dname$) ' see CMM2 manual for details PIN(FLEVEL pio [,sm, DIR]) ' dir can be RX or TX. If specified gives the level of the specific fifo PIO (SHIFTCTRL push_threshold [,pull_threshold] [,autopush] [,autopull] [,in_shiftdir] [,out_shiftdir] [,FJOIN_RX] [,FJOIN_TX]) 'additional optional parameters to create 8-word RX or TX FIFOs PIO CLEAR now clears all the FIFOs for the pio specified PIO INIT and PIO START clear the specific FIFOs for the pio and sm specified New Command NB: RX and TX are from the Basic code perspective PIO INTERRUPT pio, sm [,RXinterrupt] [,TXinterrupt] Use the value 0 for RXinterrupt or TXinterrupt to disable an interrupt Omit values not needed e.g PIO INTERRUPT 1,0,,myTXinterrupt PIO INTERRUPT 1,0,,0 PIO INTERRUPT 1,0,myRXinterrupt PIO INTERRUPT 1,0,0 PIO INTERRUPT 1,0,myRXinterrupt,myTXinterrupt PIO INTERRUPT 1,0,0,0 The RX interrupt triggers whenever a word has been "pushed" by the PIO code into the specified FIFO. The data MUST be read in the interrupt to clear it. The interrupt will re-trigger if a second word arrives and the interrupt only processes one. The TX interrupt triggers whenever the specified FIFO has been FULL and the PIO code has now "pulled" it PIO interrupts have priority have keyboard interrupts but before anything else. As with all interrupts interrupt conditions are processed one at a time. NB: I am not convinced about the utility of the TX interrupt. Would it be better to have an interrupt on say half full when it was previously more than half. This would allow the Basic code to keep the FIFO topped up and know how many writes were allowed NB: the enhanced PIO(FLEVEL ...) function makes it easy for the Basic code to know the FIFO status before writing |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4254 |
Will try this weekend !! Looks very promising. I see a 3 phase sine wave generator on the horizon.... I Guess this is a typo.... PIO(FLEVEL pio [,sm, DIR]) Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
No: it says you can specify just the pio, or all of the pio, statemachine and direction |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Thanks for your confidence Peter, I hope it proves to be justified. Great, I'd been hoping for those for a while. Could I push my luck and ask for: MM.INFO(EXISTS file_or_dir_name$) Which both MMBasic for Windows and MMB4L already have, but not the CMM2 ... but perhaps that could have too ? Best wishes, Tom Edited 2023-01-14 00:07 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Isn't that effectively there with MM.INFO(filesize fname$) which returns -2 if it is a directory Edited 2023-01-14 00:11 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Are you talking historically, in which case I think it is MM.INFO(FILESIZE fname$) which has that behaviour, or did, you may have changed it to report an error the last time I got on this hobby horse . Or are you talking about what you've just done, in which case I'll have to take a look, though I'd still appreciate consistency between all the MMBasic platforms. Maybe I should just let this slide until I've got my tests running on the PicoMite and then I will be able to quibble from a position based more on facts than supposition. Thanks for the new additions, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
Isn't that effectively there with MM.INFO(filesize fname$) which returns -2 if it is a directory OK, you edited, and no, on some platforms that now throws an error. This is the passing test code from when I checked about a week ago (but not with PicoMite): Sub test_filesize_given_directory() If Mm.Device$ = "MMB4L" Then assert_int_equals(-2, Mm.Info(FileSize Mm.Info$(Directory))) assert_int_equals(-2, Mm.Info(FileSize Mm.Info$(Path))) assert_int_equals(-2, Mm.Info(FileSize "/")) assert_int_equals(-2, Mm.Info(FileSize "\")) assert_int_equals(-2, Mm.Info(FileSize ".")) assert_int_equals(-2, Mm.Info(FileSize "..")) assert_int_equals(-2, Mm.Info(FileSize "A:/")) assert_int_equals(-2, Mm.Info(FileSize "A:\")) assert_int_equals(-2, Mm.Info(FileSize "C:/")) assert_int_equals(-2, Mm.Info(FileSize "C:\")) assert_int_equals(-2, Mm.Info(FileSize str.replace$(TMP$, "/", "\"))) assert_int_equals(-2, Mm.Info(FileSize str.replace$(TMP$, "\", "/"))) assert_int_equals(-2, Mm.Info(FileSize str.replace$("A:" + TMP$, "/", "\"))) assert_int_equals(-2, Mm.Info(FileSize str.replace$("A:" + TMP$, "\", "/"))) assert_int_equals(-2, Mm.Info(FileSize str.replace$("C:" + TMP$, "/", "\"))) assert_int_equals(-2, Mm.Info(FileSize str.replace$("C:" + TMP$, "\", "/"))) Else assert_filesize_fails(Mm.Info$(Directory)) assert_filesize_fails(Mm.Info$(Path)) assert_filesize_fails("/") assert_filesize_fails("\") assert_int_equals(Choice(Mm.Device$ = "MMBasic for Windows", -2, -1), Mm.Info(FileSize ".")) assert_int_equals(Choice(Mm.Device$ = "MMBasic for Windows", -2, -1), Mm.Info(FileSize "..")) assert_filesize_fails("A:/") assert_filesize_fails("A:\") assert_filesize_fails("C:/") assert_filesize_fails("C:\") assert_int_equals(-2, Mm.Info(FileSize str.replace$(TMP$, "/", "\"))) assert_int_equals(-2, Mm.Info(FileSize str.replace$(TMP$, "\", "/"))) EndIf End Sub Sub assert_filesize_fails(f$) On Error Skip 1 Local size% = Mm.Info(FileSize f$) assert_raw_error("Invalid file specification") On Error Clear End Sub Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
The Picomite behaves the same as the CMM2. Sets the error message if a directory but does not throw an error MMB4W is slightly different so should probably change but will still return -2 for a directory. It only errors if the filename ends in / or \ Edited 2023-01-14 00:33 by matherp |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
MMB4W is slightly different so should probably change but will still return -2 for a directory. It only errors id the filespace ends in / or \ OK, I had not noticed this. Can I officially go on the record as saying that setting MM.ERRMSG$ outside of throwing an ERROR completely breaks "The Principle of Least Surprise" ? If I can be so bold, "least suprise" suggests that: - If MM.ERRMSG$ <> "" then an error has been thrown ... and the CMM2 should not be setting it to "Success" which it sometimes does. - If MM.ERRNO <> 0 then an error has been thrown ... I think this is always the case. - At all times either (MM.ERRMSG$ <> "" AND MM.ERRNO <> 0) OR (MM.ERRMSG$ = "" AND MM.ERRNO = 0) Best wishes, Tom Edited 2023-01-14 00:39 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
As with all this stuff I think it is only you who ever looks at errormsg or errno so completely irrelevant for most users |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 4047 |
That does appear to be the state of affairs. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Pluto Guru Joined: 09/06/2017 Location: FinlandPosts: 359 |
Tried to download Picomite(VGA) V5.07.07b1. When extracting: "Archive corrupt!" |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
Same for me. John |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
PIN(FLEVEL pio [,sm, DIR]) ' dir can be RX or TX. If specified gives the level of the specific fifo I Guess this is a typo.... PIO(FLEVEL pio [,sm, DIR]) Regards, Volhout In that it shouldn't be PIN(... but instead PIO(... Does look like a typo. John |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
It's amazing how you can't see your own errors but everyone else can PIO(FLEVEL pio [,sm, DIR]) ' dir can be RX or TX. If specified gives the level of the specific fifo Please try again Edited 2023-01-14 01:44 by matherp |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9139 |
Forgot to mention also in b1 The PWM command is modified as follows: PWM channel, frequency, [dutyA] [,dutyB] [,phase] [,deferredstart] Phase is a new parameter that causes the waveforms to be centred such that a wave form with a shorter duty cycle starts and ends equal times from a longer one. Use 1 to enable this mode and 0 (or omit) to run as normal The new parameter "deferredstart" when set to 1 prepares the PWM channels as before but does not start the output running. This is to avoid any undesirable startup artefacts There is a new sub command PWM SYNC [channel0offset] [,channel1offset] .......[channel7offset] This initiates the PWM on channels where a deferred start was defined or just syncs exisitng running channels. However, the power comes in the ability to offset the channels one to another (defined as a percentage of the time period as per the duty cycle - can be a float) You can use an offset of -1 to omit a channel from the synch Edited 2023-01-14 02:44 by matherp |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3815 |
Download now OK, thanks. John |
||||
Bleep Guru Joined: 09/01/2022 Location: United KingdomPosts: 512 |
NB: RX and TX are from the Basic code perspective Hi Peter, I've just tried using the FJOIN_TX, this is for my Basic code sending out data to the FiFo for transmission by the PIO, however I've found I actually have to use:- f0=Pio(shiftctrl 0,0,0,1,0,0,1,0) 'Set Auto Pull at 32bits (0) & Extend Tx FiFo Which would seem to me to be using FJOIN_RX, so either I'm not understanding the TX RX direction, or I'm doing something wrong. If I actually set FJOIN_TX my code locks up, presumably because there is no FiFo for it to write to. Regards, Kevin. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4254 |
37us per word on fifo is pushing the limit of what mmbasic on fifo can do. Interrupt gives you freedom for your main code PicomiteVGA PETSCII ROBOTS |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2140 |
Edit Ignore, this new Pico has faulty GP0. Does not drive low, just goes high Z. Adding a pull-down resistor enables normal DOUT to work, adequate on PWM. Has 16MB flash yet cost less than regular Pico, now I know why! On an old Pico it works well. Playing with the new PWM commands. PWM channel 0 phase shift seems wrong. This three phase sequence works perfectly if using PWM channels 1,2,3 but not with PWM channels 0,1,2 > LIST ' Three phase motor drive - not quite right SetPin gp0,pwm 'CH 0a SetPin gp1,pwm 'CH 0b SetPin gp2,pwm 'CH 1a SetPin gp3,pwm 'CH 1b SetPin gp4,pwm 'CH 2a SetPin gp5,pwm 'CH 2b PWM 0, 50, 33.33, -66.66, 1, 1 PWM 1, 50, 33.33, -66.66, 1, 1 PWM 2, 50, 33.33, -66.66, 1, 1 PWM sync 0, 100/3, 200/3 > > LIST ' Three phase motor drive - perfect SetPin gp2,pwm 'CH 1a SetPin gp3,pwm 'CH 1b SetPin gp4,pwm 'CH 2a SetPin gp5,pwm 'CH 2b SetPin gp6,pwm 'CH 3a SetPin gp7,pwm 'CH 3b PWM 1, 50, 33.33, -66.66, 1, 1 PWM 2, 50, 33.33, -66.66, 1, 1 PWM 3, 50, 33.33, -66.66, 1, 1 PWM sync 0, 0, 100/3, 200/3 > Edited 2023-01-14 15:02 by phil99 |
||||
Page 1 of 16 |
Print this page |