Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: Anzeige Temperatur (IPA 2017)
- * Author: Bregy Yannik
- *
- * Created on 24. März 2017, 09:34
- */
- #include <16LF1518.h>
- #use delay (clock=20000000)
- #fuses HS,NOWDT,NOPROTECT,NOLVP
- #include "LCD.c"
- #byte Port_A = 0x00C //Poti und Switch
- #byte Port_B = 0x00D //Poti und Switch
- #byte Port_C = 0x00E
- #byte TRISA = 0x08C
- #byte TRISB = 0x08D
- #byte TRISC = 0x08E
- //#ifndef LCD_PORTS
- //#define LCD_PORTS
- #bit RB1 = Port_B.1
- #bit RB2 = Port_B.2
- #bit RB3 = Port_B.3
- #bit RC0 = Port_B.0
- #bit RC1 = Port_B.1
- #bit RC2 = Port_C.2
- #bit RC3 = Port_C.3
- #bit RC4 = Port_C.4
- #bit RC5 = Port_C.5
- #bit RC6 = Port_C.6
- #bit RC7 = Port_B.7
- /*
- int Anzeige[10]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09};
- int16 Wert_TypK;
- int16 Wert_TypJ;
- int16 einer = 0;
- int16 zehner = 0;
- int16 hundert = 0;
- int16 temp_TypK = 0;
- int16 temp_TypJ = 0;
- int16 AD_Wert_TpyK;
- int16 AD_Wert_TypJ;
- int16 x = 0;
- float f = 1.96;
- float d = 15;
- */
- void ini();
- ini();
- lcd_init();
- void Function_set();
- void Display_on();
- void Display_clear();
- void Entry_mode();
- void write_data();
- void main()
- {
- while(TRUE)
- {
- }
- }
- void Function_set()
- {
- RB1 = 0;
- RB2 = 0;
- RB3 = 0;
- RC0 = 0;
- RC1 = 0;
- RC2 = 1;
- RC3 = 1;
- RC4 = 1;
- RC5 = 1;
- RC6 = 0;
- RC7 = 0;
- delay_us(37);
- }
- void Display_on()
- {
- Port_B = 0b00000000;
- Port_C = 0b00001100;
- delay_us(37);
- }
- void Display_clear()
- {
- Port_B = 0b00000000;
- Port_C = 0b00000001;
- delay_ms(2);
- }
- void Entry_mode()
- {
- Port_B = 0b00000000;
- Port_C = 0b00000110;
- }
- void write_data()
- {
- Port_C = 0b01000000;
- delay_us(37);
- Port_B = 0b00000010;
- lcd_gotoxy(1, 00); // Go to column 4 row 1
- lcd_putc(0x31);
- }
- void ini()
- {
- TRISA = 0b101000; // A Output und Input
- TRISB = 0b00000000; // B Output
- TRISC = 0b00000000;
- setup_adc(ADC_CLOCK_INTERNAL);
- set_adc_channel(3);
- // setup_adc_ports(ALL_ANALOG);
- setup_adc_ports(sAN3 VSS_VDD);
- // setup_lcd( LCD_MUX14 | LCD_STOP_ON_SLEEP, 2, ALL_LCD_PINS );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement