Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 06:07 02 Aug 2025 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 : CM2: DIM bit

     Page 4 of 4    
Author Message
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2442
Posted: 12:35pm 20 Sep 2020
Copy link to clipboard 
Print this post

the below line in your code may be a problem:


'Dim Integer Flag


in particular, that pesky little single quote make at the start of the line!

btw, from experiment, it looks like 1<<bit doesn't need to be bracketed.


cheers,
rob   :-)

addendum: what version of mmbasic are you running? i'm wondering if you've tripped over a more 'severe' case of the bug just fixed in the latest MX170 version, involving the conversion of floats to integers.
Edited 2020-09-20 22:42 by robert.rozee
 
CaptainBoing

Guru

Joined: 07/09/2016
Location: United Kingdom
Posts: 2170
Posted: 12:47pm 20 Sep 2020
Copy link to clipboard 
Print this post

  robert.rozee said  the below line in your code may be a problem:

'Dim Integer Flag


in particular, that pesky little single quote make at the start of the line!


AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!                  

Good spot Rob. Just blind to that... for god's sake!      

You are a star! I feel such an idiot!

Hoist by the Law of the Too-Solid Goof.

  robert.rozee said  
btw, from experiment, it looks like 1<<bit doesn't need to be bracketed.


yes deduced that as well - thanks for checking.

So now I will go and tweak everything back again.    

As to the version, I am running 5.0408 on '170 Micromites (my main interest is embedded micro-controllers). I know, I know... but there is a method to my madness; 5.0408 was the last really stable version before a change that meant VAR SAVEs were obliterated on uploading new software. I can't do that as I store config data in flash and a relatively minor tweak of my code could require re-config on dozens of modules - I am thinking specifically of seven installations of my snooker hall table light control that has a MM and HC12 in a ceiling rose and the light gets turned on and off wirelessly and metered accordingly. Every module there (and the largest club has almost two dozen tables) is configured at first light then stores its config and reports itself to the master at discovery time. As things are, I can simply upload new software to each module (which is work enough) and move on to the next without having to reconfigure each one as well with it's network address, name and some other stuff. I would update everything but that change means I am stuck... it's not such a bad place TBH, 5.0408 is pretty bomb-proof. I have up-times measured in years.
Edited 2020-09-20 23:02 by CaptainBoing
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10315
Posted: 12:52pm 20 Sep 2020
Copy link to clipboard 
Print this post

Take the comment off the DIM line might help  
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7937
Posted: 01:54pm 20 Sep 2020
Copy link to clipboard 
Print this post

  twofingers said  
  Mixtel90 said  I came up with something else of more concern if you are looking for a lot of bit storage. Using original or new versions of these routines I can't reset bits from bit 53 upwards, even though all variables are integers. They will set and test but not reset.

Here's my little test prog. Input command,bit_number e.g. s,0 will set bit 0

bits01.zip


This should work:
Function inv64(b As integer) AS INTEGER
inv64 = b Xor &hFFFFFFFFFFFFFFFF
End Function


Yep, that works properly - right up to bit 63. Thanks. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 4 of 4    
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025