Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 06:45 19 May 2024 Privacy Policy
Jump to

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 : CMM2: V5.05.04RC1

     Page 1 of 2    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 09:33am 13 Jul 2020
Copy link to clipboard 
Print this post

Version 5.05.04RC1 is the release candidate for the next full release of the CMM2 firmware. Functionality is now frozen and only bug fixes will be considered for inclusion. The ZIP file includes the updated manual, a summary of changes, and the latest versions of the CSUB header file and conversion program.

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1085
Posted: 12:21am 14 Jul 2020
Copy link to clipboard 
Print this post

Well, I see in the file "armcfgenV143.bas" you performed a global search and replace of "mm" with "numsymbols". That has resulted in an interesting ... read.

For example, we no longer have MMBasic or even the CMM2.  ;-)
"reconumsymbolsended" is a mouthful.

Oops.

Are there any other changes to V143 over V142 other than the m/mm I spotted?
I've ported the code to Freebasic to use as an exe with command line arguments. This relates to a message about csubs that I will hold off posting for a bit.

Otherwise, fantastic work Peter! You are awesome!
Visit Vegipete's *Mite Library for cool programs.
 
Sasquatch

Senior Member

Joined: 08/05/2020
Location: United States
Posts: 296
Posted: 03:04am 14 Jul 2020
Copy link to clipboard 
Print this post

CMM2 400MHz Waveshare MMBasic 5.05.04RC1

I haven't been able to get the Nunchuk commands to work.

I tried WII NUNCHUK OPEN, WII NUNCHUK, NUNCHUK OPEN

All variations I have tried just hang the system up and never return to the next line of MMBasic.  Am I missing something???
-Carl
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 05:49am 14 Jul 2020
Copy link to clipboard 
Print this post

wii NUNCHUK OPEN

is the correct syntax
One of my nunchuks is very unreliable but my other one seems to work every time.

This is my test code.
The wake_nunchuk sub was needed in the early days when we were trying to get all nunchuks to play.
It makes no difference to my unreliable nunchuk and I suspect poor contacts is the problem with that one.

 ' theremin - with apologies to music lovers everywhere
 ' Tassyjim
 
 DIM Fmax = 6000
 DIM Fmin = 200
 DIM Vmax = 100
 DIM Vmin = 1
 DIM NRmax = 0
 DIM NRmin = 1000
 DIM NLmax = 0
 DIM NLmin = 1000
 DIM k,m
 
 'k = wake_nunchuk() ' only needed for unreliable nunchuks
 SETPIN 32, DOUT ' only used for CRO trigger
 
 SETTICK 50,toneint ' reset the frequency and volume every 50mS
 
 CLS
 wii NUNCHUK OPEN
 PRINT "Calibrating..."
 PRINT "move the nunchuk through the full desired movements."
 PRINT "Press the main trigger when finished"
 PRINT
 PRINT "Tilt left to right for frequency change. Front to rear for volume."
 
 ' calibrating gets the extremes of movement
 
 DO
   k = NUNCHUK(aX)
   print k;"  ";
   IF k <> 0 THEN
     IF NRmax < k THEN NRmax = k
     IF NRmin > k THEN NRmin = k
   ENDIF
   k = NUNCHUK(aY)
   print k
   IF k <> 0 THEN
     IF NLmax < k THEN NLmax = k
     IF NLmin > k THEN NLmin = k
   ENDIF
   PRINT @(20,120) NRmin;" -";NRmax;" , "NLmin;" -";NLmax;"       ";NUNCHUK(Z)
   PAUSE 100
 LOOP UNTIL NUNCHUK(Z) = 1 or NUNCHUK(C) = 1
 PRINT "Calibrated!"
 fscale = (Fmax-Fmin)/(NRmax-NRmin)
 foffset = NRmin*fscale - Fmin
 
 vscale = (Vmax-Vmin)/(NLmax-NLmin)
 voffset = NLmin*vscale - Vmin
 
 PRINT "fscale  ";fscale
 PRINT "foffset ";foffset
 PRINT "vscale  ";vscale
 PRINT "voffset ";voffset
 PAUSE 2000
 'cls
 
 
 DO
   k = NUNCHUK(aX)
   m = NUNCHUK(aY)
   
   IF  m <> 0 AND k <> 0 THEN
     t = INT(k * fscale - foffset)
     v = INT(m * vscale - voffset)
     IF t < Fmin THEN t = Fmin
     IF t > Fmax THEN t = Fmax
     IF v > Vmax THEN v = Vmax
     IF v < Vmin THEN v = Vmin
     
     DO :LOOP UNTIL endtone = 1
     
     PLAY TONE t,t ', 100, toneint
     PLAY VOLUME v,v
     PULSE 32, 1 ' only used for CRO trigger
     endtone = 0
     'PLAY SOUND 1, B, S ,t,v
     'print @(20,120) k;" - ";t;" , ";m;" - ";v;"        "
   ENDIF
 LOOP UNTIL NUNCHUK(Z) = 1
 
 PLAY STOP
 wii NUNCHUK CLOSE
END
 
SUB toneint
 endtone = 1
END SUB
 
