• 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

    mpgmike

    Angular Timer

    Finally got Angular Timer working in Single-Pulse Mode. I can vary an analog input and have the phase variation change. I tried different trigger frequencies

    mpgmike 17 Hours Ago Go to last post
    richard

    Angular Timer

    i'm fairly keen to have a play with the Angular Timer , i sure it could help solve the battery charger regulation issues i get when they're powered from

    richard 1 Day Ago Go to last post
    mpgmike

    Angular Timer

    I messed with it for another day and got an output that realistically represents the input. I'm trying to alter the CCY value with a pot (ADC input).

    mpgmike 1 Day Ago Go to last post
    mpgmike

    Max and Min

    No, it will never go below 99. MAX & MIN work in reverse of what you would think. You want B1 = B1 MIN 99. Try it.

    mpgmike 1 Day Ago Go to last post
    Roger D

    Max and Min

    Will this keep B1 from exceeding 99 in value?

    B1 = B1 Max 99

    Roger D 1 Day Ago Go to last post