Changing output binary number sequence? is it possible?


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262

    Default Changing output binary number sequence? is it possible?

    hi everyone, looking for a fix to my output problem, i am outputing a simple 1-8 on a counter loop on porte on a 18f4550.
    Im usine porte 0-2, basically

    Code:
    cnt=0
    loop:
    porte = cnt
    cnt=cnt+1
    if cnt=8 then cnt=0
    pause 10
    goto loop
    heres the problem, im driving an electroni circuit that is not a binary input but it does have a decimal output, it takes 3 inputs and outputs 0-7 but the 3 inputs are not binary, if i treat them as binary it works but the decimal output is out of order.

    what i want to do is have a ?sequence? setting like getnextnumber(1,4,3,6,2,7,5,0) <fake code for example only>
    in visual basic there is a lookup command, im not sure if there is something like this for pic basic pro.

    I could do this with expanded code using lots of if then statements but i would like to keep my code pretty short.
    any ideas would be helpfull.

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Changing output binary number sequence? is it possible?

    Have you checked the manual?
    If you do you'll find that there indeed is a LOOKUP command and that it does exactly what you want.
    Code:
    LOOKUP cnt, [1, 4, 3, 6, 2, 7, 5, 0], PORTE
    /Henrik

  3. #3
    Join Date
    Dec 2012
    Location
    Tennessee
    Posts
    262


    Did you find this post helpful? Yes | No

    Default Re: Changing output binary number sequence? is it possible?

    thanks for the quick reply, yea i lost my manual, so i looked it up on the online manual, I think ive got it figured out.
    Im going to pint out a new manual, hopefully this will stop a few of my questions. thanks again.

Similar Threads

  1. Convert long binary number to ASCII Decimal
    By Joe Rocci in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 9th July 2009, 13:58
  2. Changing bits in a byte for multiple output
    By tazntex in forum Serial
    Replies: 3
    Last Post: - 11th August 2008, 19:10
  3. Help changing CCP3 output pin
    By ChrisHelvey in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th July 2008, 02:30
  4. How to send a binary string on an output?
    By Robson in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 25th July 2007, 22:54
  5. Switch Sequence
    By Tissy in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 13th February 2005, 20:36

Members who have read this thread : 0

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

Posting Permissions

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