porta.0 and porta.2 only goes high with HIGH command with PIC18F45K80


Results 1 to 10 of 10

Threaded View

  1. #3
    Join Date
    Dec 2014
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Re: porta.0 and porta.2 only goes high with HIGH command with PIC18F45K80

    How weird, in the code everything is ok so it must have happened when I pasted the code.
    Here is the code again

    Code:
    ' PIC18F45K80 Configuration Bit Settings
    
    
    #CONFIG
        CONFIG RETEN = OFF
        CONFIG INTOSCSEL = HIGH
        CONFIG SOSCSEL = DIG
        CONFIG XINST = OFF
        CONFIG FOSC = EC3
        CONFIG PLLCFG = OFF
        CONFIG FCMEN = OFF
        CONFIG IESO = OFF
        CONFIG PWRTEN = ON
        CONFIG BOREN = OFF
        CONFIG BORV = 3
        CONFIG BORPWR = ZPBORMV
        CONFIG WDTEN = OFF
        CONFIG WDTPS = 1048576
        CONFIG CANMX = PORTB
        CONFIG MSSPMSK = MSK7
        CONFIG MCLRE = ON
        CONFIG STVREN = OFF
        CONFIG BBSIZ = BB2K
        CONFIG CP0 = OFF
        CONFIG CP1 = OFF
        CONFIG CP2 = OFF
        CONFIG CP3 = OFF
        CONFIG CPB = OFF
        CONFIG CPD = OFF
        CONFIG WRT0 = OFF
        CONFIG WRT1 = OFF
        CONFIG WRT2 = OFF
        CONFIG WRT3 = OFF
        CONFIG WRTC = OFF
        CONFIG WRTB = OFF
        CONFIG WRTD = OFF
        CONFIG EBTR0 = OFF
        CONFIG EBTR1 = OFF
        CONFIG EBTR2 = OFF
        CONFIG EBTR3 = OFF
        CONFIG EBTRB = OFF
    #ENDCONFIG
    
    
    '************************* DEFINES ******************************
    define OSC 64
    
    
    define LCD_DREG PORTC
    define LCD_DBIT 0
    define LCD_RSREG PORTC
    define LCE_RSBIT 4
    define LCD_EREG PORTC
    define LCD_EBIT 5
    define LCD_BITS 4
    define LCD_LINES 2
    define LCD_COMMANDUS 3000
    define LCD_DATAUS 100
    
    
    '************************ REGISTERS *****************************
    ANCON0 = 000000
    ANCON1 = 000000
    ADCON0 = 000000
    ADCON1 = 000000
    
    
    '*********************** PORT CONFIG ****************************
    TRISA = 100000                                   'porta direction 0=OUTPUT 1=INPUT
    PORTA = 000000                                   'porta preset
    TRISB = 010111                                   'portb direction 0=OUTPUT 1=INPUT
    PORTB = 000000                                   'portb preset
    TRISC = 000000                                   'portc direction 0=OUTPUT 1=INPUT
    PORTC = 000000                                   'portc preset
    TRISD = 111111                                   'portd direction 0=OUTPUT 1=INPUT
    PORTD = 110000                                   'portd preset
    TRISE = 001111                                   'porte direction 0=OUTPUT 1=INPUT
    PORTE = 000000                                   'porte preset
    
    
    '****************************************************************
    '*******************    MAIN PROGRAM     ************************
    '****************************************************************
    pause 500
    lcdout $fe, $01                                     
    while 1
        high porta.0
        high porta.1
        high porta.2
        high porta.3
        lcdout $fe, $80, bin8 porta
        lcdout $fe, $c0, "HIGH"
        PAUSE 1000
        low porta.0
        low porta.1
        low porta.2
        low porta.3
        lcdout $fe, $80, bin8 porta
        lcdout $fe, $c0, "LOW "
        PAUSE 1000
        porta.0 = 1
        porta.1 = 1
        porta.2 = 1
        porta.3 = 1
        lcdout $fe, $80, bin8 porta
        lcdout $fe, $c0, "= 1 "
        PAUSE 1000
        porta.0 = 0
        porta.1 = 0
        porta.2 = 0
        porta.3 = 0
        lcdout $fe, $80, bin8 porta
        lcdout $fe, $c0, "= 0 "
        PAUSE 1000
    wend
    
    
    end
    Last edited by bmoe79; - 22nd January 2015 at 16:41.

Similar Threads

  1. PortA Doesn't Work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 11
    Last Post: - 8th September 2015, 18:41
  2. Replies: 10
    Last Post: - 14th April 2014, 20:47
  3. high voltage high frequency H-Bridge
    By George in forum Off Topic
    Replies: 6
    Last Post: - 27th April 2009, 11:50
  4. AD works in Porta.0 but not in porta.1
    By ruijc in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 19th February 2008, 20:22
  5. turning gpio.0 high after pwm command
    By sirvo in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st February 2007, 18:22

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