FUNCTION wake_nunchuk()
 LOCAL n, t$
 I2C3 OPEN 100,100
 FOR n = 1 TO 10
   I2C3 WRITE &H52,0,2,&HF0,&H55
   PRINT MM.I2C
   PAUSE 2
   IF MM.I2C = 0 THEN EXIT FOR
 NEXT n
 PRINT "N = ";n
 I2C3 WRITE &H52,0,2,&HFB,&H00
 PRINT MM.I2C
 PAUSE 2
 I2C3 WRITE &H52,0,1,&HFA
 PRINT MM.I2C
 PAUSE 2
 I2C3 READ &H52,0,6,t$
 PRINT MM.I2C
 FOR n = 1 TO 6
   PRINT HEX$(ASC(MID$(t$,n,1)),2);
 NEXT n
 PRINT
 I2C3 CLOSE
END FUNCTION

It drives my dogs mad.

Jim
VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 06:57am 14 Jul 2020
Copy link to clipboard 
Print this post

RC2 now available - fixes some error checking when using sprites on the framebuffer

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip
 
Womble

Senior Member

Joined: 09/07/2020
Location: United Kingdom
Posts: 267
Posted: 01:02am 15 Jul 2020
Copy link to clipboard 
Print this post

  matherp said  RC2 now available - fixes some error checking when using sprites on the framebuffer

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

Well Done Guys   keep up the good work

I'm really enjoying my CMM2/MMBasic.  Its keeping me sane whilst awaiting the NHS to fix my ticker, and whilst shielding from C19.

Many Thanks
Womble
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5923
Posted: 07:19am 16 Jul 2020
Copy link to clipboard 
Print this post

There seems to be a problem setting the frequency in the ADC command

While investigating the DS18B20 problem in another post, I noticed that setting the frequency didn't always give you the correct sample rate.

I tested by counting the samples while measuring a 1mS pulse.
tested on a V revision board

 
 Hz    uS  calc uS
25000 19.6    40.0
50000  9.9    20.0
75000  6.6    13.3
100000  5      10.0
150000  6.6     6.7
175000  5.7     5.7
200000  5       5.0
250000  6       4.0


First column is the frequency set in the ADC command
second column is the observed sampling period
third column is the calculated sampling period

150kHz to 200kHz results in the correct sample period but higher or lower frequencies are not correct.

Jim
VK7JH
MMedit   MMBasic Help
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 07:55am 16 Jul 2020
Copy link to clipboard 
Print this post

  Quote  There seems to be a problem setting the frequency in the ADC command


Agreed - I'll look at it - thanks for the report
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 10:05am 16 Jul 2020
Copy link to clipboard 
Print this post

Attached is V5.05.04RC3

CMM2_Beta.zip

For some reason I can't update the normal download today.

Changes:
Set maximum ADC sampling rate to 480KHz on 400MHz processors, 500KHz on 480MHz processors
Fixed bug in ADC command causing lockup when number of channels opened > number sampled
Fixed bug in ADC command setting sampling rate
Fixed bug in DAC command setting output rate
 
Womble

Senior Member

Joined: 09/07/2020
Location: United Kingdom
Posts: 267
Posted: 05:31pm 16 Jul 2020
Copy link to clipboard 
Print this post

  matherp said  Attached is V5.05.04RC3

CMM2_Beta.zip

Changes:
Set maximum ADC sampling rate to 480KHz on 400MHz processors, 500KHz on 480MHz processors
Fixed bug in ADC command causing lockup when number of channels opened > number sampled
Fixed bug in ADC command setting sampling rate
Fixed bug in DAC command setting output rate

Thanks for this ...

I note there is a New Version of "The Colour Maximite 2 User Manual MMBasic Ver 5.05.04" hidden away in the zip file.  That should help newbies like me  

Is there a list of raw error messages for the CMM2 that I can refer to?
Noodling around and I got  the following:

[74] Error: Internal fault 1(sorry)

Which, apart from referring to line 74 of my program is particularly cryptic.

I will admit that I was using a WHILE...WEND and the error went  away when I changed to a DO ... LOOP UNTIL

Keep up the good work

Womble
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1085
Posted: 10:32pm 16 Jul 2020
Copy link to clipboard 
Print this post

Do the PAGE OR_PIXELS and PAGE XOR_PIXELS work the way you expect?

If I put an image on page 1 and a white outline box on page 2, I would expect PAGE OR_PIXELS 2,1,0 to display the image with a white outline box. XOR should give similar except whatever weird colours happen from the exclusive or.

Instead, OR and XOR both seem to give the same result as AND.

edit: add example

Compare this with the (quite slow) result of:
for i = 0 to MM.HRES-1
 for j = 0 to MM.VRES-1
   page write 2
   p2 = pixel(i,j)
   page write 1
   p1 = pixel(i,j)
   page write 0
   pixel i,j, p2 OR p1
 next j
next i


As an aside, it looks like the pixel function would also benefit from an optional 3rd parameter specifying which page to read the pixel from.
Edited 2020-07-17 10:52 by vegipete
Visit Vegipete's *Mite Library for cool programs.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 07:25am 17 Jul 2020
Copy link to clipboard 
Print this post

  Quote  Do the PAGE OR_PIXELS and PAGE XOR_PIXELS work the way you expect?


