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


Closed Thread
Results 1 to 27 of 27

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Was getting pretty tired during that last post, so cut it off a little short. But, now that I've had a good Day's sleep, let's see if I can tackle the rest.

    You're probably out of town by now, but that's ok. It'll still be here when you get back.

    Also why do you have 2 endif statements?
    Good catch, the first one was supposed to be an ELSE.(DOH!) I modified the original post.

    SEROUT2 PORTD.0, 813, [STR htxt\StrLen,13,10] ;; May I still use SEROUT or Must I use SEROUT2. ( [STR htxt\StrLen,13,10] I do not full Understand this portion could you explain to me what this is doing?)
    No, you don't have to use SEROUT2. It just makes it a little easier, so I tend to use it more often.

    The STR-ing function can send the entire contents of an array with one easy statement. In the case of STR htxt\StrLen, it will send the number of bytes specified in the StrLen variable from the htxt array.

    It's pretty much the same as ...
    Code:
    For X = 0 to StrLen
        SEROUT PORTD.0, T1200,[htxt(X)]
    NEXT X
    It's up to you which one you prefer. But STR isn't avaialable with SEROUT.

    And ..., oh I guess that's all there was. Must have been really tired.
    <br>
    DT

  2. #2
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default Coding styles

    There's big upsides in producing clean, readable and well commented code. Namely for mainly for maintainability. When you type out large programs without comments and go back to them 6 months down the track to revise them, you'll find that you'll spend some considerable time in recalling what's what. Comments also make your program much more legible to anyone else who reads them. Some languages are case sensitive, Java's one of them, I think this in someways encourages the programmer to adhere to acceptable standards. Indenting your code also improves readability, in my opinion, a fine example of well formated code would be Melanie's, Darrel's & Mister_e's. In the long run, you'll save time and probably end up producing much better algorithms if you go the extra mile to properly format & document your work. Most often, programs written in BASIC that make use of many colons are quite quickly dismissed as "spaghetti code"

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