Picomite/PicoMiteVGA V5.07.05 release candidates


Author Message
phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2160
Posted: 11:22am 27 Oct 2022      

"You can then adjust  RGB(0,64,0) to look almost black when needed."

The idea of the trim-pot is that it is so simple it can be retro-fitted easily and it is adjustable. When you want all the colours spin it back to zero, your not locked in so there is no loss of compatibility.

thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4051
Posted: 11:34am 27 Oct 2022      

  phil99 said  "You can then adjust  RGB(0,64,0) to look almost black when needed."

The idea of the trim-pot is that it is so simple it can be retro-fitted easily and it is adjustable. When you want all the colours spin it back to zero, your not locked in so there is no loss of compatibility.


Typical hardware engineer always looking for a hardware solution ... and I know you can throw that back in my face .

Best wishes,

Tom

Martin H.

Guru

Joined: 04/06/2022
Location: Germany
Posts: 1120
Posted: 12:11pm 27 Oct 2022      

  Volhout said  
Please note that the dot clock (pixel clock) is 25MHz(40ns). You need fast logic to do this (with gate delay of 10ns, 2 gates = 20ns, you loose half the pixel). Or you "delay" the other 3 color signals by the same amount (3 x 2 gates), and potentially Hsync (1 x 2 gates). Vsync may not be that critical.


I know, and I also dont plan to build it this way. It was just an example.

Rickard5

Guru

Joined: 31/03/2022
Location: United States
Posts: 463
Posted: 04:05pm 27 Oct 2022      

Matherp

is there any way there can ever be a Servo command added to MMBasic for the PM? Please Please Please
Edited 2022-10-28 02:06 by Rickard5

Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 6871
Posted: 05:16pm 27 Oct 2022      

That's been covered already, Rickard and there's info on the forum on how to do it. Use the PWM command. You almost certainly won't get a separate SERVO command because there's no command slots left on the PicoMite.

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4293
Posted: 05:16pm 27 Oct 2022      

Hi Rick,

Not really needed
The servo command is the same as the PWM command

Assume you want to set an angle between 0 and 180 degrees (90 is centre position)
then use:

PWM x,50,5+angle/36


See below code as an example:

servo signals range from 1ms (5%) to 2 ms (10%) on 20ms frame rate

'set up the PWM for 2 servo's
setpin gp2,pwm1a
setpin gp3,pwm1b

'start the PWM's in mid position
PWM 1,50,7.5,7.5

'vary the angle
do
 for angle=0 to 180 step 10 '90 degrees is mid position
 pause 100
 pwmval=5 + angle/36
 PWM 1,50,pwmval,pwmval
 next
loop


sweeps 2 servo's from left to right.

Make sure you have sufficient 5V power for the servo's. The USB is not sufficient !!!

Volhout

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9201
Posted: 05:17pm 27 Oct 2022      

No: no command slots free and it is trivial to use PWM. Frequency 50Hz and duty cycle between 5 and 10% will give 0 to 100%

vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1110
Posted: 07:21pm 27 Oct 2022      

With regards something other than black for transparent, I've been looking at the source code and just maybe I see a line of interest:

In the file Draw.c
line 4371:      if(c!=0 || blank==-1)*pp |=c;
the first part, c!=0, appears to be using colour 0 as transparent. Maybe a different value there, or rather, a variable, would have the desired effect. A possible variable is "gui_bcolour", although this needs to be translated from RGB space to a simple colour number.

The gist of this is that the transparent colour could be specified as the current back ground colour.

Just an idea...

Rickard5

Guru

Joined: 31/03/2022
Location: United States
Posts: 463
Posted: 10:48pm 28 Oct 2022      

@ Volhout
Thank you for explaining the PWM, I'm going to breadboard up the H-Bridge controller tonight and see if I can get wheels moving and servos moving :)

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9201
Posted: 04:43pm 31 Oct 2022      

PicoMite V5.07.05RC9

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Implements an additional parameter on OPTION SERIAL CONSOLE
i.e. OPTION SERIAL CONSOLE TXpin, RXpin [,B]
adding the "B" parameter means output will go to "B"oth the serial port and the USB

Hans

Senior Member

