Menu

AVR Swap4(xByte) don't work ???

Erdy
2015-02-28
2015-02-28
  • Erdy

    Erdy - 2015-02-28

    Hello,

    GCB AVR Swap4 Test Code

    ' --------------------------------------

    chip mega328p, 16 ' 16MHz

    ' Arduino PIN 13 (green LED)

    define PIN_13 PORTB.5

    ' Baud Rate

    define USART_BAUD_RATE 57600 ' To PC Terminal

    'Set the pin directions
    '
    dir PIN_13 out
    '
    For iz = 1 To 5
    wait 200 ms
    PIN_13 = On
    wait 100 ms
    PIN_13 = Off
    Next iz
    '
    bTmp = 0b00001111

    aTmp = Swap4(bTmp) ' **

    HSerPrintCRLF
    HSerPrint "bTmp: "
    HSerPrint ByteToBin(bTmp)
    HSerPrint " Swap= "
    HSerPrint ByteToBin(aTmp)

    HSerPrintCRLF
    HSerPrintCRLF
    HSerPrint ("Finished")
    HSerPrintCRLF
    HSerPrintCRLF

    End
    ' --------------------------------------

    Output in Terminal

    ---------------------------------------- >
    bTmp: 0001111 swap= 00001111
    >
    Finished >
    ----------------------------------------

    Nothing is done aTmp = bTmp

    Erdy

     

    Last edit: Erdy 2015-02-28
    • Anobium

      Anobium - 2015-02-28

      That was marked as offensive. Please be careful when posting and using offensive words we have a very wide community reading these posting.

       
  • Anobium

    Anobium - 2015-02-28

    This is fixed in the next release.

    This is the output from my release candidate GCBasic.

    bTmp: 00001111   Swap= 11110000
    
    Finished
    

    See here for the changes in the next release.

     
    • Anobium

      Anobium - 2015-02-28

      @erdy I have sent you an email with version of GCBasic.exe with a fix for the issue.

       
      • Erdy

        Erdy - 2015-02-28

        Thank you.

        These offensive fossiles of a previous test on 'define' were edit/deleted less than two minutes after posted. Sorry :-).

        Erdy

         
  • Anobium

    Anobium - 2015-02-28

    For AVR users.

    Until the next release please avoid using IF (condition) (logical test) (condition) THEN

    IF statements with logical tests is a known issue. Avoid by using multiple if statements.
    IF (condition) then
    if (condition) THEN

    This should be resolved in the next release.

    Anobium

     

Log in to post a comment.