I am missing something, what is wrong with this code?


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2009
    Posts
    6

    Default I am missing something, what is wrong with this code?

    I am using Picbasic 1.45
    Microcode Studio 3.0
    Using a 16F690.
    Asm commands works fine, but nothing in basic.

    I always get errors on VAR, CON defines, etc.

    The sample blink program is the only one that seems to compile without errors.

    This is nuts. What am I missing?

    Here is my exact code snippet.

    asm
    Include "P16F690.INC"

    @ DEVICE PIC16F690,INTRC_OSC_NOCLKOUT ' internal RC osc
    @ DEVICE PIC16F690,MCLR_OFF ' Disable external MCLR
    @ DEVICE PIC16F690,WDT_OFF ' Disable WatchDog timer
    @ DEVICE PIC16F690,PROTECT_OFF ' Disable device protect
    @ DEVICE PIC16F690,CPD_OFF ' Disable Code-Protect
    @ DEVICE PIC16F690,PWRT_ON ' Enable Power-up timer
    @ DEVICE PIC16F690,BOD_ON ' Enable Brown-out detect

    endasm

    SYMBOL PORTA = 5
    SYMBOL PORTB = 6
    SYMBOL PORTC = 7
    Symbol TrisA = 133
    Symbol TrisB = 134
    Symbol TrisC = 135

    poke TrisA, 255 ' Set PortA to all input
    poke TrisB, 255 ' Set PortB to all input
    poke TrisC, 255 ' Set PortC to all input

    CALL BLINK_THREE

    main:


    IF bit5 = 0 then jump1

    'do something

    jump1:

    IF bit4 = 0 then jump2

    ' do something

    jump2:


    goto main


    BLINK_THREE:

    poke PortA, 2
    pause 100
    poke PortA, 0
    pause 100
    poke PortA, 2
    pause 100
    poke PortA, 0
    pause 100
    poke PortA, 2
    pause 100
    poke PortA, 0
    pause 100

    return


    END

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manta_z View Post
    I am using Picbasic 1.45
    Microcode Studio 3.0
    Using a 16F690.
    Asm commands works fine, but nothing in basic.
    No, I don't think the ASM lines are working ...
    The @ symbol is not supported with PBC. But they're inside an ASM block anyways. @ is not valid in ASM either.
    I always get errors on VAR, CON defines, etc.
    Those statements are not valid in PBC.
    You have to use Symbols, Peeks and Pokes.

    The sample blink program is the only one that seems to compile without errors.
    This is nuts. What am I missing?
    I think you're missing that any example you find on the Internet for PicBasic, will actually be for PicBasic Pro.

    They are completely different languages.
    Most PBC programs will run with PBP, but the reverse is almost never true.
    <br>
    DT

  3. #3
    Join Date
    Mar 2009
    Posts
    6


    Did you find this post helpful? Yes | No

    Default What the?

    Hey how can someone be posting questions as me.
    What the?

    This message was NOT posted by me yet has my name on it.

    the real Z_manta!

    Nice!!!!

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


    Did you find this post helpful? Yes | No

    Default

    Well, that was your first day here ... (Joined March 17, 2009) St. Patrick's Day.

    Each post is tagged with an IP address, and all of your posts were made through the same dial-up or dynamic ISP (qwest.net).

    Maybe you just forgot about it?
    <br>
    DT

Similar Threads

  1. Nokia COLOR LCD PicBasicPro 2.50a example code
    By skimask in forum Code Examples
    Replies: 49
    Last Post: - 28th September 2011, 01:43
  2. PIC BASIC TLC5940 code
    By eletrokat in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2010, 21:01
  3. PIC18F4620 , what's wrong with my A/D converter code
    By Porcusoru in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd July 2009, 20:35
  4. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  5. Re-Writing IF-THEN-AND-ENDIF code?
    By jessey in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 18th August 2006, 17:23

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