$6C returns 1

johnlong

Senior Member
Hi All
Just playing around with a bit of code to change the settings of Dorji DRF1278DM through the Picaxe
For the pwer level and the CRC (CS)
I found the HEX code in the Instructables LoRA 16 steps
When I simulate it the HEX value $6C in the table reurns as 1 in variable b11
Is this correct if not can anybody shed some light on it for me
Code:
#picaxe 28X2
#rem
' setting for power level and CRC for Dorji DRF1278DM from Instrucables Introducing LoRa 19 steps

wait 2
														
 serout 4,T2400,($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$01,$AB,$0D,$0A) 
'check sum CSbyte
serout 4,T2400,($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$02,$AC,$0D,$0A) 

serout 4,T2400,($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$03,$AD,$0D,$0A) 

 serout 4,T2400,($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$04,$AE,$0D,$0A) 

serout 4,T2400,($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$05,$AF,$0D,$0A)

 serout 4,T2400,($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$06,$B0,$0D,$0A)

 serout 4,T2400,($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$07,$B1,$0D,$0A) 

 wait 2
#endrem



    table 0, ($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$01,$AB,$0D,$0A)
'b11 when simulated reads as 1 ?   
     
    
	    
	    readtable b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23
	    do
	    serout A.0,T2400,(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23)
	    if pinB.7=1 then
		    b20=b20+$01   'Power level of Dorji
		    b21=b21+$01    'CRC (CS) of Dorji
		    if b20=$08 and b21=$B2 then
			    b20=$01
			    b21=$AB
			    endif
endif 
    pause 1000
loop
thanks john
 

hippy

Technical Support
Staff member
Seems to work as expected when I simulate it, reporting $6C / 108 ...

Code:
#Picaxe 28X2

table 0, ($AF,$AF,$00,$00,$AF,$80,$01,$0C,$02,$00,$6C,$80,$12,$09,$00,$07,$00,$00,$00,$01,$AB,$0D,$0A)
readtable b0,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19,b20,b21,b22,b23

b1 = b11 / $10 + "0" : If b1 > "9" Then : b1 = b1 + 7 : End If
b0 = b11 & $0F + "0" : If b0 > "9" Then : b0 = b0 + 7 : End If
sertxd( "b11 = $", b1, b0, TAB, #b11, cr, lf )
I think the problem is that when you simulate your entire program you are seeing what SEROUT A.0 puts out. And the 1 shown there is ASCII character "l", lowercase-L, which looks like a "1", one, but isn't - It had me fooled for a moment or two.

It is actually working as expected just not showing on-screen in the Terminal as you expected.
 

johnlong

Senior Member
Hi Hippy
Thanks so it will actually out put the $6C in the reality just not in the simulater
If I have understand your comment correctly
your little ditty works a dream
regards john
 
Last edited:

hippy

Technical Support
Staff member
Yes $6C will go out in reality, and does in simulation. It's just that $6C is the ASCII code for lowercase-L so the Terminal shows it as that, rather than as [$6C] which is only shown for non-printable characters.

With Terminal open during simulation, if you go into Settings for the Terminal, there's a "Display all RX data as hex" which might be handy here.
 

johnlong

Senior Member
Hi Hippy
Thanks for that using display all RX as HEX does as you say
$6C displayed as $6C
regards john
 
Top