"hello world" with 18f6680


Closed Thread
Results 1 to 40 of 92

Hybrid View

  1. #1
    Join Date
    Apr 2006
    Location
    Alberta Canada
    Posts
    166


    Did you find this post helpful? Yes | No

    Default

    ok, here is the last version of my code... still cant get it to work...

    <code>

    DEFINE OSC 20

    TRISA = 0
    TRISB = 0
    TRISC = 0
    TRISD = 0
    TRISE = 0
    TRISF = 0
    trisg = 0

    LCDA1 VAR PORTE.6
    LCDB1 VAR PORTE.7
    LCDC1 VAR PORTE.3
    LCDD1 VAR PORTG.4
    LCDE1 VAR PORTG.3
    LCDF1 VAR PORTE.5
    LCDG1 VAR PORTE.4
    LCDDP1 VAR PORTG.2

    LCDA2 VAR PORTD.2
    LCDB2 VAR PORTD.3
    LCDC2 VAR PORTE.0
    LCDD2 VAR PORTG.0
    LCDE2 VAR PORTG.1
    LCDF2 VAR PORTD.1
    LCDG2 VAR PORTD.0
    LCDDP2 VAR PORTE.1

    LCDA3 VAR PORTD.6
    LCDB3 VAR PORTD.7
    LCDC3 VAR PORTB.0
    LCDD3 VAR PORTB.1
    LCDE3 VAR PORTE.2
    LCDF3 VAR PORTD.5
    LCDG3 VAR PORTD.4

    pause 500

    'MAIN PROGRAM\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

    start:
    high LCDa1
    high LCDb1
    high LCDc1
    high LCDd1
    high LCDe1
    high LCDf1
    high LCDg1
    high LCDdp1

    high LCDa2
    high LCDb2
    high LCDc2
    high LCDd2
    high LCDe2
    high LCDf2
    high LCDg2
    high LCDdp2

    high LCDa3
    high LCDb3
    high LCDc3
    high LCDd3
    high LCDe3
    high LCDf3
    high LCDg3

    pause 500
    low LCDa1
    low LCDb1
    low LCDc1
    low LCDd1
    low LCDe1
    low LCDf1
    low LCDg1
    low LCDdp1

    low LCDa2
    low LCDb2
    low LCDc2
    low LCDd2
    low LCDe2
    low LCDf2
    low LCDg2
    low LCDdp2

    low LCDa3
    low LCDb3
    low LCDc3
    low LCDd3
    low LCDe3
    low LCDf3
    low LCDg3
    pause 500
    goto start
    end
    </code>

    so it powers up, but it doesnt put and of the ports high.. there is only one LED connected, the rest of the pins arent connected. but i have put my meter across them to see if there is any voltage...

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


    Did you find this post helpful? Yes | No

    Default

    3 things,
    1. no configuration fuses.. make sure you set the right osc mode
    2. disable all multiplexed analog converter, comparator, voltage reference or else fancy stuff
    3. with 18Fs, you want to use LAT instead of PORT to avoid R-M-W behaviour. The best solution is often write to the whole port in one shot instead of using multiple High/Low lines.
    Steve

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

  3. #3
    Join Date
    Apr 2006
    Location
    Alberta Canada
    Posts
    166


    Did you find this post helpful? Yes | No

    Default

    ok....

    1. i wasn't sure how to set the fuses before, but since then i have discovered the .inc file, and i have changed them in there. if i try to add it to the code too, it says I'm overwriting code space.

    2. i knew i had to do that... i just forgot...

    3. i have never even heard of LAT.. is it in the manual? i had a quick look but couldn't find it there. and when you say write the whole port instead of multiple lines, do you mean all of portb at a time? or am i missing something??

    thanks for the help.. i tried using a PIC18F before, and ran into a lot of problems too, so i put that project on hold for a while and went back to 16F's...

    heres the thread about the Robot i built using a PIC18F6585.. http://www.picbasic.co.uk/forum/show...light=treadbot

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


    Did you find this post helpful? Yes | No

    Default

    Awwwww,

    I wondered what happened to the Treadbot.

    Poor little guy. Back-burners such a lonely place. (except at my house, lot's of company there)

    Hope you get back to it some day.
    And I hope I can help out more when you do.
    <br>
    DT

  5. #5
    Join Date
    Apr 2006
    Location
    Alberta Canada
    Posts
    166


    Did you find this post helpful? Yes | No

    Default

    yeah, it seemed to work until the motors got up to a certain speed, adn then it would just freeze.. i started this "project" just to learn the 18f

  6. #6
    Join Date
    Mar 2006
    Location
    Pennsylvania, USA.
    Posts
    130


    Did you find this post helpful? Yes | No

    Default

    If you put +5vdc on portd.4 does the LED light? If not then it's a hardware problem, if it does then try something really simple like;

    DEFINE OSC 20
    HIGH PORTD.4
    END

    Did the port go high? I took a quick look at the datasheet for you PIC, and I didn't see that PortD.4 is multiplexed, so it should work fine.

    LAT is not in the manual, it is in the datasheet, it's a memory register, you've probably seen it as LATA, or LATB, etc.

    Usually when I have this problem it's because I put the LED in backwards, even though I checked it three times before I soldered it.

    Merry Christmas!

    Jerry.
    If your oscilloscope costs more than your car...

  7. #7
    Join Date
    Apr 2006
    Location
    Alberta Canada
    Posts
    166


    Did you find this post helpful? Yes | No

    Default

    i have actually made d.4 an I/O connection on my board.. there is three pins, ground, + and signal (just like a servo). so i had an LED hooked to it, but since then, i have just hooked up my multimeter, and its not showing any voltage across signal to ground when i put it high. i do get 5V across the + and ground. and i can write code to the PIC, and i can read the same code back off the PIC.. its a double stacked board, and i soldered the headers into both boards, so i may need to try to get them apart to look inside where the PIC is..

Similar Threads

  1. 18f6680 N/C
    By mackrackit in forum Off Topic
    Replies: 2
    Last Post: - 29th April 2008, 20:21
  2. need help with "hello world" in hyperterm
    By ericmiles in forum Serial
    Replies: 3
    Last Post: - 31st October 2007, 15:08
  3. 18F6680 and portd problems.
    By jkbh in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 6th June 2005, 10:54

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