Sie sind auf Seite 1von 2

include<htc.h> #define _XTAL_FREQ 8000000 #define CH1 PORTBbits.RB0 #define CH2 PORTBbits.RB1 #define RS PORTBbits.RB2 #define RW PORTBbits.

RB3 #define EN PORTBbits.RB4 #define RST PORTBbits.RB5 void LCD_Init(); void set_add(); void main() { TRISB = 0x00; TRISD = 0x00; //Making Both Input and Output Port as Output Bort CH1 = 1; CH2 = 0; LCD_Init(); __delay_ms(200); set_add(); } void LCD_Init() { EN = 1; RS = 0; RW = 0; PORTD = 0x3F; EN = 0; } void set_add() { EN = 1; RS = 0; RW = 0; PORTD = 0b01000001; EN = 0; __delay_ms(2000); EN = 1; RS = 1; PORTD = 0xFF; EN = 0; } 2)^ Yes indeed. Now its working already. But i am facing another problem. I cannot use PORT A & PORT E as input or output port. How can i configure it ? I am trying to receive input signal from RB7 and when input signal is detected a t RB7, the PIC will sent outputs from RB0-RB6.

#include <pic.h> #include <htc.h> #include <stdio.h> __CONFIG(XT&WDTDIS&LVPDIS);

int main(void) { TRISB=0B10000000; while(1==1){ if(RB7==1) { PORTB=0B01111111; } else if (RB7==0) { PORTB=0X00; } } }

Das könnte Ihnen auch gefallen