How to use Arrays Using Pic Basic Pro(need help)


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Ummm, we'll call that the "skimask initialization syntax".
    You might get that later. Inside Joke.

    But no, it's not commented. The colon ":", separates two statements, as if they were on separate lines.
    Standard BASIC syntax from "In the beginning...."

    Anybody remember Beagle Bros. Two-Liners? What could you do with 2 lines of code, packed as tightly as possible? I think it was 64 characters max per line, but can't remember.

    I have actually picked up the technique again, for the same reason Skimask mentioned: Less scrolling, more compact code listings, keeps related code elements together. Once I got used to it again, I found it easier to read (as long as it wasn't used excessively). Thanks Skimask!

    SteveB

    Edit: A little research yields "less than approximately 150 characters" per line of Apple II code. Page 23 (26th pdf page) of this reproduction 1978 Apple II reference Manual
    Last edited by SteveB; - 30th June 2007 at 18:49.

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


    Did you find this post helpful? Yes | No

    Default

    I agree, in general it's a good idea, but like beer, when used with moderation

    Not bad...
    Code:
    PORTB=0 : LATB=0 : TRISB=0
        '    OR
    SELECT CASE Pouet
        CASE 1 : Gosub MarryHadALittleBoy
        CASE 2 : Gosub DoSomethingElse
        '
        END SELECT
    But erm...
    Code:
    CounterA=0 : CounterB = 1234 : TRISB = 0 : OPTION_REG=%10101010 : LCDOUT $FE,1,"Hello dear!" : Gosub KindaLongLine : IF A=0 then : V=1234 : ELSE : q=908 : ENDIF : GOSUB ItsReallyReallyLongNow : PORTA=128 : PORTC=144 : PAUSE 150 : I2CREAD SDA, SCL, ControlByte, Address, [$FF,$EA, 1,2,3,4,5,6,7,8,9,CounterA, CounterB,0,0,0] : LCDOUT $FE,$C0,"Ok i think you see the picture now" : Gosub OKImDone ' Startup thingy :o)
    that's a bit too much, not sure if it compile anyway

    I don't remind if that syntax was available on that one... ;o}


    That's the whole kit with the speech synthesizer module, but without the tape deck... nostalgic now :-(

    Last edited by mister_e; - 30th June 2007 at 19:09.
    Steve

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

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


    Did you find this post helpful? Yes | No

    Default Re: TRS80

    Quote Originally Posted by mister_e View Post
    I agree, in general it's a good idea, but like beer, when used with moderation

    [/img]
    I never could get one of those to work . . . could't find the ANY Key
    EDIT: DOH TI90 either
    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.

  4. #4
    MrSafe's Avatar
    MrSafe Guest


    Did you find this post helpful? Yes | No

    Default

    I still can not get the arrays to work. Look at my program to see what I am doing wrong I haven't tried the other suggestions yet but I will get started on those as soon as i figure out the arrays.
    Attached Files Attached Files

  5. #5
    MrSafe's Avatar
    MrSafe Guest


    Did you find this post helpful? Yes | No

    Default

    In the program when i do

    lcdout #key it shoots out the key correctly on the lcd however

    when i use

    htxt(x) = #key

    it says bad expression when i try to compile

    also when i use

    htxt(x) = key

    it works fine however it displays a blank spot on the lcd

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by MrSafe View Post
    In the program when i do
    lcdout #key it shoots out the key correctly on the lcd however
    when i use
    htxt(x) = #key
    it says bad expression when i try to compile
    also when i use
    htxt(x) = key
    it works fine however it displays a blank spot on the lcd
    htxt(x) = key ------>>>>> lookup key , [ "0123456789ABCDEF" ] , htxt[x]
    ^get rid of^---------------^^^^^^ replace with ^^^^^^^^^^^

    Your turn to figure out why assigning the variable 'key' to htxt(x) and trying to get the LCD to display what is effectively variable 'key' doesn't work.
    What is the ASCII character equivalent to 'key', if 'key' = 1? if 'key' = 2? if 'key' = 65?
    Last edited by skimask; - 3rd July 2007 at 02:08.

  7. #7
    MrSafe's Avatar
    MrSafe Guest


    Did you find this post helpful? Yes | No

    Default

    i see ill try thank you for the reply. If you don't mind could you give me an example of that a very simple version of it that I could run with. Im sorry for being so ignorant but arrays is brand spanking new to me.


    Your turn to figure out why assigning the variable 'key' to htxt(x) and trying to get the LCD to display what is effectively variable 'key' doesn't work.
    What is the ASCII character equivalent to 'key', if 'key' = 1? if 'key' = 2? if 'key' = 65?
    I can do that quite effectively ahaha its this damn blasted arrays thats slowing me down I have entire codes already done for that portion its just that I want to be able to loop the message over and over but I need arrays to do that and the message is not predetermined it will be different depending on the user.
    Last edited by MrSafe; - 3rd July 2007 at 02:14.

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    Ummm, we'll call that the "skimask initialization syntax".
    HEY...I resemble that remark!

Similar Threads

  1. Sending Commands from Visual Basic about IR to Pic
    By tne_de in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th April 2009, 06:09
  2. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  3. using AND as an IF statement
    By dw_pic in forum mel PIC BASIC
    Replies: 27
    Last Post: - 8th June 2006, 18:05
  4. vb6 to pic basic
    By Darrenmac in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 19th December 2005, 01:56
  5. The Ultimate PIC Basic
    By picnaut in forum PBP Wish List
    Replies: 4
    Last Post: - 9th November 2004, 22:10

Members who have read this thread : 2

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