Hi.
I have a problem that if I set porta.0 and portb.2 high with porta.0=1 and porta.2=1 then they will not go high, but if I do HIGH porta.0 and HIGH porta.2 then they will.
porta.1 and porta.3 works as expected.
Anyone know why?
In the display the code below gives me:
00001111
HIGH
00000000
LOW
00001010
=1
00000000
=0
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 '********************** PIN VARIABLES *************************** '************************ VARIABLES ***************************** '************************ 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 '*********************** TIMER CONFIG *************************** '********************* INTERRUPT CONFIG ************************* '**************************************************************** '******************* 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 '**************************************************************** '******************* SUB ROUTINES ********************** '**************************************************************** '**************************************************************** '***************** INTERRUPT ROUTINE ******************** '**************************************************************** end




Bookmarks