​ ​ ​ ​ $6C returns 1
Results 1 to 5 of 5

Thread: $6C returns 1

  1. #1
    Senior Member
    Join Date
    Jan 2015
    Location
    uk
    Posts
    198

    Default $6C returns 1

    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

  2. #2
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    24,438

    Default

    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.

  3. #3
    Senior Member
    Join Date
    Jan 2015
    Location
    uk
    Posts
    198

    Default

    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 by johnlong; 07-08-2018 at 20:02. Reason: add comment

  4. #4
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    24,438

    Default

    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.

  5. #5
    Senior Member
    Join Date
    Jan 2015
    Location
    uk
    Posts
    198

    Default

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •