• 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

    swr999

    Thank you Dave. Good example!
    /steve

    ADC setup on 12F1822 ??

    swr999 4 Days Ago Go to last post
    DavidP

    Here is a program I wrote a few years ago for 12F1840 used for testing of hobby servos for our First Robotics team at the time. I works quite well. I

    ADC setup on 12F1822 ??

    DavidP 5 Days Ago Go to last post
    swr999

    This is very sad news. Like so many others I never met Darrel but I learned so much from his posts over the years. Thank you Darrel, and Rest in Peace.

    The passing of Darrel Taylor

    swr999 5 Days Ago Go to last post
    swr999

    To the OP: Without wanting to detract from the thrill of working through the Microchip floating point routines, have you considered a fp hardware solution?

    Floating point rutines in PBP

    swr999 6 Days Ago Go to last post
    Pista1

    Hello Guys,
    I do not think that the 100k/10k is the issue here because according to Thevenin's theorem the source resistance in this particular

    ADC Calculation not working

    Pista1 6 Days Ago Go to last post