PicBasic Lookup command


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Lookup command

    Is Lolite a Byte or Word?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  2. #2
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Lookup command

    Lolite is a byte.

    I looked at that...but I don't see anything wrong. Lolite is a byte, out is a byte and all the values are bytes.

    What am I missing?

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Lookup command

    Weird, have you tried on a stripped version of your codeÉ

    Could you post the whole thing here?

    Assuming Lolite is an alias to PORTA, have you disable the analog and/comparator on PORTA ?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Lookup command

    Here is the "complete" code. This is a test area where I have all my equates and variable declarations for a bigger code, but I check little pieces at a time. The piece I'm checking now is the "snippet" I showed in previous post.


    ; Define LOADER_USED to allow use of the boot loader.
    Define LOADER_USED 1

    ;Aliases use Var, symbols use = sign
    ;Code D,C,B, A in that order, from Snowflake to Arm to Light

    ;SNOWFLAKES
    East Var PortD.0 ;Use Port D for Snowflakes and background
    Cent var PortD.1 ;connect to enable line of 74373 latches
    West var PortD.2
    Back Var PortD.3 ;likely always set to "on" to keep background lit

    ;ARMS
    Blu var PortC.0 ;Use Port C bottom nibble for arms
    Org var PortC.1
    Red var PortC.2
    Grn Var PortC.3
    Armson var PortC
    Armsoff var PortC
    ;LIGHTS
    LoLite var PortA
    HiLite var PortB

    L0 Var PortA.0
    L1 var PortA.1 ;Low Lamps 0-7 Lo.0=first inside, using port A
    L2 var PortA.2
    L3 var PortA.3
    L4 var PortA.4
    L5 var PortA.5
    L6 var PortA.6
    L7 var PortA.7

    H0 VAR PortB.0
    H1 VAR PortB.1
    H2 VAR PortB.2
    H3 VAR PortB.3 ;High lamps 8-11 Hi.11=last outside, using port B

    x var byte ;index variable for low lamps 0-7
    y var byte ;index variable for high lamps 8-11
    del var byte ;use var Word if value>255
    d var byte
    out var byte


    ;****************Program Start******************
    Initialize:

    TRISA= %00000000 ;set portA to all output
    TRISB= %00000000 ;set PortB to all output
    TRISC = %00000000 ;Set PORTC to all output
    TRISD= %00000000 ;Set PortD to all output
    Low Blu
    Low Org
    Low Red
    Low Grn
    LoLite=0
    HiLite=0
    low east ;initialize
    low cent
    low west
    ;high east
    High Cent
    ;High West

    ;Armson=$0F ; all arms on, same as High Blu, High Red, etc
    ArmsOff=$00; all arms off
    d=0

    Main: Gosub growspin
    goto main

    ;*********************Subroutines***************** **********


    growspin:For d = 0 To 7
    Lookup d,[$1,$3,$7,$f,$1f,$3f,$7f,$ff],out
    Lolite=out
    pause 100 ;first 8 in about 2/sec for pause=100
    Next d ;entire snowflake in about 1 sec
    ;For d = 0 To 3
    ;Lookup d,[$1,$3,$7,$f],out
    ;Hilite=out ;
    ;pause 100 ;
    ;Next d
    ;pause 500 ;hold all at end for 1/2 second
    LoLite=0
    Return

  5. #5
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Lookup command

    I figured it out. Not having played with too many CPU/MPU/MCU that are multi purpose I was not aware that the port could be analog or digital
    Initializing Ansel to 0 fixed the problem. The code works now.
    Thanks for reading this and attempting to help me.
    Reading the spec sheet (all of it), triumphs again!!

  6. #6
    Join Date
    Jun 2011
    Location
    Indian Harbour Nova Scotia
    Posts
    108


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Lookup command

    Okay, one problem solved...now another. I'm using RA6 and RA7 and want to use the internal oscillator. I think I have to set bit 2 of CONFIG1 to 1 in order to select INTOSCIO.
    I tried config1= config1|%00000100 (|= OR) but I get a compile error. I can't find anything via Google, via other programs on how to do this.
    I'm using PIC Basic Pro. I don't want to disturbe the other bits, which is why I'm using OR.

    anyone?

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Lookup command

    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts