Too many error !!


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2007
    Posts
    56

    Default LED blinking ( again )

    I just got a 18F4431 from a friend.
    I tried to make led blink, with following code , but the only LED that turn on/off is the LED on RB0, why ?



    OSCCON = $60 ' Internal oscillator frequency 4 Mhz

    TRISA = %11111111 ' Set PORTA to all input
    TRISB = %00000000 ' Set PORTB to all output
    TRISC = %00000000 ' Set PORTC to all input
    TRISD = %00000000 ' Set PORTD to all output
    TRISE = %00000000 ' Set PORTE to all output

    ANSEL0= %00000000 ' Analog channel AN0-AN7 off
    ANSEL1= %00000000 ' Analog channel AN8 off

    PORTA = 0
    PORTB = 0
    PORTC = 0
    PORTD = 0
    PORTE = 0
    CLear

    main:

    high PORTB
    pause 1000
    LOW PORTB
    pause 1000
    HIGH PORTC
    pause 1000
    LOW PORTC
    pause 1000
    high PORTD
    pause 1000
    low PORTD
    pause 1000
    high PORTE
    pause 1000
    LOW PORTE
    pause 1000

    end
    Last edited by Johan; - 30th June 2007 at 12:53.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    HIGH & LOW work with a "pin". Not a whole port. Try PORTB = %01010101 or
    some other 8-bit value to write to all 8-bits of a port at once.

    If using HIGH or LOW, then use a port 'bit' like HIGH PORTB.0, PORTB.1, etc.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  3. #3
    Join Date
    Jun 2007
    Posts
    56


    Did you find this post helpful? Yes | No

    Default

    Thank you Bruce,
    Yes, now it works

    I am a beginner with PBP,and I learn fast by making mistakes
    Now I will try to put some character on LCD

Similar Threads

  1. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 8th December 2008, 23:40
  2. Optimizing DIV
    By skimask in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 22nd September 2008, 04:58
  3. pbp245 compliation error
    By Woodzy in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 25th July 2006, 05:59
  4. 16F88 Compile error
    By Toley00 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd November 2005, 00:22
  5. Compiler/Assembler Error
    By LT_Pic in forum General
    Replies: 7
    Last Post: - 21st July 2005, 09:47

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