Picbasic errors


Closed Thread
Results 1 to 16 of 16

Thread: Picbasic errors

  1. #1
    Join Date
    Sep 2006
    Posts
    747

    Default Picbasic errors

    I am trying to complie this program and I get many errors, on every line starting at the 5thline, it do not like the variable b0 and b1 . This program is taken from a book and should work. Why am i getting all those errors

    start:
    Low 0
    Low 1
    POT 2,255,b0 '5
    Pot 2,255,b1
    IF b0 = b1 then start
    IF b0 > b1 then greater
    IF b0 < b1 then lesser
    greater:
    b2 = b0 -b1
    if b2 > 10 then cw
    goto start
    lesser:
    b2 =b1-b0
    if b2>10 then ccw
    goto start
    cw:
    high 0
    pause 100
    goto start
    ccw:
    high 1
    pause 100
    goto start

  2. #2
    Join Date
    May 2004
    Location
    New England
    Posts
    164


    Did you find this post helpful? Yes | No

    Default

    Have you defined all the variables? ie:

    B0 VAR BYTE
    B1 VAR BYTE
    etc

    ... or included the appropriate 'include' file for Basic Stamp compatibility?

    Arch
    "Data sheets? I ain't got no data sheets. I don't need no data sheets. I don't have to read any stinking data sheets!"

  3. #3
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    YES THAT WORKED

    But I bought a book from John Iovine. The codes inside are then mising instruction from whT i can see. Why the heck he did not put in the initialization value.


    Anybody knows a good tutorial for pic in basic or C ?


    I have been trying to make this one work :
    any idea ( it just stop on the third line, and all theotehr after that..)

    ' LCD test display
    pause 1000
    Serout 1, N2400, (254,1)
    Pause 2
    Serout 1, N2400, ("Hello")
    Serout 1, N2400, (254,192)
    pause 2
    Serout 1, N2400, ("Bye")
    end


    k

  4. #4
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Default

    Ok,

    you just don't understood our first hint. Here is the second:

    Put your cursor inside the word "serout" (using the MCS),
    hit F1,
    read the help.. ! (or look at your pbp-manual!)

    There is an "include xxxx" in red letters after the first paragraph !

    Use it !


    You use the constand N2400 in your 3rd line, which is not declared...
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  5. #5
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    I read the small tutorial on this link:
    http://www.imagesco.com/articles/lcd/05.html

    THE book I am reading use terminology N24400 while the compiler I use uses: PortB.0,0, thus in the last I did not declare anything and it compiles

    also I have a 16x2 lcd. I hooked up ground pin and vcc. The screen lights up, but I tried all the pins on the screen running from pin 6 of the Pic16f84 but I am not seeing anything
    Is there a delay?
    I am not sure is there is only one wire or more is needed
    thanks

    ken

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


    Did you find this post helpful? Yes | No

    Default Re: code

    Hi Ken,
    the code you are using is listed in his book, PIC Microcontroller Project Book, page 201, Yes?
    It appears as though you are using PIC BASIC PRO.
    The code you are using was written for PIC BASIC , not pro, look farther down the page, the code for your PBP compiler is listed and continues on the next page. This problem you are having centers upon the author is so deeply used to adding those things into a program that he forgets, a beginner doesn't already know this. You have to create variables in order to use them, and you need to INCLUDE some files sometimes to make things like serial communication and LCD modules work. Chuck Hellebuyck wrote a book, which is not perfect either (at least in my opinion) but it is a good one, called Programming PIC Microcontrollers With PIC Basic and it takes you by the hand here, and the code works, I have both books and one other plus "The Manual" and I still ask for help as I am only about a month farther down this road than you are. I really recommend you read as many posts in this forum as your eyes can tolerate. YOU WILL LEARN TONS, if skills can be weighed that way.
    Hope this helps.
    JS
    Last edited by Archangel; - 10th September 2006 at 03:18.

  7. #7
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    yes I found that out a couple of hours ago,
    I even saw on a web site the exact program I was doing in both version:
    http://www.imagesco.com/articles/lcd/05.html
    The second book from John Iovine explains this.
    But I still having trouble sending information to the LCD. It powers on. He says that I need only one wire to the LCD. I tried every pin out possible and it do not work., It should be pin 6 on the chip. Do i need to rewire the lcd ?

    ken

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


    Did you find this post helpful? Yes | No

    Default Wires

    Ken,
    Generaly serial data for 1 way communication requires a data wire and a ground.
    2 way communication needs a second data wire. If you are using a serial Backpack on an LCD module then you need a power wire.

    Regards
    JS

  9. #9
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Yes I do have a wire goping to ground, Pin 1 on the LCD and Vcc, pin 2 on the lCD, There re 16 pin on the lcd and no idea which one is the incoming.. My pic16F84a is program to output on pin 6.
    main:
    pause 1000 ' wait for the LCD to startup
    serout PortB.0,0,[$FE,$01] ' clear the screen
    serout PortB.0,0,["Wherever you go"] ' send string “Wherever you go”
    serout PortB.0,0,[$FE,$C0] ' move the cursor to the 2nd line
    serout PortB.0,0,[" there you are "] ' send string “ there you are ”
    pause 1000 ' pause for a second
    goto main ' loop

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


    Did you find this post helpful? Yes | No

    Default Do you have a serial LCD Module ?

    If you do not have a serial LCD, which is to say if it does not have an extra circuit board with a PIC or other controller you must use LCDOUT not serout.
    Look at the diagram on page187 of Mr. Iovine's book and accompanying code.

    Or page 96 of the MELABS p basic pro manual. The LCD unit with 16 pins or 14 pins on the non backlit units require extra circuitry, usually a PIC to work. The link I am providing is a source for one I have used to convert to serial use, however; this unit uses some Propriority commands which are available on his website, go and look at his links. http://www.wulfden.org/k107/index.shtml
    Looking is free.

  11. #11
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    well on page it is a test circuit for toxic gaz. but RB3 of the 16F84A is directly into the lcd screen. I guess his board is different. BUt I tried changing SEROUT to LCDOUT but it do not work either.

    There must be a way to print out without using another circuit.

    ken

  12. #12
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Lerameur,

    There are basically 2 types of LCD dsplays, a parallel one and a serial one. It is easier for these authors to greatly "simplify" software examples using a serial LCD display. It only requires 1 wire connected to the PIC. The command structure is also somewhat easier to use. The serial display will also require 2 wires for power. A contrast pot is usually on the second PC board. This second board is connected to the 16 or so pins on the LCD board.

    The LCD you are talking about that you have is a parallel display, as long as nothing esle meaning a second circuit board mounted on its back. You will need to put 2 wires for power, 1 wire with a potentiometer wired between + and ground for contrast, a wire for Enable, and a wire for the register select pin. Some more advanced applications will require another wire for Read/Write functions. Now to make things seem even more complicated, you have 2 modes of operation on a parallel LCD. 4 bit and 8 bit operation. In 8 bit operation you will use all 8 data lines on the LCD for sending data to the display plus the control lines. In 4 bit operation you tell PBP (software) which set of 4 data lines you are going to use, either the lower 4 bits (DB0 to DB3) or the higher 4 bits (DB4 to DB7). These setups are called DEFINES in the program and they specify how you plan to wire your display to the PIC. Once that is done, you can write to the display using LCDOUT commands.

    I and the rest of the members of the forum STRONGLY suggest you spend some time getting and reading the datasheets on your LCD display and the PIC you are using. (no books to buy, just download these for free) And plan on spending a couple of days reading the posts on this forum. I can also guarantyee you that you will get all of the information you need to make your projects work. Of course, if you are still confused you can ask for assistance here.

    I also have both of the books mentioned in previous posts to this thread. You really need to pay close attention to their program examples. It does say they are for either PicBasic Compiler or Pic Basic Pro. I have been doing PIC projects for about 3 years now and I would have to say that this forum has been fantastic as far as getting an education on the subject matter. Up until Melanie's recent post about helping noobies I to was concerned of being embarassed or ridiculed about asking the proverbial "stupid question" but I can say that by reading the old posts here and studying the data sheets and trying many things you will get the results you are looking for. Don't hesitate to ask questions but try to find the answers yourself first. I made myself a notebook based on the many topics that have been discussed here and refer to them first if I have a problem. These people here are really great and I appreciate the time and effort they put into helping total strangers all around the world. This is a great site!

    Keep plugging away. I hope my explanation helps you out.

    BobK

  13. #13
    Join Date
    Oct 2004
    Location
    Hangover, Germany
    Posts
    289


    Did you find this post helpful? Yes | No

    Angry

    You have to buy this LCD-02 from his page:

    http://www.imagesco.com/microcontroller/lcd.html
    PBP 2.50C, MCS+ 3.0.0.5, MPLAB 8, MPASM 5.14, ASIX Presto, PoScope, mE mikroBasic V7.2, PICKIT2

  14. #14
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Thanks Bob,

    I have some serious reading to do before going into production then .
    I go a book from my library in assembler, after that I think I will go to Baisc, I have not seen a lot of programing in C .
    The serial Lcd is very expensive though, I 'll see what i can do with the one I have for now

    k

  15. #15
    Join Date
    Sep 2006
    Posts
    747


    Did you find this post helpful? Yes | No

    Default

    Also,
    from this link: http://www.wulfden.org/k107/index.shtml
    There is a pre programed chip, they dont give you that code, would you know where to get it?,

    ken

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


    Did you find this post helpful? Yes | No

    Default yes I do

    Quote Originally Posted by lerameur
    Also,
    from this link: http://www.wulfden.org/k107/index.shtml
    There is a pre programed chip, they dont give you that code, would you know where to get it?,

    ken
    http://cgi.ebay.com/Serial-LCD-Kit-1...QQcmdZViewItem

    P H Anderson sells the chips to Wulfden, he will sell them to you too. His prices in quantity are(as I Remember) about 50 cents over what you pay for unprogrammed chips. He does not license the code. You can contact him through the ebay link above. You can also sit down and write a similar code, after you learn some more. As I recommended earlier, read other peoples posts and use the search button to find what interests you. If you need serial LCD modules they are available in a lot of places including ebay, or buy a kit, or roll your own, or use the LCDOUT procedure for parallel lcd modules like the one you have.

    HERE IS A LINK TO THE PBP MANUAL, LOOK AT THE SECTION RE: LCDOUT
    on adobe page 53 - manual page 93, 94, 95, 96
    http://www.melabs.com/downloads/pbpm304.pdf
    Last edited by Archangel; - 12th September 2006 at 09:58. Reason: ADD CONTENT

Similar Threads

  1. Replies: 3
    Last Post: - 1st July 2008, 22:07
  2. Picbasic Pro Demo assembly errors
    By mikeRho in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 2nd January 2008, 07:41
  3. Replies: 22
    Last Post: - 12th July 2005, 18:39
  4. PicBasic Fundamentals
    By Billyc in forum General
    Replies: 9
    Last Post: - 4th May 2004, 11:04
  5. PicBasic Pro & PicBasic syntax different
    By Billyc in forum General
    Replies: 5
    Last Post: - 16th April 2004, 22:19

Members who have read this thread : 1

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