• 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

    jderson

    In my continuing pursuit of converting C to F, I am trying to learn how to use LONGs. I can compile and program the attached program with, and without

    18f1230 and RHT03 splitting word into bytes

    jderson 1 Day Ago Go to last post
    Darrel Taylor

    Well, so much for the Video Driver theory.

    I'm at a complete loss ...
    All I can say is that the error code c0000025 is a common

    Big Bug

    Darrel Taylor 3 Days Ago Go to last post
    Henrik Olsson

    Hi Darrel,
    Yes, it is "a bit" frustrating. Today there's only been that one crash though - still one to many.

    I don't

    Big Bug

    Henrik Olsson 5 Days Ago Go to last post
    Darrel Taylor

    66 ...OUCH!
    That has to be a pain.

    I was talking with NORTON on the phone the other day, and he was describing symptoms that were

    Big Bug

    Darrel Taylor 5 Days Ago Go to last post
    Henrik Olsson

    Hi,
    OK, just started doing some "serious" work on my next project. About 30 minutes in MCSPX crashed:

    I can't say if I

    Big Bug

    Henrik Olsson 5 Days Ago Go to last post