C vs PBP


Results 1 to 16 of 16

Thread: C vs PBP

Threaded View

  1. #8
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    I think this translates over to PBP. I could be completely wrong.
    Code:
    'config statements to be fixed up
    leddigit var byte[15]:value var byte:dig var byte[4]:i var byte:t var byte
    x var byte:y var byte:z var byte:in var byte:s var byte:j var byte[4]
    k var byte[4]:j[1]=1:j[3]=1:k[2]=1:k[3]=1:for i=0 to 15
    lookup i,[1,59,18,6,72,36,32,15,0,12,8,96,49,66,48,56],leddigit[i]:next i
    main: cmcon0=7:ansel=0:porta=12:trisa=12:portc=0:trisc=0
    ADC:
    if porta.3 = 0 then
         in = 0:for i=0 to 12:while porta.3=0:wend:s=porta.2:in=in|(s<<i)
         while porta.3=1:wend:next i:while porta.3=0:wend:value=in:z=0
         if value < 1000 then z=1:dig[0]=0:goto jump1
         dig[0] = value / 1000
    JUMP1: dig[1]=value dig 3:dig[2]=value dig 2:dig[3]=value dig 1:dig[4]=value dig 0
    endif
    for y = 0 to 4
         if y = 0 and z = 1 then
              y=1:portc=leddigit[dig(y)]:porta.5=leddigit[dig(y)]>>6:porta.0=j[y]
              ra1=k[y]:porta.4 = y.1:for t = 0 to 327 : next t
         endif
    next y:portc=$ff:porta.5=1:goto adc
    END
    Oh...and it's been colonized!
    Hi Jeremy,
    I wasn't trying to translate this, but thanks! I was trying to figure out the unusual way the lookup table was set up. Seems the author was "thinkin' outside the box" So I learned something, which is my objective here. Seems I ticked off Darrel, so whatever he had to show me is history, I didn't expect him to sit and write me a program, but he did, . . . so if your reading this Darrel, I apologize . . . anyway Thanks Jeremy, and Bruce, I got a grip on why this piece of code is written this way. <br> I will play with this "colony" to extract what I might learn from it. I think what bugs people about the colons is it makes it hard to distinguish colons following a LABEL vs colons denoting a new line of code.
    Last edited by Archangel; - 4th July 2008 at 02:55. Reason: html is turned off
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. PBP, ASM and LST files
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2010, 13:43
  3. Compiler differences between PBP 2.33 & 2.46
    By nikopolis in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 2nd May 2006, 19:01
  4. Newby- PBP wont compile for 18F (MPLAB)
    By jd76duke in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th December 2005, 23:30
  5. PBP / XP Crash
    By pondindustrial in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th November 2005, 03:16

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