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.
Hi E,hi C,
You use the Bits location in a WORD or BYTE.
eg:
Dim Cam as Byte
say Cam Byte = 40h, 01000000 [ B7 thru B0, Bit7 is the Most Significant Bit]]
The '1' is at B6
so to test use Cam.6
If Cam.6 = 1 then
'do something
else
'do some thing else
endif
A WORD has Bits 15 thru B0.
Ok.??
Eric
EDIT:
You can also SET a Bit in a Byte or Word.
Cam.1 =1
or
Cam.7=0
Hi E,hi,
res1 =irqflags And irgflags.4
Note that res1 after the AND, res1 will '00010000' is this what you really want.?
Do you need an OR function ????
E
Hi E,hi C,
I will try it.
E
Hi C,
Please post the code clips as text, I don't have time to keep translating from an image.
E
If dio0 = 1 Then 'DIO0 goes high from SX1278 when data has been received and ready.
irqflags = spi_read_reg_func(r_regirqflags, irqflags) 'CHECK SYNTAX (SUBROUTINE)
regirqflags_validheader = irqflags.4 'Mask
regirqflags_payloadcrcerror = irqflags.5 'mask
If regirqflags_validheader = 1 Then
If regirqflags_payloadcrcerror = 0 Then
rxsize = spi_read_reg_func(r_regrxnbbytes, fiforxbytesnb)
While x < rxsize
read_reg_spi = spi_read_reg_func(r_regfiforxbaseaddr, fiforxbaseaddr)
x = x + 1
Wend 'IS THIS in the correct place?????????????????????
Endif
Endif
Endif
Hi P,If you use code tags and indent your code it becomes much easier to read (and debug).
I.E.As you can see from the above indenting, the Wend is in the correct place.Code:If dio0 = 1 Then 'DIO0 goes high from SX1278 when data has been received and ready. irqflags = spi_read_reg_func(r_regirqflags, irqflags) 'CHECK SYNTAX (SUBROUTINE) regirqflags_validheader = irqflags.4 'Mask regirqflags_payloadcrcerror = irqflags.5 'mask If regirqflags_validheader = 1 Then If regirqflags_payloadcrcerror = 0 Then rxsize = spi_read_reg_func(r_regrxnbbytes, fiforxbytesnb) While x < rxsize read_reg_spi = spi_read_reg_func(r_regfiforxbaseaddr, fiforxbaseaddr) x = x + 1 Wend 'IS THIS in the correct place????????????????????? Endif Endif Endif
BTW, I don't see where x is initialised.
Mike.
Hi S,Bit testing is either a 1 or 0 result, no need for ">" type of testing. It is either =0 or =1
Morning E,Morning C,
The '>' symbol is a greater than test, a BIT is either 0 or 1.
E
You don't need to upload files to include formatted code. This is what I typed above to include the code,Hi P,
If you look at port#9 you will see that I have had difficulty uploading files. I have managed to do what you say in the past, but they files were blocked by 'protection' I'll keep trying.
C.
Hi M,You don't need to upload files to include formatted code. This is what I typed above to include the code,
View attachment 106686
Note the code tags are just typed.
Mike.