• LOOKUP.pbp

    PICBASIC PRO program to demonstrate LOOKUP & RANDOM commands. Converts numeric value to ASCII hexadecimal equivalents.
    ' Name        : LOOKUP.pbp
    ' Compiler    : PICBASIC PRO Compiler 2.6
    ' Assembler   : PM or MPASM
    ' Target PIC  : 12F, 16F or 18F
    ' Hardware    : PC serial connection & terminal for result display
    ' Oscillator  : 4MHz internal or external
    ' Keywords    : LOOKUP, RANDOM, SEROUT
    ' Description : PICBASIC PRO program to demonstrate  LOOKUP & RANDOM commands.
    ' Converts numeric value to ASCII hexadecimal equivalents.
    '
    
    Include "bs1defs.bas"  ' Include BS1 variable and serial definitions
    
    SO Con 0               ' Define serial out
    
    mainloop:
       W6 = W0 : Gosub HexW    ' Print W0
       Serout SO,N2400,[13,10] ' Print end of line
       Random W0		   ' Randomize W0
       Goto mainloop           ' Do this forever!!!
    
       ' Send W6 as XXXX (Uses W5)
    
    HexW:
       Gosub HexB13            ' Print MSB
       B13 = B12               ' Print LSB
    
    HexB13:
       B11 = B13 / 16          ' Print MSB
       Gosub HexB11
       B11 = B13 & 15
    
    HexB11:
       Lookup B11,["0123456789ABCDEF"],B10 ' B10 = HEX$(B11)
       Serout SO,N2400,[B10]
       Return
    
       End
    
               
    Download the file lookup.pbp
  • Recent Forum Posts

    Ioannis

    OK, now it is clear. I could not find this documentation anywhere.

    I got confused as the (unfortunate) example that used number 28 that

    SD Cards

    Ioannis 1 Day Ago Go to last post
    Darrel Taylor

    For FAT16, the starting year (epoch) is 1980.
    The year value in SDFS3 adds to that starting year.

    So 28 is ... 1980 + 28 = 2008.

    SD Cards

    Darrel Taylor 1 Day Ago Go to last post
    Ioannis

    I am experimenting with the SD Cards using the sdfs3.pbp include.

    While setting FAT_year variable to 28 sets the test file in year 2008,

    SD Cards

    Ioannis 1 Day Ago Go to last post
    richard

    maybe someone could write a python script to simulate a calculator that has
    */, ** and div32 buttons and can do unsigned int math for those

    18f1230 and RHT03 splitting word into bytes

    richard 1 Day Ago Go to last post
    Henrik Olsson

    Hi Richard, JD,

    > thanks henrik I thought we got rid of that in post#5
    I'm sure you did but then in post #8 it looks like it

    18f1230 and RHT03 splitting word into bytes

    Henrik Olsson 1 Day Ago Go to last post