Joined: 18/10/2022
Location: Canada
Posts: 116
Posted: 03:49am 01 Nov 2022      

  matherp said  PicoMite V5.07.05RC9

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Implements an additional parameter on OPTION SERIAL CONSOLE
i.e. OPTION SERIAL CONSOLE TXpin, RXpin [,B]
adding the "B" parameter means output will go to "B"oth the serial port and the USB


Thank you Peter

Hans…

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4293
Posted: 01:48pm 03 Nov 2022      

@Peter,

When you find time, can you please explain how the index in an array is calculated.
The index is an integer, but it is not calculated using the INT(x) function in case X is a FLOAT ?

Example:
random dice rolls can be calculated using 1+RND()*6
if I use these as index in a array (1,000,000 rolls) I get following distribution


Option default integer
Dim distribution(7)

For i=1 To 1e6
 Inc distribution(1+Rnd*6),1
Next i

For i=0 To 7
 Print i, distribution(i)
Next i
End

0       0
1       83119
2       166639
3       166889
4       166590
5       166382
6       166897
7       83484


Only when I explicitly use the INT(x) function I get a correct distribution.

Dim distribution(7)

For i=1 To 1e6
 Inc distribution(Int(1+Rnd*6)),1
Next i

For i=0 To 7
 Print i, distribution(i)
Next i
End

0       0
1       166619
2       166640
3       166988
4       166171
5       166966
6       166616
7       0

Bleep
Guru

Joined: 09/01/2022
Location: United Kingdom
Posts: 516
Posted: 04:15pm 03 Nov 2022      

That looks like rounding, if your sum comes out to greater than 6.5 it is rounded up to 7, similarly if your sum comes out to less than 1.5 its rounded down to 1, but if above 1.5 its rounded up to 2, similarly for 2.5 etc.... Whereas INT(x) truncates, so 1 point anything will be 1, 2 point anything will be 2 etc....
Regards Kevin.

TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6113
Posted: 08:02pm 03 Nov 2022      

DIM FLOAT n,k,s = 0.25
DIM INTEGER m
PRINT "  N   INT(N)  CINT(N)  FIX(N)   n\1   k\2      m"

FOR n = -3 TO 3 STEP s
m = n ' asign a float to an integer
k = n * 2
PRINT STR$(n,2,2);TAB(8);INT(n);TAB(16);CINT(n);TAB(24);FIX(n);TAB(32);n\1;TAB(40);k\2;TAB(48);m
NEXT n

N   INT(N)  CINT(N)  FIX(N)   n\1   k\2      m
-3.00  -3      -3      -3      -3      -3      -3
-2.75  -3      -3      -2      -3      -3      -3
-2.50  -3      -3      -2      -3      -2      -3
-2.25  -3      -2      -2      -2      -2      -2
-2.00  -2      -2      -2      -2      -2      -2
-1.75  -2      -2      -1      -2      -2      -2
-1.50  -2      -2      -1      -2      -1      -2
-1.25  -2      -1      -1      -1      -1      -1
-1.00  -1      -1      -1      -1      -1      -1
-0.75  -1      -1       0      -1      -1      -1
-0.50  -1      -1       0      -1       0      -1
-0.25  -1       0       0       0       0       0
0.00   0       0       0       0       0       0
0.25   0       0       0       0       0       0
0.50   0       1       0       1       0       1
0.75   0       1       0       1       1       1
1.00   1       1       1       1       1       1
1.25   1       1       1       1       1       1
1.50   1       2       1       2       1       2
1.75   1       2       1       2       2       2
2.00   2       2       2       2       2       2
2.25   2       2       2       2       2       2
2.50   2       3       2       3       2       3
2.75   2       3       2       3       3       3
3.00   3       3       3       3       3       3

lots of ways to convert to integer and all different
To match the internal casting, use CINT() or n\1

Jim

https://www.c-com.com.au/mmhelp/int.htm
Edited 2022-11-04 06:03 by TassyJim

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9201
Posted: 04:39pm 30 Nov 2022      

PicoMite V5.07.05RC10

https://geoffg.net/Downloads/picomite/PicoMite_Beta.zip

Updated CSUB header file and additional functions exposed (header file in zip)
Implements new commands MEMORY PACK and MEMORY UNPACK
These allow the normal 64 bit integers in memory to be packed into 32, 16, 8, 4 or 1 bits and then unpacked

' test of memory pack and unpack
Option default integer
Dim in(127)
Dim out(63)
Dim back(127)
Dim nibbles,bits
iadd=Peek(varaddr in())
oadd=Peek(varaddr out())
' test packing into words : 32-bit
For i=0 To 127:in(i)=i:Next
Memory pack iadd, oadd, 128,32
Print Peek(word oadd+64)
Memory unpack oadd,Peek(varaddr back()),128,32
For i=0 To 127: If back(i)<> i Then Error ("Oops"):Next
'
' test packing into shorts : 16-bit
Memory pack iadd, oadd, 128,16
Print Peek(short oadd+32)
Memory unpack oadd,Peek(varaddr back()),128,16
For i=0 To 127: If back(i)<> i Then Error ("Oops"):Next
'
' test packing into bytes : 8-bit
Memory pack iadd, oadd, 128,8
Print Peek(byte oadd+16)
Memory unpack oadd,Peek(varaddr back()),128,8
For i=0 To 127: If back(i)<> i Then Error ("Oops"):Next
'
' test packing into nibbles : 4-bit
Memory pack Peek(varaddr in()),Peek(varaddr nibbles),16,4
Print Hex$(nibbles)
Memory unpack Peek(varaddr nibbles),Peek(varaddr back()),16,4
For i=0 To 15: If back(i)<> i Then Error ("Oops"):Next
'
' test packing into bits : 1-bit
For i=0 To 63:in(i)=i And 1:Next i
Memory pack Peek(varaddr in()),Peek(varaddr bits),64,1
Print Bin$(bits)
Memory unpack Peek(varaddr bits),Peek(varaddr back()),64,1
For i=0 To 63: If back(i)<> i And 1 Then Error ("Oops"):Next

disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 906
Posted: 10:53pm 30 Nov 2022      

  matherp said  PicoMite V5.07.05RC10
Updated CSUB header file and additional functions exposed (header file in zip)

Hi Peter
The PicoCFunctions.h file in the download is not the latest. The one on github seems to be the correct one. (V1.6.4  Additional links)

Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 4293
Posted: 03:51pm 05 Dec 2022      

@Peter,

The count inputs have a maximum frequency they can count.
For MX170 this was 300kHz..800kHz, for CMM1 it was 200kHz, for CMM2 not listed, but pin 18 could count 40MHz (fast counting pin).

Is there any indication what the maximum frequency for picomite and picomiteVGA is (@126/252/378MHz) ? I think RC8 is relatively stable now, and more or less close to 5.07.05 final ? Or are there changes on the horizon that impact this ?

Maybe we could add this to the user manual ? Current manual does not show.

Regards,

Volhout

matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9201
Posted: 07:07pm 05 Dec 2022      

  Quote  s there any indication what the maximum frequency for picomite and picomiteVGA is (@126/252/378MHz) ?


No idea sorry. Why not test it and then we can include your results in the manual

phil99

Guru

Joined: 11/02/2018
Location: Australia
Posts: 2160
Posted: 02:15am 06 Dec 2022      

At 378MHz about 1MHZ seems to be the limit.

> setpin 9,fin : setpin 4,pwm : dim integer n=900000
> do :pwm 1,n,50 : pause 11000:? n,pin(9) :inc n,10000 : loop
900000  894901
910000  905725
920000  915993
930000  925087
940000  934304
950000  946149
960000  955839
970000  965730
980000  975826
990000  986130
1000000         994005
1010000         1.004649e+06
1020000         1.015489e+06
1030000         1.025798e+06
1040000         1.034334e+06
1050000         1.043009e+06
1060000         1.054803e+06
1070000         1.063828e+06
1080000         1.074e+06
1090000         1.0854e+06
1100000         1.094971e+06
1110000         1.10378e+06
1120000         1.092688e+06
1130000         1.082784e+06
1140000         1.071426e+06
1150000         1.062888e+06
1160000         1.058435e+06
1170000         1.046447e+06
1180000         1.042621e+06
1190000         1.03643e+06
1200000         1.041723e+06
1210000         1.030806e+06
1220000         1.013033e+06
1230000         1.019278e+06
1240000         1.024406e+06
1250000         995328
1260000         1.001987e+06
1270000         1.01175e+06
1280000         1.017865e+06
1290000         1.024198e+06
1300000         1.033941e+06
>

Let it go much higher and it locks up.

with this one

> setpin 4,pwm :setpin 9,fin :dim integer n=900000, m
> do:pwm 1,n,50:pause 99:m=pin(9):pause 1100:?n,m :inc n,10000:loop

managed to stop it before it locked up, it was printing less than one character per second.

It took about a minute to do this:-

> memory
Program:
  2K ( 1%) Program (64 lines)
118K (99%) Free

RAM:
  1K ( 1%) 2 Variables
  0K ( 0%) General
151K (99%) Free
>
Until the power is cycled it stays that way.

Edit
Setpin 9,off

Can restore normality.

PicoMite MMBasic Version 5.07.05RC10
Copyright 2011-2022 Geoff Graham
Copyright 2016-2022 Peter Mather

> ? mm.info(cpuspeed)
126000000
> setpin 4,pwm :setpin 9,fin :dim integer n=300000, m
> do:pwm 1,n,50:pause 99:m=pin(9):pause 1100:?n,m :inc n,10000:loop
300000  0
310000  192765
320000  299175
330000  314853
340000  324725
350000  332562
360000  339458
370000  353016
380000  363289
390000  355038
400000  348000
410000  343708
420000  335452
430000  330396
440000  334806
450000  330926
460000  331820
470000  339536
480000  344049
>.
Edited 2022-12-06 16:42 by phil99

Pluto
Guru

Joined: 09/06/2017
Location: Finland
Posts: 361
Posted: 02:26pm 06 Dec 2022      

I did also some time ago measure the max measurable frequency and came to the same conclusion as Phil99: up to 1MHz. (Using the "standard" frequency measurement.

I then tested the PIO-routine that Volhout posted and with his routime the PicoMite was able to measure up to 5.4MHz.
https://www.thebackshed.com/forum/ViewTopic.php?FID=16&TID=15163#191650

I used 378MHz CPU-speed (and also 378MHz speed for the PIO routine).

I am not sure if 5.4MHz is the highest frequency. I used the MicroMite based signal generator made by Geoff so I am not sure if the output amplitude is sufficient as a valid input at the higher frequencies. If someone has a more proven generator for higher frequencies (>5MHz), it would be nice to see if you are getting the same or better results.

'GP0measure frequency/period using PIO
'Volhout's PIO-routine


'pio program measure pause and pulse time from GP0 in us and push both to FIFO
'0 E020   'set X=0
'1 A029   'X -> fffffff
'2 00C4   'jmp (pin=1) to loop2
'3 0042   'count loop1
'4 0045   'count loop2
'5 00C4   'jmp (pin=1) in loop2
'6 A0C9   'mov -X to ISR
'7 8000   'push noblock
'8 0000   'jmp 0 (rest is filled with 0 = jmp->0)
Dim a%(7)=(&h004200C4A029E020,&h8000A0C900C40045,0,0,0,0,0,0)
'f=63e6     '2MHz gives 1us per count resolution
f=378e6 'I increased this to the same as the PicoMite cpu frequency.
'configure pio1
e0=Pio(execctrl 0,0,&h1f)  'use gp0 for PIN
p=0                        'no GPxx pins for PIO

'program pio1 and start
PIO program 1,a%()
PIO init machine 1,0,f,p,e0,,0 'start pio 1,0 from adress 0
PIO start 1,0

'C1=1e-9 '1nF
'F1=175100
'measure time and convert to frequency
Dim cnt%(4)
DO
for J=1 to 1
avg=0
avg1=0
PIO start 1,0
n=100000  'Will meare so many times and calculate the average
For i=1 to n*j
 PIO read 1,0,5,cnt%()       'read fifo pio 1 seq 0
 period1% = cnt%(4)+3
 freq=f/(2*period1%)         'calc freq
 avg=avg+freq
 avg1=avg1+cnt%(4)
next i
PIO stop 1,0
Counts=avg1/(n*j)
F1=avg/(n*j)
ny=F1
print"Frequency:";F1;" counts=";counts;"  nbr=";n*j; " Diff %=";abs((ny-old)/ny)*100
old=ny
Next j
'pause 1000
LOOP