Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
When you have a single register and each bit is on or off and you need to turn one on You don't "add" you "or"
If you need to change a bit in a byte you XOR it..
Hi I,Define the bits ..
PA = 128
MaxPower = 64
OutputPower = 7;
then set what you need..
RegPaConfig = PA + MaxPower + OutputPower
Hi I,Ive been using hex now for soooo long I know the bit weights of by heart... If you don't care for bit weights... Just try and use hex or binary... Most systems have data sheets with all the settings in... You just need to create the definitions in a file.
PA = b10000000
MaxPower = b01000000
OutputPower = b00000111
Just the same....
We work with computers.... Micro's are essentially the same... Binary is the language of the computer..What are bit weights?
Hi I,We work with computers.... Micro's are essentially the same... Binary is the language of the computer..
you have seen the bit weights..... 128, 64, 32, 16, 8, 4, 2 and 1... Each bit carries a decimal "weight" these are pretty well know, Hexadecimal is binary shorthand.... If you can work well with Hex and Bin, your computer programming will be 100% better..
Hi Doc,going back to initial post if you do them separate you command it separate:
MODE = 0x01 ;
Lowfrequencymodeon = 0x01;
if you wrap it together then you need more like as below,
but then you can't call them by the bit names like MODE and Lowfrequencymodeon:
regopmode = (Lowfrequencymodeon<<3) + (MODE);
Morning Eric,hi C,
The '|' is not recognised in OSH, in your eg: list replace the '|' with OR
OSH is very limited so it may burp.
e,g, SX1276SetOpMode(OpMode_ModeLoRa OR OpMode_LowFrequencyModeOn OR OpMode_ModeSleep)
E
Hi Eric,hi C,
Perhaps a simple OR example will make clearer.
You know that a BCD '1' is 00000001 0r 0x01 , we cannot display this using a LCD, which requires ASCII characters.
So to turn this into a ASCII number '1' we OR the 0x01 with 0x30 which makes it 0x31 which is a ASCII '1' character, which we can display.
The 0x01 in BIN is 00000001 and the 0x30 is 00110000 and when they a ORed together give 00110001 .
Do that make sense to you.?
E
Have you tried
Dim regopmode As Byte
regopmode = lrm Or mt
regopmode= regopmode OR res1 :::: you cannot use the 'res', its part of the compiler language, choose say res1