• 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

    Henrik Olsson

    Hi,

    No, not as it was written you don't. Labels don't take up any space or anything so they can be used as "bookmarks" even if

    using BRANCH on 2.60

    Henrik Olsson 1 Hour Ago Go to last post
    helicop2004

    I needed to add a pause statement as i held switch too long.

    Next little problem : I have 2 same goto statements, 1 works the other does

    branch on 2.60

    helicop2004 17 Hours Ago Go to last post
    Keith55555

    I'm looking to do a wake from sleep with an "Interrupt On Change". I've got a pulse from a sensor to trigger this on an I/O. I'm using the PIC12(L)F1822.

    Interrupt On

    Keith55555 18 Hours Ago Go to last post
    helicop2004

    Thanks Henrik, Do I need the mode: label? and I guess the goto start after branch can be deleted. I made more changes to try to complete.

    branch on 2.60

    helicop2004 19 Hours Ago Go to last post
    Henrik Olsson

    Hi,
    If you want to step thru the menu one step for each press of the button then you need to increment the B4 variable manually each time the button

    using BRANCH on 2.60

    Henrik Olsson 1 Day Ago Go to last post