Yes in modes 3 and 5 but not in 1,2, and 4 - cut and paste error fixed in RC4

http://geoffg.net/Downloads/Maximite/CMM2_Beta.zip

Other changes:
Fixed bug in ARC command when first radial is negative
Performance enhancement for PIN() command and function
General small performance improvement

Note the ZIP contains the updated 5.05.04 user manual
 
abraxas
Regular Member

Joined: 16/06/2020
Location: Canada
Posts: 99
Posted: 12:06am 18 Jul 2020
Copy link to clipboard 
Print this post

Pete,

I may have found a bug in MATH SET and MATH SCALE on CMM2

Looks like the above commands only work properly for integers smaller than the max value of an int32

here's a short code example that shows the issue:



DIM foo(4) AS INTEGER
DIM bar(4) AS INTEGER
DIM INTEGER baz =      &H000000000FFFFFFF
DIM INTEGER kaboom =   &H00000000FFFFFFFF

PRINT baz
PRINT kaboom

PRINT "SET LESS THAN int32"
MATH SET baz, foo()
MATH SCALE foo(),1,bar()
MATH V_PRINT foo()
MATH V_PRINT bar()

PRINT "SET MORE THAN int32"
MATH SET kaboom, foo()
MATH SCALE foo(),1,bar()
MATH V_PRINT foo()
MATH V_PRINT bar()



It yields the following output on RC4:


268435455
4294967295
SETTING LESS THAN int32
268435455, 268435455, 268435455, 268435455, 268435455
268435455, 268435455, 268435455, 268435455, 268435455
SETTING MORE THAN int32
-1, -1, -1, -1, -1
-1, -1, -1, -1, -1
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 8605
Posted: 07:30am 18 Jul 2020
Copy link to clipboard 
Print this post

  Quote  I may have found a bug in MATH SET and MATH SCALE on CMM2


Thanks for the report. The bug is actually just in the print routine. I'll fix in the final release
 
abraxas
Regular Member

Joined: 16/06/2020
Location: Canada
Posts: 99
Posted: 01:33pm 18 Jul 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  I may have found a bug in MATH SET and MATH SCALE on CMM2


Thanks for the report. The bug is actually just in the print routine. I'll fix in the final release


Are you sure? I can see the problem even when I use regular PRINT. I will prepare a test example later when I get a chance to play with the CMM2
 
abraxas
Regular Member

Joined: 16/06/2020
Location: Canada
Posts: 99
Posted: 03:37pm 18 Jul 2020
Copy link to clipboard 
Print this post

  matherp said  
  Quote  I may have found a bug in MATH SET and MATH SCALE on CMM2


Thanks for the report. The bug is actually just in the print routine. I'll fix in the final release


Pete,
I just grabbed a minute to create a sample that reproduces my issue even without V_PRINT:


DIM foo(4) AS INTEGER
DIM INTEGER kaboom% = &H0FFFFFFFFFFFFFFF
MATH SET kaboom%,foo()

FOR n = 0 TO 4
 PRINT HEX$(foo(n)), HEX$(kaboom%)
NEXT


Outputs the following:


1000000000000000 FFFFFFFFFFFFFFF
1000000000000000 FFFFFFFFFFFFFFF
1000000000000000 FFFFFFFFFFFFFFF
1000000000000000 FFFFFFFFFFFFFFF
1000000000000000 FFFFFFFFFFFFFFF


Which clearly isn't right?
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 05:55pm 18 Jul 2020
Copy link to clipboard 
Print this post

Just out of curiosity, do you run the builds against a series of unit tests to test all the various functions and such?
 
abraxas
Regular Member

Joined: 16/06/2020
Location: Canada
Posts: 99
Posted: 08:22pm 18 Jul 2020
Copy link to clipboard 
Print this post

  mkopack73 said  Just out of curiosity, do you run the builds against a series of unit tests to test all the various functions and such?


Aha! Spotted the "agile" dude  
 
mkopack73
Senior Member

Joined: 03/07/2020
Location: United States
Posts: 261
Posted: 03:24am 19 Jul 2020
Copy link to clipboard 
Print this post

  abraxas said  
  mkopack73 said  Just out of curiosity, do you run the builds against a series of unit tests to test all the various functions and such?


Aha! Spotted the "agile" dude  


Yes, BUT, it would likely also serve as really good example code on how to use all the various commands/functions for newbies to see...
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1085
Posted: 05:34am 19 Jul 2020
Copy link to clipboard 
Print this post

  mkopack73 said  Just out of curiosity, do you run the builds against a series of unit tests to test all the various functions and such?

Why create such unit tests when you can just let thousands (Hundreds? Dozens?) of us monkeys bang away on our keyboards trying all manner of ridiculous program combinations? Judging by the the sorts of bugs that occasionally show up, building a test suite to find them automagically might be harder than writing the software in the first place. Or I'm just too old to be agile.  ;-)
Visit Vegipete's *Mite Library for cool programs.
 
     Page 1 of 2    
Print this page
© JAQ Software 2024