Need some help please. I am reading UInt's from PROGMEM. The last value in the PROGMEM table is 0x05DD but the value logged in the IDE is 221 and not 1501 (i.e the upper byte is not taken into consideration). Can someone please show me where I am going wrong?
Thanks
JS
Thanks
JS
B4X:
Sub AStream_NewData (Buffer() As Byte)
.....
.....
.....
Dim prup(72) As UInt
For i = 0 To 71
prup(i) = GetUint(i)
Log("UNIT = ", GetUint(i))
Log("prup = ", prup(i))
Next
End Sub
Private Sub GetUint(Index As UInt) As UInt
Return RunNative("getdata", Index)
End Sub
#If C
#include <avr/pgmspace.h>
const PROGMEM uint16_t progup[] = { //change the data here
0x0000, 0x006D, 0x0000, 0x0022, 0x012F, 0x0098, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0039, 0x0013, 0x0039, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x0013, 0x05DD
};
B4R::Object beo1;
B4R::Object* getdata(B4R::Object* o) {
return beo1.wrapNumber(pgm_read_byte_near(progup + o->toLong()));
}
#End If